From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A0ED606A324 for ; Sun, 6 Dec 2026 10:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=al4tLcls Received: by kanga.kvack.org (Postfix) id 257B46B00EF; Sun, 6 Dec 2026 05:56:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 208076B05B1; Sun, 6 Dec 2026 05:56:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F7756B05B2; Sun, 6 Dec 2026 05:56:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E4DE36B00EF for ; Sun, 6 Dec 2026 05:56:34 -0500 (EST) Received: from smtpin11.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 69D55160605 for ; Sun, 6 Dec 2026 10:56:34 +0000 (UTC) X-FDA: 85513254708.11.EE8C718 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf29.hostedemail.com (Postfix) with ESMTP id BC60212000A for ; Sun, 6 Dec 2026 10:56:32 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=al4tLcls; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796554592; b=Cnlmbl1J6QiCWxVYkkKnLMiSgUm/5Ep812T2O0bFCT+zZXJl1wEMNTBee+cNppQWKjsuZu /y2BM/WIvrKtVhR9XUY4J4DlcfD5i7jdm++Korg3L1sf6wzMQD0kFnJ2kOgs0SOssNV/eF dMxFxDULsPxhF007NtzCf4/jLhOQpQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796554592; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9WAGZXVauWFl/twWey1tsEL236HBjbQtLlcQyzGYeiI=; b=2ZviVlV2gLoS6I1ca4UIqIYzMNKppIiYcaSQtvFzApbhAHJX/4OTjdBHeHFoyLYe1tIMha 1OYnODom7bzS58Q+rOxYmsyEESxuXuBffwQbPGFLbOx0vkIicKgL64Zg0IsUwG5B9fqEkI 8i2bYoq4ARyHGfzRNw4i3FSva3afwZI= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=al4tLcls; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5767B60172; Sun, 6 Dec 2026 10:56:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC451F0092B; Sun, 6 Dec 2026 10:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796554591; bh=9WAGZXVauWFl/twWey1tsEL236HBjbQtLlcQyzGYeiI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=al4tLclsI7T7mFfLzgUlVRfbbVJ/ZnlbHN/NmuVSfCqhM2/fNyW+SsePcwS08rNJk 4hnJ+HN9WxaC0x+egZPJCNyNrLPIiPQkq2sNFmrjk2luHjTHR3aODSq/25ah/Pu1Yq UNlwedFDR52FoSba/fFO6h8PTlP3cGxj82BEBMoa9EW34lxrBygGoYSVtDQrvrJHEB SBA96YElmIvIip2qIe68p4v2r3qwXSF5SaPWhH1HXyxkwTyLU2MDEJQXm5B0yW+trR xSwZjKdINDGX9zZWwTmdeYeoGBIQTAJLNiZ0F9AV48gE3XssjIt2Cl5RvaxYQiE7HW nkUjl8kkz9/kA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] exec: don't honor PT_GNU_STACK PF_X under MDWE Reply-To: sashiko-reviews@lists.linux.dev To: "Hang Zhengyang" , "Andrew Morton" , "Kees Cook" Cc: "Lorenzo Stoakes" , "Chris Mason" , "Catalin Marinas" , "Joey Gouly" , "Christian Brauner" , "Alexander Viro" , "Jan Kara" , "David Hildenbrand" , "Liam R. Howlett" , "Vlastimil Babka" , "Mike Rapoport" , "Michal Hocko" , "Suren Baghdasaryan" , "Shuah Khan" , "Gregory Price" , "Jann Horn" , "Pedro Falcato" , "Florent Revest" , linux-mm@kvack.org In-Reply-To: <20261205105547.1251214-2-hang.zhengyang1010@gmail.com> References: <20261205105547.1251214-1-hang.zhengyang1010@gmail.com> <20261205105547.1251214-2-hang.zhengyang1010@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 10:56:29 +0000 X-Stat-Signature: dou57pgqc9ak336ffi863jrbzrkonhxp X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BC60212000A X-HE-Tag: 1796554592-643831 X-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2StKk7koLhiKr7WCqLh/PlZ8y9K+wfcOhlA37Lfw686ta8gqIpVAtRZ1FLs84EV5ktwyFL9zsDHXah/qit/u1mzUVvtOHmNVSZ7mizvuDQa4BDEKX/DgMED/qntuPL/TFq4qwUHBroj9UXQujsvyEo+P+/PEPjqKtNo85/2JS0B/oo9CHGC0aZQSBxmSlubooatgYZaWPj3EM97PTcxPxb74nzdlaHoo5pX9diHf49l0EmAMXHSfiE4qrUZCgSscLuzTAjV4y2ROlMSk9MlfgLqCgfnZDP/yg487U9IK/Yte0x2jDRJtTxd4tvibAHJriY2y/QZgN+fkc+8hePKZsbO7x6li2HKZlugOWqWZBKpfjTI6yttEy7xOBYzmhBKDCGI2EsS0/qvxSlaaAxLjjYuTZqNSq1SNkzH9EyT5UmixpGjDsKW5BNT3Brr6DV/2BxNS4qfPa0ztcWn7C6XXW8RWSyFTy1qfK0+jkNinP/LO2zbgVtgW5jjH4pXJspPyQ3cJQfPSUngOmZbntSaKG3nRFjRl1JHvIG9EPENlVcja2Cpd2gTSfod/LW6uGy45STgoCRroidEMnUVTj33GEL5tVkbHNsrLvceqPLLLdNPNBHoSsXO+CYw+UlvIJyC2uCHnHP37IAA0/WPgk2sTVKmWI0VbeqnCjOB2edoY9ks6SPCTgmDfVwWkGfYxjXTMPwY/BQoW1w6mXVq+r+Ffmb/cClOla2hnmkRAOlTHPHRcD8JGxals4Hjli1X1daq/A8KenrHkFUK++GIHHFwHW0C70iV+WXmTRjHMHunCdeVNBZ5n859wUdprQCBIaUZS7WKGCKcai9XeK6t2v6v5ZOqcjd0tQPwAmhDmhZAXckGA== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] exec: setup_arg_pages() misses EXSTACK_DEFAULT under MDWE -- commit 719d5e410364817edd0df97f72ec8de427ec4b30 Author: Hang Zhengyang exec: don't honor PT_GNU_STACK PF_X under MDWE This commit clears VM_EXEC on the stack VMA and logs a one-time warning in setup_arg_pages() when EXSTACK_ENABLE_X is requested under MDWE. > diff --git a/fs/exec.c b/fs/exec.c > index 8d2b14e1d455c..d23f87301abf9 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -660,12 +660,21 @@ int setup_arg_pages(struct linux_binprm *bprm, > /* > * Adjust stack execute permissions; explicitly enable for > * EXSTACK_ENABLE_X, disable for EXSTACK_DISABLE_X and leave alone > - * (arch default) otherwise. > + * (arch default) otherwise. MDWE refuses writable and executable > + * memory, so under MDWE treat EXSTACK_ENABLE_X as EXSTACK_DISABLE_X. > + * The marking can be an accident, so don't fail the exec. > */ > - if (unlikely(executable_stack =3D=3D EXSTACK_ENABLE_X)) > - vm_flags |=3D VM_EXEC; > - else if (executable_stack =3D=3D EXSTACK_DISABLE_X) > + if (unlikely(executable_stack =3D=3D EXSTACK_ENABLE_X)) { > + if (mm_flags_test(MMF_HAS_MDWE, mm)) { > + pr_warn_once("process '%pD4' asked for an executable stack, not grant= ed under MDWE\n", > + bprm->file); > + vm_flags &=3D ~VM_EXEC; > + } else { > + vm_flags |=3D VM_EXEC; > + } > + } else if (executable_stack =3D=3D EXSTACK_DISABLE_X) { > vm_flags &=3D ~VM_EXEC; > + } [Severity: Medium] Does this miss EXSTACK_DEFAULT when VM_STACK_FLAGS already includes VM_EXEC? For an ELF binary lacking PT_GNU_STACK on x86_32 or IA32 compat, load_elf_binary() sets READ_IMPLIES_EXEC and passes EXSTACK_DEFAULT to setup_arg_pages(). Since the MMF_HAS_MDWE check only runs for EXSTACK_ENABLE_X, the process still gets a writable and executable stack. Checking for (vm_flags & VM_EXEC) under MMF_HAS_MDWE after the EXSTACK_ENABLE_X / EXSTACK_DISABLE_X branches would cover both cases, similar to do_brk_flags(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205105547.1251= 214-1-hang.zhengyang1010@gmail.com?part=3D1