From patchwork Tue Dec 6 00:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13065255 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 0A74CC47089 for ; Tue, 6 Dec 2022 00:41:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DAAB8E0002; Mon, 5 Dec 2022 19:41:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 38A428E0001; Mon, 5 Dec 2022 19:41:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2538B8E0002; Mon, 5 Dec 2022 19:41:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 179388E0001 for ; Mon, 5 Dec 2022 19:41:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CF71C8082B for ; Tue, 6 Dec 2022 00:41:25 +0000 (UTC) X-FDA: 80210027730.10.5C5D742 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf10.hostedemail.com (Postfix) with ESMTP id 76CF3C0006 for ; Tue, 6 Dec 2022 00:41:25 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=m5t9TolE; spf=pass (imf10.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.169 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670287285; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=g1HJHevNxrj1Nq/NT7g6yR6y+nhBZjMl2neMxR4W590=; b=GI+pyeMHNmxcPlATmYzI3djRekHsmmRTSTGXWOz9lgjUrFxXbIszS+INAmyO5b/UT35SJ7 wmWVRoiqwSf7vNnQOoO6PyfIH7Qw33HvEHFe1Oq2oxgf3drvqhzCKPxK/tYbK3z24C4ra5 ZUiS4uz3i3SQSFXmJX1RGUy9tgN7Zt8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=m5t9TolE; spf=pass (imf10.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.169 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670287285; a=rsa-sha256; cv=none; b=Sviwl7cLnqu3/17BccLRXLFybw/RiSumzMkNL7DfCkK+OilpoWytuqjFpOvo39HlR0/Z8M MX+sRbJcRgtGzXHFF7idYDhtdKbd9+h0C6u/oDGqgK3ZpuvN958c/SUll0eb38KB73UGSJ ZkrS3Ouk/IAMgikXmjxhgxQBWlYRriw= Received: by mail-pf1-f169.google.com with SMTP id t18so2720681pfq.13 for ; Mon, 05 Dec 2022 16:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=g1HJHevNxrj1Nq/NT7g6yR6y+nhBZjMl2neMxR4W590=; b=m5t9TolEhunsnLAs8ghRCY5jduXJTUVrI828QMb9aaMDHIl9N52I0BcpPgXmJWJwHJ 8O/axD8BEanTUffxKBpeoT/71MR//Ncm3X2gdqz7aFSVJrBM1Wbfryc+Rv8pyLm6oklN hdck+j11IhNQpknHmA6Td97jo/v98RGjlHlkI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g1HJHevNxrj1Nq/NT7g6yR6y+nhBZjMl2neMxR4W590=; b=4+HVWErs3OU1V+PCVFI1KbpN+Irwu4kJD6L0jyfzy7nTiaHICuVYqfbAIprXspqkmX q0aIzxxUpaMFyfViBY5QyiupS4HwuEWEq1vPI1sA1O6Yw9kaN2hhrKYFzj2rHYtfNqJx E1rsEqsQgSeuR6QgA1NJL99ULjCimMvZojXGZEoXiW6PORnUr12cY9Zs7X4R07s9zj7x j076tXR8LAQPs8Ifa+Vp5kvzu+HZLxx7WVFOQybZ4fewNspzE5AkSbc8LbyRJ/MP6ewn H1NgbYSeTiPRjG+Z0f2c0wVj2zz4uOvfV+vSIOzrEUvOEkHWcujFRehvGnIoaxEk5dvG ZWWg== X-Gm-Message-State: ANoB5pnOTQtaaTQiy/2LhucOS1PEDT8cKHZb46M2n+HEs6EtQDRB6WjC ow9RLilszlGUNBPvXwq3kDQDzg== X-Google-Smtp-Source: AA0mqf7bocP7PDul7rRtHY2oLz5aO8HTy1YdBhNhRPTn1YaCEYjEKUj/QL8QuzpT2xX9GPdxtsjU/w== X-Received: by 2002:a63:1824:0:b0:46e:baf4:ab7a with SMTP id y36-20020a631824000000b0046ebaf4ab7amr79923468pgl.37.1670287284417; Mon, 05 Dec 2022 16:41:24 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b7-20020a170902650700b00186b549cdc2sm11187939plk.157.2022.12.05.16.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 16:41:24 -0800 (PST) Date: Mon, 5 Dec 2022 16:41:23 -0800 From: Kees Cook To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Alexander Viro , Alexey Dobriyan , Alexey Izbyshev , Andrei Vagin , Bernd Edlinger , Bo Liu , Christian Brauner , David Hildenbrand , Dmitry Safonov <0x7f454c46@gmail.com>, Eric Biederman , Florian Weimer , Kees Cook , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Liu Shixin , Li Zetao , Rolf Eike Beer , Wang Yufen Subject: [GIT PULL] execve updates for v6.2-rc1 Message-ID: <202212051637.93142F409@keescook> MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 76CF3C0006 X-Rspam-User: X-Stat-Signature: sbnxd8phioc9uhdenktsmi6peyz86god X-Spamd-Result: default: False [-2.40 / 9.00]; BAYES_HAM(-6.00)[99.99%]; SORBS_IRL_BL(3.00)[209.85.210.169:from]; MID_RHS_NOT_FQDN(0.50)[]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; DKIM_TRACE(0.00)[chromium.org:+]; DMARC_POLICY_ALLOW(0.00)[chromium.org,none]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; PREVIOUSLY_DELIVERED(0.00)[linux-mm@kvack.org]; R_DKIM_ALLOW(0.00)[chromium.org:s=google]; ARC_NA(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-HE-Tag: 1670287285-515730 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: Hi Linus, Please pull these execve updates for v6.2-rc1. Most are small refactorings and bug fixes, but three things stand out: switching timens (which got reverted before) looks solid now, FOLL_FORCE has been removed (no failures seen yet across several weeks in -next), and some whitespace cleanups (which are long overdue). The latter does end up conflicting with changes from Al[1], but should be trivial to resolve. Thanks! -Kees [1] https://lore.kernel.org/linux-next/20221128143704.3fe8f7b1@canb.auug.org.au/ The following changes since commit 9abf2313adc1ca1b6180c508c25f22f9395cc780: Linux 6.1-rc1 (2022-10-16 15:36:24 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git tags/execve-v6.2-rc1 for you to fetch changes up to 6a46bf558803dd2b959ca7435a5c143efe837217: binfmt_misc: fix shift-out-of-bounds in check_special_flags (2022-12-02 13:57:04 -0800) ---------------------------------------------------------------- execve updates for v6.2-rc1 - Add timens support (when switching mm). This version has survived in -next for the entire cycle (Andrei Vagin). - Various small bug fixes, refactoring, and readability improvements (Bernd Edlinger, Rolf Eike Beer, Bo Liu, Li Zetao Liu Shixin). - Remove FOLL_FORCE for stack setup (Kees Cook). - Whilespace cleanups (Rolf Eike Beer, Kees Cook). ---------------------------------------------------------------- Andrei Vagin (2): fs/exec: switch timens when a task gets a new mm selftests/timens: add a test for vfork+exit Bernd Edlinger (1): exec: Copy oldsighand->action under spin-lock Bo Liu (1): binfmt_elf: replace IS_ERR() with IS_ERR_VALUE() Kees Cook (3): exec: Add comments on check_unsafe_exec() fs counting binfmt: Fix whitespace issues exec: Remove FOLL_FORCE for stack setup Li Zetao (1): fs/binfmt_elf: Fix memory leak in load_elf_binary() Liu Shixin (1): binfmt_misc: fix shift-out-of-bounds in check_special_flags Rolf Eike Beer (4): ELF uapi: add spaces before '{' exec: simplify initial stack size expansion binfmt_elf: fix documented return value for load_elf_phdrs() binfmt_elf: simplify error handling in load_elf_phdrs() Wang Yufen (1): binfmt: Fix error return code in load_elf_fdpic_binary() fs/binfmt_elf.c | 35 +++---- fs/binfmt_elf_fdpic.c | 7 +- fs/binfmt_misc.c | 8 +- fs/exec.c | 38 +++++--- include/linux/nsproxy.h | 1 + include/uapi/linux/elf.h | 14 +-- kernel/fork.c | 9 -- kernel/nsproxy.c | 23 ++++- tools/testing/selftests/timens/.gitignore | 1 + tools/testing/selftests/timens/Makefile | 2 +- tools/testing/selftests/timens/vfork_exec.c | 139 ++++++++++++++++++++++++++++ 11 files changed, 219 insertions(+), 58 deletions(-) create mode 100644 tools/testing/selftests/timens/vfork_exec.c