From patchwork Tue Aug 15 21:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 13354339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95DEFC0015E for ; Tue, 15 Aug 2023 21:22:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED53F8D0016; Tue, 15 Aug 2023 17:22:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E84488D0001; Tue, 15 Aug 2023 17:22:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D73A68D0016; Tue, 15 Aug 2023 17:22:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C72958D0001 for ; Tue, 15 Aug 2023 17:22:30 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9005EC0D7E for ; Tue, 15 Aug 2023 21:22:30 +0000 (UTC) X-FDA: 81127612860.05.F46257E Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by imf30.hostedemail.com (Postfix) with ESMTP id CD60D8000D for ; Tue, 15 Aug 2023 21:22:28 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="FTeL/vZo"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of jannh@google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=jannh@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692134548; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=bSOhYSRQ4h4iPkpgTIXcKtQre6JjCPrc8K1miC6Gxzg=; b=lMJFzBbZqGbHyf3kSWxLsADDRatQ7xnoIP+XFm5xAZqJwqPU9X7qdyGdg+wM7DPrfS51+H P7/72p665g9INqJNKIW4NBK3LucaMvFZQtAs1Y5fKJidR/nydh2XK2avjD/ZXMVpnlny8R Cuqw741qJ9KrSUnoqaCatSD+NJrmFtk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="FTeL/vZo"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of jannh@google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=jannh@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692134548; a=rsa-sha256; cv=none; b=tejQHDc5Z9BtYKKzMvy4wDkLXYWIjj1O8H89ROZAW7PKR72msSnyyTG76U2wVZ14Mv29dg WNnH44/ZgMrnh0TktjV5f/KriThaRwlhWsm/DK7Ub0eSmL/1T3DRLKJFTmw6uWKeZueKED gAnaw9UJeCxl9zFK4zAKIuHbR+B1Piw= Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-3fe2d620d17so30785e9.0 for ; Tue, 15 Aug 2023 14:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692134547; x=1692739347; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bSOhYSRQ4h4iPkpgTIXcKtQre6JjCPrc8K1miC6Gxzg=; b=FTeL/vZoeGRFdukGCRZdl7f8rxJWNdjp1O+cwOt0donlOeTqZilCzFZ21H40oxvyoZ y0pPeZQ8EFJouEeCEQBG4hzc8C7dn09cHWuR3fRddcDYZ4nMiSbK6bAtqYDZSEZJizjG 0pUxdgb+qoT6GdzOr5Oon3nWzrMnJ0/RGRG6YbzPN5vIHdTy379DGn3i3IPOWoUAsev3 F22AI/j5e4nK8tjMpOGbPXPG2kCVMmIsaPoekbE6LEkrGQ1DrTbBOUkBg79lYXUegZjl ee3BGSC3y8777Zg2wSYSvoFGHRxWKY7UCEygAlnruk73BcYKhjF8ue1dWXGYrt2B9uOz hVkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692134547; x=1692739347; 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=bSOhYSRQ4h4iPkpgTIXcKtQre6JjCPrc8K1miC6Gxzg=; b=Y4sn+OS8tgmJHrmnMfsffXCGVYNuxxb97gP3Ze3yVM5QZhyMV5fgXabbmR3tPxDGO6 68b+R+FETufgsiuvMcbvL8FgsQdR43+FhaldYzXrMUjNNzXqAIWu9LgeWoK8i9PoBne8 z8VD4U5hahYObrCzYVDDYiXinWOL+Q78xXUDCdlTRLdxkJbwDyPfYOxB0/8bPScyssU/ 1L87znlYsxsx0c+SXY24B1j6lgXhMiLTslCRNvPyMDPmz/KfbXSHf7l1GsHQVWpV1wYV A+xI1ncU8aDG/36r2uMWGlatsccylHS97Lsb2IwYZLv8R4oDE5ELjznvAh/yE+qNd6BV EwWA== X-Gm-Message-State: AOJu0Yw6wIz3vTB7OIB60JgScEIgb8eZMgQSrfqW09FyXfuMsOmb/GC4 plEsgzozfwwN9HfOW14vIvYVNA== X-Google-Smtp-Source: AGHT+IETS12k29aHBpXnNMvbvGSEb4h9NDHK0rRj1j9kK65gpZbL82l3IBd2HTrxSIlAtqpM5A98lQ== X-Received: by 2002:a05:600c:314a:b0:3f4:fb7:48d4 with SMTP id h10-20020a05600c314a00b003f40fb748d4mr13947wmo.3.1692134547102; Tue, 15 Aug 2023 14:22:27 -0700 (PDT) Received: from localhost ([2a00:79e0:9d:4:63c2:1adf:83f0:89cc]) by smtp.gmail.com with ESMTPSA id m22-20020a7bcb96000000b003fe2696ccfcsm18968134wmi.23.2023.08.15.14.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 14:22:26 -0700 (PDT) From: Jann Horn To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: userfaultfd: remove stale comment about core dump locking Date: Tue, 15 Aug 2023 23:22:16 +0200 Message-ID: <20230815212216.264445-1-jannh@google.com> X-Mailer: git-send-email 2.41.0.694.ge786442a9b-goog MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CD60D8000D X-Stat-Signature: 3dny18rfmzef6p6maw9m7ad3as6aid14 X-HE-Tag: 1692134548-232548 X-HE-Meta: U2FsdGVkX198tDrRpYQfM/j0E/OzAZoxcOpNpxuoSexc23lH+8Y/YGX6oJ7jX4aA30cbK2KjuRST3NeM+ockVBr8aaLQPkFEhiqOCh4Aj2wVDJxF6icW8XzXu99zqwDVYPFqAGRptJYGrBAhPPfdQrY+3A5bKb9hWTqCxaqQPzJf0tt6RsCimmhYeU6ddTX/rm4K4eeEP8x4OqQTLy+TX9Sjl5O4VdenU77ZDg0bk5DZzPus46RHoqCyUWMeIC/qMWKQMqECHgHJH+CmjHKURdMnt7ba80rOdAj64khOwPyz9Z/QI2BZOnF+JyqJ1Ot4Kt+a9NDWsxttaP1ZzqcR00D8mF1T9h3AOZLYx7M/xIrpAAXi8TF7r0jPLShY39EUXY/78R3u0/rMGHOz7f8t25ggWe7dtH/9oV5tGgbai/pigmioLCkc0HD10ywgAkwQwvi0tQHvYG4UBpuRdNH02oes/W2QrZiqEi5fVgyeSbA8WoWzF/VdP6Hoe9XGhfMsmDf3fUYJ41n6ohwEwuThKiP/is5oJRSWvD0RNkTFn/azBTz1AtabBsO0YJdf08tPOLY/Go63P6gI/OgKr4Zud8SLI/UGJwaJYsZD0ZO8DflhAqOROgzcRr9Zuool9LBaYXfHFUNXw+rAc8kOa/JvKGOU1fx3T4EFSiNkt2wIbOuFT4peyAZwb4Kh0voPelKjUNuUGO6mDLSvcaFRc5NW+1bre8gSnDrJdRNH1VVY9L7g54/XyOqz4taC3SDdLysHlvPoozUkK6YMARuV4SIp4ZJfubNaJ/WRz8y4K2np61dqqba7aBJKfu+JAQy50FVd00KIT86k7/44+vZpy23u+Fmq+JocKwE94fOQgZP++1o+UBBS8Xg1cgZfCGeN3JQ2VSWSQDNdtsfcCPMWfPl1MRQICymDa08O8e2tqwbWTqmZk8gXJmfZvqJNA9/o3KXmzQiKx63MN2XsQtW+CUY abjbU5mb U2Q+K4flk3KZ88glO5kt8fznX7fCrk3Lm8DsF+s6Tg71Vc8hAosU/SqHER+DRmOAykG9mGsv5usmkfd2qDS2SJ2zSaWvKafgXtWVq3GoYt8hQUtLX3zpcLkPju1N0Ppwta1qLnJqrMerpmWPXDhX4tF32Te/c2H6iqHQIGtucX/ZpXsfdW7Gdh/iwh/MVmOGaP74+uD2UqhwIXSrq02R5t4XS0S/Ux+9vgfifZbiFrkPIc++Nfry0xitfK42EMHgV6tT9ohb6v+Ccgz3WFbROKEWa9q9uPhm1TvIBrRtKfnFl/+SPu3QFrwgtI/39R7edvPZpwiMlEayA55STFbeKsaebQGzh4sAPneb6NbCH5xXCprjxk0wsRDN3Pw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since commit 7f3bfab52cab ("mm/gup: take mmap_lock in get_dump_page()"), which landed in v5.10, core dumping doesn't enter fault handling without holding the mmap_lock anymore. Remove the stale parts of the comments, but leave the behavior as-is - letting core dumping block on userfault handling would be a bad idea and could lead to deadlocks if the dumping process was handling its own userfaults. Signed-off-by: Jann Horn --- fs/userfaultfd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) base-commit: f8a7ed854c1a66b1984a64baf0ece09e44552fab diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 1091cb461747..56eaae9dac1a 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -428,15 +428,11 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) * FOLL_DUMP case, anon memory also checks for FOLL_DUMP with * the no_page_table() helper in follow_page_mask(), but the * shmem_vm_ops->fault method is invoked even during - * coredumping without mmap_lock and it ends up here. + * coredumping and it ends up here. */ if (current->flags & (PF_EXITING|PF_DUMPCORE)) goto out; - /* - * Coredumping runs without mmap_lock so we can only check that - * the mmap_lock is held, if PF_DUMPCORE was not set. - */ assert_fault_locked(vmf); ctx = vma->vm_userfaultfd_ctx.ctx;