mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Down <chris@chrisdown.name>
To: Kentaro Takeda <takedakn@nttdata.co.jp>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	tomoyo-users_en@lists.sourceforge.net,
	tomoyo-users_ja@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH] tomoyo: Drop FOLL_FORCE from tomoyo_dump_page()
Date: Sat, 28 Nov 2026 10:04:15 -0800	[thread overview]
Message-ID: <3c1a731469fb589685dd2168f7c8def736d806cf.1795863061.git.chris@chrisdown.name> (raw)

tomoyo_dump_page() reads the argv and envp pages of the nascent exec mm
with get_user_pages_remote(..., FOLL_FORCE, ...). Its own comment says it
does the same thing as get_arg_page(bprm, pos, 0) in fs/exec.c, but
get_arg_page() stopped passing FOLL_FORCE in
commit cd57e443831d ("exec: Remove FOLL_FORCE for stack setup"), so the
two have drifted apart.

FOLL_FORCE only matters here if the page sits in a VMA that is not
readable. That can't happen: tomoyo_dump_page() is called from the
bprm_check_security hook, which runs before the binfmt handler calls
setup_arg_pages(), and at that point the only VMA in bprm->mm is the
stack VMA created by create_init_stack_vma() with VMA_STACK_FLAGS. Those
are built from the architecture's VMA_STACK_DEFAULT_FLAGS, which falls
back to VMA_DATA_DEFAULT_FLAGS. Every definition of either in the tree
is built from VMA_DATA_FLAGS_EXEC, VMA_DATA_FLAGS_TSK_EXEC or
VMA_DATA_FLAGS_NON_EXEC, and all three include VMA_READ_BIT and
VMA_MAYREAD_BIT. Reading without FOLL_FORCE therefore works for every
page tomoyo_dump_page() can be asked for.

FOLL_FORCE is being removed from callers that are not really ptrace so
that it can eventually be renamed to FOLL_PTRACE. Let's drop it here
too, which also brings the code back in line with its comment.

No functional change is intended.

Signed-off-by: Chris Down <chris@chrisdown.name>
---
 security/tomoyo/domain.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c
index eeaad421f15b..444e884722ee 100644
--- a/security/tomoyo/domain.c
+++ b/security/tomoyo/domain.c
@@ -925,8 +925,7 @@ bool tomoyo_dump_page(struct linux_binprm *bprm, unsigned long pos,
 	 * (represented by bprm).
 	 */
 	mmap_read_lock(bprm->mm);
-	ret = get_user_pages_remote(bprm->mm, pos, 1,
-				    FOLL_FORCE, &page, NULL);
+	ret = get_user_pages_remote(bprm->mm, pos, 1, 0, &page, NULL);
 	mmap_read_unlock(bprm->mm);
 	if (ret <= 0)
 		return false;

base-commit: 7cd8495c0f16275c4f9abe1cef09a7b5fcd6d046
-- 
2.56.1


                 reply	other threads:[~2026-11-28 18:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c1a731469fb589685dd2168f7c8def736d806cf.1795863061.git.chris@chrisdown.name \
    --to=chris@chrisdown.name \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=serge@hallyn.com \
    --cc=takedakn@nttdata.co.jp \
    --cc=tomoyo-users_en@lists.sourceforge.net \
    --cc=tomoyo-users_ja@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®