linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/exec: Test patch for syzkaller crash
@ 2022-08-12  0:09 ira.weiny
  2022-08-12 18:45 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: ira.weiny @ 2022-08-12  0:09 UTC (permalink / raw)
  To: Kees Cook
  Cc: Ira Weiny, syzbot+3250d9c8925ef29e975f, Fabio M. De Francesco,
	ebiederm, viro, sfr, syzkaller-bugs, linux-mm, linux-fsdevel,
	linux-kernel

From: Ira Weiny <ira.weiny@intel.com>

Kees reported that it looked like the kmap_local_page() conversion in
fs/exec.c was causing a crash with the syzkaller.[1]

At first glance it appeared this was due to the lack of pagefaults not
being disabled as was done by kmap_atomic().

Unfortunately, after deeper investigation we don't see how this is a
problem.  The crash does not appear to be happening in the
memcpy_to_page() call.[2]

For testing, add back pagefault disable in copy_string_kernel() to see
if it makes syzkaller happy.  If so more investigation will need to be
done to understand exactly what is happening.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6e8e36c6ae4b11bed5643317afb66b6c3cadba8
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/fs/exec.c?id=40d43a7507e1547dd45cb02af2e40d897c591870#n616

Cc: Kees Cook <keescook@chromium.org>
Reported-by: syzbot+3250d9c8925ef29e975f@syzkaller.appspotmail.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 fs/exec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/exec.c b/fs/exec.c
index b51dd14e7388..e076b228123a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -640,7 +640,9 @@ int copy_string_kernel(const char *arg, struct linux_binprm *bprm)
 		if (!page)
 			return -E2BIG;
 		flush_arg_page(bprm, pos & PAGE_MASK, page);
+		pagefault_disable();
 		memcpy_to_page(page, offset_in_page(pos), arg, bytes_to_copy);
+		pagefault_enable();
 		put_arg_page(page);
 	}
 
-- 
2.35.3


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

end of thread, other threads:[~2022-08-12 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  0:09 [PATCH] fs/exec: Test patch for syzkaller crash ira.weiny
2022-08-12 18:45 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).