Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp934461pxk; Thu, 1 Oct 2020 18:26:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbhLV3YytKLteiidCDhJx2FVTJBJMLGxVkOzwY9qo6Q+jJQ87f4QKHD6VZT3Zi/c0JJAjM X-Received: by 2002:a17:906:1909:: with SMTP id a9mr10703324eje.127.1601601981854; Thu, 01 Oct 2020 18:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601601981; cv=none; d=google.com; s=arc-20160816; b=VMHNOWPNCaig4ytCx+hq8ZHkT5TiI9DazwESVJn1mejuqxb/jThCkTIys30RCZNsx5 P1Mb9fha97vXgR4Lnob/R/KdqdVqAb41NOJjXwSsa6GEkZpmr+RTdMzVNNk2m8SNqyGj IJg2lQXP7EjBPnVKr/6BcRObk9pOYC5i7G6A4PnI+sVV8TsCZk1yl3uuVdRMo3gRLaME ovVcbjBYoIojHcdkUnfRODWGBkyFwK3RMb/onsslfv5GFcW5EQExLs9CrGbXoiddInl0 DMWlhOAdb6wtcmbnb00vGdImyBBrXfMplOjOv0sEx0TWKBMU2as3zYP4V6LSKqqmsdOn bW3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:mime-version:from :dkim-signature; bh=ZuhbLiKiM/JcAkw5V2qrfXh3m4GeTtm0DV+AllcZcTo=; b=ZHygQWMKfGw4W97J+42dFJCbhhI/1SaHiZo8R4MVurtsaaaaelPfeRsnRx3QAVf/gr w2Yeuv9KWnSWfVJgzY4kgEFEdaFGXD6vvPvhA+YuNd/METbGnOmbomarQtzVGchNg+yr tu0TsQguVvFx4Z/EGpuTgh4tOtR01oOaD++f67+Xq2f87PfLmSCHAq8zzsOPsMFECLde En8VY5cZxG58VEtitP/Ssti7XUmJ8RIsGEbGF+v6lbMf2OH6WWtCE8h2dHiQm5GJkXBH /lI0/ZDRJpCWVUzuaJQRZSFSsG9Foh0SZXWyJ6k2cQaz5Jv6t7PlQ3aK7jFv/gt3rekR bozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=phnG+o1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v27si5156330edi.305.2020.10.01.18.25.59; Thu, 01 Oct 2020 18:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=phnG+o1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387531AbgJBBYD (ORCPT + 99 others); Thu, 1 Oct 2020 21:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbgJBBYC (ORCPT ); Thu, 1 Oct 2020 21:24:02 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 702B5C0613D0 for ; Thu, 1 Oct 2020 18:24:00 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id md26so524438ejb.10 for ; Thu, 01 Oct 2020 18:24:00 -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=XbTsC2PJWuHPWziUPXeeOepwv6ttCSd1zc1azCCbkzDzBMqwDlqg8o/TZPZScrbRzm 6Wa1rrcnP1leX/Xe1sWoCETY0S3nhMRk1jb+g2qop9BD5duDHJZtNrmMtxoq9F6pjuki IaQg5gxKvdIVoorzpPT+46g0QvwmVdHOe6DaHid34mR0laQor3dI6dSONXOIqTuhP32G hf7A5lik3jEs4kGCeoxF+9VLbrIBDvJABGbQKvssy/E0slJoMv6HUXRfEdWhpI1eDx4l NmuUao3YuUwDJ1+ggC9SbXfP1k6R0Gkj4LE7An0bsM90ghLFvMQFTKNXMVmgPXPkxOKr 3LYQ== X-Gm-Message-State: AOAM5336utch7H+to0WejQ+Y8b1/UczFzHKYFFa0YJoG+VhiFyflLf79 bCY2Gsda4Q5CR8qbjAoUQEYM5JllSFnhj97zcAZiyQ== 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 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.28.0.806.g8561365e88-goog