From patchwork Fri Oct 2 01:23:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 1375514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=hhLZaPJ6; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=phnG+o1k; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C2XMZ5hTtz9ryj for ; Fri, 2 Oct 2020 11:24:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:MIME-Version:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=gN1DOy2D+Lm7gBq1qPoBkpHNR2COqVF9SloJ/t/1Bn4=; b=hhLZaPJ6cokzZBl98ffiI5RumL RKCExlgFnedkwr0UQp2/OdgEjG5whW+WWDd+mC6Vsne9TZdOtY7IeOcPlSSYqVGzPMUKQs9r+/D4V UJRW7hcyXq7xuFYbNihzjIsRrvhDSZ+ma03Fm941bHW4fbznNdX6VwF9AMun0A6Ff70Qma5b2ARXf iDyOKBik9cUtB9aUYNqncorX96DwNluu7NbTbifJ+UoA7QGTMHIj5rqINCGpL2b2tcVPz7iM8J+i6 +DQZq2FslYCRe64OPa4wOkxPCmFsoWuKvkp9oqxyCgIUiUNNqgEXix6BMmWjSCBzWTZlWJte4xg4B /e3eDrEA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kO9np-0000nc-8o; Fri, 02 Oct 2020 01:24:05 +0000 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kO9nm-0000mP-H3 for linux-um@lists.infradead.org; Fri, 02 Oct 2020 01:24:03 +0000 Received: by mail-ej1-x643.google.com with SMTP id a3so519826ejy.11 for ; Thu, 01 Oct 2020 18:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:mime-version:date:message-id:subject:to:cc; bh=ZuhbLiKiM/JcAkw5V2qrfXh3m4GeTtm0DV+AllcZcTo=; b=phnG+o1kyRsRwF9i0GexiGaNbZOP24P5O4ULQ5ExpA//VqilVb567sh0HefGxeA8xg nMG3wUlLYwDwz4ju0m6VjavsnNxCh5MJxDO+LJyeqWjOILRr8M1KBstrnZUQ1H7jEgaG V7tVvRw8Fx6gNANGF4V4dkqKva+5oIleHhh3HEfSVIeDZjy9uS09Ntv7j0ce+RhBTF1Q uNwPxns7ceb7L4mDxU8VbGuG7YWdhfiiSKigxqQF5GocQsOaAujd0SYo9X38CLWdA9V6 2OGNFwDeurCJMAYhq9WaWDC678AEwJyWPQELa8jAOn4Wl6+AxVScu4594E9io4FCn4g1 4itA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:date:message-id:subject:to:cc; bh=ZuhbLiKiM/JcAkw5V2qrfXh3m4GeTtm0DV+AllcZcTo=; b=gtWSpqgu8hI52gc3Z9f/kltbSTdQtc7Fhsvo/3Ux5zV94xyq1qScKP5eMJ2UjEXTnN v+iYhsiwVEyTKdIak5mMBhkFSI8LkBcPaFjzrrbAYk40ptVvHe9SARBxEq3qUFl+LTtj QtDz0xjcOUP1aywhg/mFa6Lv67OzlteavfuSkMvIcGq1xEk4KijbuOs2qwM/s/yk2uWX b0qA/i28eABma1IPTIADEJjtToCvnoyWaN9UxBxTEzLBi8SLnI8uorvpJ6f0FvSLdL6j qlp5emKd59d9wCC18W4fybyu9fmmJD1ji+t9gkZOWH7nkTNuPA8OrD2qNpuKPq5ydJns FfVQ== X-Gm-Message-State: AOAM532vlKUDD7rd1dcD3cvVwE06FtCqOF4eYK6NacyFW6IuU0h66xmM +KSTyvXyCr1R3C6cj3oeyDTh3fCAJT97zxwrQFFSaw== X-Google-Smtp-Source: ABdhPJw5ERWukkY+5ZDguQiFbaiYeqNOoiZ2ZEg/InHvYl6Vbjj5rB8NrevRCvjERC75sEP74nGnWjbbHtYkIX1mGeo= X-Received: by 2002:a17:906:33c8:: with SMTP id w8mr6469076eja.233.1601601838935; Thu, 01 Oct 2020 18:23:58 -0700 (PDT) Received: from 913411032810 named unknown by gmailapi.google.com with HTTPREST; Thu, 1 Oct 2020 21:23:58 -0400 From: Jann Horn X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog MIME-Version: 1.0 Date: Thu, 1 Oct 2020 21:23:58 -0400 Message-ID: Subject: [PATCH 0/2] Broad write-locking of nascent mm in execve To: Andrew Morton , linux-mm@kvack.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201001_212402_581214_BA997261 X-CRM114-Status: UNSURE ( 8.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -15.7 (---------------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-15.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michel Lespinasse , Jason Gunthorpe , Richard Weinberger , Jeff Dike , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, "Eric W . Biederman" , Sakari Ailus , John Hubbard , Mauro Carvalho Chehab , Anton Ivanov Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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_o4LEQ7901b5ZoCnNAjcg@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