Message ID | 20230413231120.544685-1-peterx@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1941vqo; Thu, 13 Apr 2023 16:19:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aLbfLI63CAvjtgU2xZ9WBOb7GpSHTI1HNPXDfERf8qobVuW4v549niEbWjOr+HFq5h22YG X-Received: by 2002:a9d:6ad3:0:b0:68d:4eb7:49d9 with SMTP id m19-20020a9d6ad3000000b0068d4eb749d9mr1722363otq.37.1681427944880; Thu, 13 Apr 2023 16:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681427944; cv=none; d=google.com; s=arc-20160816; b=fm6nn5/iMXkIDo8wI38vun/KCR27syhYL2+p/0iurc1Jqhs0jBuyX24tUwYtohSc1K lqgjX7nySQYvhbEIN9byzVtXpCNRBVegL6YRBOWsX6gHuIJHVB1hj8jcuA6gNCHbxBN0 k3oF2XReanL8/Qp1aQSqHnpWce/5Oz5+mmQUBGjagWg/E/w8n4bJ8zsooe73Yq2yLNMl wfjyu4PILNBhodP2wrL04DY/qICuYck/IHQ1Agd1+QPFBD0G6uYLgSjXbIuKaoorOGlg tK9teAXxo7e/FsoujDV/eZAI+J2n1gqa7kOvm7lQjDUVVlJ1G9iE+R8ZwKOktqGFQTCW t//w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Sy2ZMNXqMN2EgcAsVUaOWzVqOHhPBbCxJILj4M5ud0k=; b=RCuQzAuQU1g8g3NoxOk4ihRkrwkpRvmX7DSQbo6QJ/b0616f8AjuS3HuPhEPyJ6G/S EGEU704zgt4mBJpRZXIckLZQu3JOv0TC1NalUGa7xDj+h7T2uGweG2Js1N2yS4YAMLtN 5hG3ErmtIzmrVhbdnDmbs31l82DzKtoTweJxJTrdPAFhu91f8genHshcIfpQr6HCR6R3 PUD3CQSeRgqcE8Ie3x9pqq+qIgb5VJ4aXtXFK9lWsUJJV/iGOgdyDHDYHXxUOgwqIpQi SoZH1Eq6S4F+E4xuLjIup5tlZdKXslqnJJA75da3nMdYhfHHPX9him0A4AAfINLm0mEc 6vjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YYNKPc9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a9d6a47000000b0069f8920dd0fsi2988027otn.86.2023.04.13.16.18.26; Thu, 13 Apr 2023 16:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YYNKPc9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjDMXMU (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Thu, 13 Apr 2023 19:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjDMXMS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Apr 2023 19:12:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3456849CE for <linux-kernel@vger.kernel.org>; Thu, 13 Apr 2023 16:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681427485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sy2ZMNXqMN2EgcAsVUaOWzVqOHhPBbCxJILj4M5ud0k=; b=YYNKPc9WORqOAu1hab8rlTQEQsUOeILIkIjilmAPno5Mc1fBMBXu4rCfDR2L2VNSEsHOUL 1BEwOfrc52s1gJGSMxZof3tYCXBEw8jFLHh2SXRKj1LyS7Sc5YpENXPggJq3bODzPdGWk3 hMNmlHq+pc0y/7qqqH0deImazXRP/Xs= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-505--50IN8n6OUiRHViocjYnyg-1; Thu, 13 Apr 2023 19:11:24 -0400 X-MC-Unique: -50IN8n6OUiRHViocjYnyg-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-3e947d81d7dso3391281cf.1 for <linux-kernel@vger.kernel.org>; Thu, 13 Apr 2023 16:11:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681427483; x=1684019483; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Sy2ZMNXqMN2EgcAsVUaOWzVqOHhPBbCxJILj4M5ud0k=; b=IhR57ynZr48BsYmve/A3ETMNHeiqo4Wa3Y/9r3C5DLcMVUBxCjAdVSfs3zp1oj0heY avT5paJm1qibnJDRcVy7a2Gb0cg1aVllLG/sIY20O9JQVYD4IJAkw9Nk6iDtUToQQJb2 +oUdCext6WLUXoQlDn06mrHVE4r293+YtGiRbRqXkj5qLTgSuGq51aP/l7nxls3jFEM0 +Uz8VnK90e0XUFi9Vkcm/cpP4d6NM1EBcvI7CHxZLx3tlEfE7rUwq4IU7wVFGaEReHz0 gB1dc5Ytl2pV+SBfqMyBLYsSThfrW9wz88oX/NDvqbo5sf1O6nmosqDGZGlCM0MZ2vEm 1Z9g== X-Gm-Message-State: AAQBX9ePl7mRrR6q7dtH/Z9c/PZlM4X3GF5SIbUG9X5JC1H+Fsa7T9iL HQD55C3/d5rJc8vpAOxwA9HYvnefKYHY4NOs5CkFwD6jRIWGRl8T711uH7hsxOy/FVK9DEaII0T jDbOf7kxEM7SMnhpJ2wKEaThT9zOH2aWZCR/g8NPNDXuP2vETM16JEE222YXseeNj1BQRCxb9cC KTCoksJw== X-Received: by 2002:ac8:4e43:0:b0:3bf:cf77:a861 with SMTP id e3-20020ac84e43000000b003bfcf77a861mr1053272qtw.4.1681427482732; Thu, 13 Apr 2023 16:11:22 -0700 (PDT) X-Received: by 2002:ac8:4e43:0:b0:3bf:cf77:a861 with SMTP id e3-20020ac84e43000000b003bfcf77a861mr1053215qtw.4.1681427482308; Thu, 13 Apr 2023 16:11:22 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id g3-20020ac81243000000b003ea1b97acfasm612446qtj.49.2023.04.13.16.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 16:11:21 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Axel Rasmussen <axelrasmussen@google.com>, Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@redhat.com>, peterx@redhat.com, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Andrea Arcangeli <aarcange@redhat.com> Subject: [PATCH 0/6] mm/hugetlb: More fixes around uffd-wp vs fork() / RO pins Date: Thu, 13 Apr 2023 19:11:14 -0400 Message-Id: <20230413231120.544685-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763104988420485273?= X-GMAIL-MSGID: =?utf-8?q?1763104988420485273?= |
Series |
mm/hugetlb: More fixes around uffd-wp vs fork() / RO pins
|
|
Message
Peter Xu
April 13, 2023, 11:11 p.m. UTC
This is a follow up of previous discussion here: https://lore.kernel.org/r/20230324222707.GA3046@monkey There, Mike correctly pointed out that uffd-wp bit can get lost too when Copy-On-Read triggers. Last time we didn't have a reproducer, I finally wrote a reproducer and attached as the last patch. When at it, I decided to also add some more uffd-wp tests against fork(), and I found more bugs. None of them were reported by anyone probably because none of us cares, but since they're still bugs and can be reproduced by the unit test I fixed them too in another patch. The initial patch 1-2 are fixes to bugs, copied stable. The rest patches 3-6 introduces unit tests to verify (based on the recent rework on uffd unit test). Note that not all the bugfixes in patch 1 is verified (e.g. on changes to hugetlb hwpoison / migration entries), but I assume they can be reviewed with careful eyes. Thanks, Peter Xu (6): mm/hugetlb: Fix uffd-wp during fork() mm/hugetlb: Fix uffd-wp bit lost when unsharing happens selftests/mm: Add a few options for uffd-unit-test selftests/mm: Extend and rename uffd pagemap test selftests/mm: Rename COW_EXTRA_LIBS to IOURING_EXTRA_LIBS selftests/mm: Add tests for RO pinning vs fork() mm/hugetlb.c | 33 +- tools/testing/selftests/mm/Makefile | 8 +- tools/testing/selftests/mm/check_config.sh | 4 +- tools/testing/selftests/mm/uffd-unit-tests.c | 318 +++++++++++++++++-- 4 files changed, 315 insertions(+), 48 deletions(-)