linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exec: Remove FOLL_FORCE for stack setup
@ 2022-11-18  0:34 Kees Cook
  2022-11-18  8:57 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2022-11-18  0:34 UTC (permalink / raw)
  To: Eric Biederman
  Cc: Kees Cook, David Hildenbrand, Linus Torvalds, Alexander Viro,
	linux-fsdevel, linux-mm, linux-kernel, linux-hardening

It does not appear that FOLL_FORCE should be needed for setting up the
stack pages. They are allocated using the nascent brpm->vma, which was
newly created with VM_STACK_FLAGS, which an arch can override, but they
all appear to include VM_WRITE | VM_MAYWRITE. Remove FOLL_FORCE.

Cc: Eric Biederman <ebiederm@xmission.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org
Link: https://lore.kernel.org/lkml/202211171439.CDE720EAD@keescook/
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 fs/exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exec.c b/fs/exec.c
index 9585bc1bc970..870a707b5d3b 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -200,7 +200,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
 {
 	struct page *page;
 	int ret;
-	unsigned int gup_flags = FOLL_FORCE;
+	unsigned int gup_flags = 0;
 
 #ifdef CONFIG_STACK_GROWSUP
 	if (write) {
-- 
2.34.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] exec: Remove FOLL_FORCE for stack setup
  2022-11-18  0:34 [PATCH] exec: Remove FOLL_FORCE for stack setup Kees Cook
@ 2022-11-18  8:57 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2022-11-18  8:57 UTC (permalink / raw)
  To: Kees Cook, Eric Biederman
  Cc: Linus Torvalds, Alexander Viro, linux-fsdevel, linux-mm,
	linux-kernel, linux-hardening

On 18.11.22 01:34, Kees Cook wrote:
> It does not appear that FOLL_FORCE should be needed for setting up the
> stack pages. They are allocated using the nascent brpm->vma, which was
> newly created with VM_STACK_FLAGS, which an arch can override, but they
> all appear to include VM_WRITE | VM_MAYWRITE. Remove FOLL_FORCE.
> 
> Cc: Eric Biederman <ebiederm@xmission.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: linux-fsdevel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Link: https://lore.kernel.org/lkml/202211171439.CDE720EAD@keescook/
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks for looking into this!

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-18  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  0:34 [PATCH] exec: Remove FOLL_FORCE for stack setup Kees Cook
2022-11-18  8:57 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox