[PATCH] tomoyo: Drop FOLL_FORCE from tomoyo_dump_page()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sat Nov 28 18:06:43 UTC 2026


> 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 at chrisdown.name>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/3c1a731469fb589685dd2168f7c8def736d806cf.1795863061.git.chris@chrisdown.name?part=1



More information about the Linux-security-module-archive mailing list