From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DE91C41604 for ; Tue, 6 Oct 2020 22:55:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA46320FC3 for ; Tue, 6 Oct 2020 22:55:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Yv99Iir3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA46320FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3C2866B0068; Tue, 6 Oct 2020 18:55:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 372646B006C; Tue, 6 Oct 2020 18:55:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21452900002; Tue, 6 Oct 2020 18:55:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id E90B16B0068 for ; Tue, 6 Oct 2020 18:55:00 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 832771EE6 for ; Tue, 6 Oct 2020 22:55:00 +0000 (UTC) X-FDA: 77343007560.12.stone60_530ac99271ca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 60484180150E2 for ; Tue, 6 Oct 2020 22:55:00 +0000 (UTC) X-HE-Tag: stone60_530ac99271ca X-Filterd-Recvd-Size: 5132 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 6 Oct 2020 22:54:59 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id h7so26001wre.4 for ; Tue, 06 Oct 2020 15:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q3EBwbT5ZqslEinIhfYEc6EohRkTeBanAs0p5SKagfA=; b=Yv99Iir3LR8sa5GHm0IDQWRqeZkE7PfTCFVlvAvR8KfAhOmoOIWH02RdRzE4V4v0gM rkCNjg9qr0N9PIZ1y59iPMiDy6GHxR39elcelR7vcKp6TgMV96Bk1yBBB7M22x7rZFDd qMpWFuiiZDssV4NihC3LPFSIlZE5pUZnAHdQ6HRdK8PHSMWjOcsnv1jLXlAInfA2ae+a 9dPV6Danf3KkVvaSgOmRnbB4SuMZl929wq+gynw/KSE2E5GMVGstEMP8D6iQd3B8W0j2 os2Sob0FDDOlRRebcTqNNbbkzXj6FfnDoKqXSNpwnebRmj1yIARezliPUh3tvkh5+HeW 8law== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q3EBwbT5ZqslEinIhfYEc6EohRkTeBanAs0p5SKagfA=; b=g69uA/fAZIew335s+IypEFWUPbEMxFdEFEKQ3pqIqLu9gjYbZ7+ejB2tmhCwef4wGj igWtW1QzX9wi49jaYCmVayYck1lJUiM+J1JLdJ+UJg5fdd80lerFxbu9KlWa974pEYiI 2y6CCfcyEY1Cm0f1CQpiNeERAWVIM1Gx7BCgs1ZC/3QjhNZufXuP7BaV2en1HThAUUOb bKj7/gYb9Apt3RIyd1EEj/ToQg7zm8MvPmhuZpQazJJ68G0JwNcO61Ia1RHbLmQF+UJC 1V+rRhAF6lZULfDN+lYDmCPlVS96N2q5u0SPYq96fWur0t0mUuNqVYGBy5czrOmW14dY NZsQ== X-Gm-Message-State: AOAM531rwWMkFIjUJQVCo5o82GmmvUPqnem3cc88pp7Ceub3zy7CR/RM jFfGFmeVHvnIwfjPRxvY3XeuCQ== X-Google-Smtp-Source: ABdhPJy+4v/kWsvqrk7kOklUz/nwg6c8o5g+mFSg90Kgg7sip06wAlk4NNCH2rrtA2c4Q96nB+dGaA== X-Received: by 2002:adf:e8d2:: with SMTP id k18mr201205wrn.73.1602024898548; Tue, 06 Oct 2020 15:54:58 -0700 (PDT) Received: from localhost ([2a02:168:96c5:1:55ed:514f:6ad7:5bcc]) by smtp.gmail.com with ESMTPSA id t124sm206819wmg.31.2020.10.06.15.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 15:54:57 -0700 (PDT) From: Jann Horn To: Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, "Eric W . Biederman" , Michel Lespinasse , Mauro Carvalho Chehab , Sakari Ailus , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um@lists.infradead.org, Jason Gunthorpe , John Hubbard Subject: [PATCH v2 0/2] Broad write-locking of nascent mm in execve Date: Wed, 7 Oct 2020 00:54:48 +0200 Message-Id: <20201006225450.751742-1-jannh@google.com> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: v2: - fix commit message of patch 1/2 and be more verbose about where the old mmap lock is taken (Michel, Jason) - resending without mangling the diffs :/ (Michel, Jason) These two patches replace "mmap locking API: don't check locking if the mm isn't live yet"[1], which is currently in the mmotm tree, and should be placed in the same spot where the old patch was. While I originally said that this would be an alternative patch (meaning that the existing patch would have worked just as well), the new patches actually address an additional issue that the old patch missed (bprm->vma is used after the switch to the new mm). I have boot-tested these patches on x64-64 (with lockdep) and !MMU arm (the latter with both FLAT and ELF). [1] https://lkml.kernel.org/r/CAG48ez03YJG9JU_6tGiMcaVjuTyRE_o4LEQ7901b5Z= oCnNAjcg@mail.gmail.com Jann Horn (2): mmap locking API: Order lock of nascent mm outside lock of live mm exec: Broadly lock nascent mm until setup_arg_pages() arch/um/include/asm/mmu_context.h | 3 +- fs/exec.c | 64 ++++++++++++++++--------------- include/linux/binfmts.h | 2 +- include/linux/mmap_lock.h | 23 ++++++++++- kernel/fork.c | 7 +--- 5 files changed, 59 insertions(+), 40 deletions(-) base-commit: fb0155a09b0224a7147cb07a4ce6034c8d29667f prerequisite-patch-id: 08f97130a51898a5f6efddeeb5b42638577398c7 prerequisite-patch-id: 577664d761cd23fe9031ffdb1d3c9ac313572c67 prerequisite-patch-id: dc29a39716aa8689f80ba2767803d9df3709beaa prerequisite-patch-id: 42b1b546d33391ead2753621f541bcc408af1769 prerequisite-patch-id: 2cbb839f57006f32e21f4229e099ae1bd782be24 prerequisite-patch-id: 1b4daf01cf61654a5ec54b5c3f7c7508be7244ee prerequisite-patch-id: f46cc8c99f1909fe2a65fbc3cf1f6bc57489a086 prerequisite-patch-id: 2b0caed97223241d5008898dde995d02fda544e4 prerequisite-patch-id: 6b7adcb54989e1ec3370f256ff2c35d19cf785aa --=20 2.28.0.806.g8561365e88-goog