commit:     b461d2fb4478a277ea5b531efba262d22b60e15d
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 12:40:43 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri May 27 12:40:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b461d2fb

exec: increase BINPRM_BUF_SIZE to 256

https://bugs.gentoo.org/847655

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README                                   |  4 +++
 1900_fs-increase-BINPRM-BUF-SIZE-to-256.patch | 51 +++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/0000_README b/0000_README
index 3ad05b69..81ae8c32 100644
--- a/0000_README
+++ b/0000_README
@@ -1323,6 +1323,10 @@ Patch:  1701_ia64_fix_ptrace.patch
 From:   https://patchwork.kernel.org/patch/10198159/
 Desc:   ia64: fix ptrace(PTRACE_GETREGS) (unbreaks strace, gdb).
 
+Patch:  1900_fs-increase-BINPRM-BUF-SIZE-to-256.patch
+From:   
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/exec.c?id=6eb3c3d0a52dca337e327ae8868ca1f44a712e02
+Desc:   exec: increase BINPRM_BUF_SIZE to 256
+
 Patch:  2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
 From:   
https://lore.kernel.org/linux-bluetooth/[email protected]/raw
 Desc:   Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. 
See bug #686758

diff --git a/1900_fs-increase-BINPRM-BUF-SIZE-to-256.patch 
b/1900_fs-increase-BINPRM-BUF-SIZE-to-256.patch
new file mode 100644
index 00000000..2be01c77
--- /dev/null
+++ b/1900_fs-increase-BINPRM-BUF-SIZE-to-256.patch
@@ -0,0 +1,51 @@
+From 6eb3c3d0a52dca337e327ae8868ca1f44a712e02 Mon Sep 17 00:00:00 2001
+From: Oleg Nesterov <[email protected]>
+Date: Thu, 7 Mar 2019 16:29:26 -0800
+Subject: [PATCH] exec: increase BINPRM_BUF_SIZE to 256
+
+Large enterprise clients often run applications out of networked file
+systems where the IT mandated layout of project volumes can end up
+leading to paths that are longer than 128 characters.  Bumping this up
+to the next order of two solves this problem in all but the most
+egregious case while still fitting into a 512b slab.
+
+[[email protected]: update comment, per Kees]
+Link: http://lkml.kernel.org/r/[email protected]
+Signed-off-by: Oleg Nesterov <[email protected]>
+Reported-by: Ben Woodard <[email protected]>
+Reviewed-by: Andrew Morton <[email protected]>
+Acked-by: Michal Hocko <[email protected]>
+Acked-by: Kees Cook <[email protected]>
+Cc: "Eric W. Biederman" <[email protected]>
+Signed-off-by: Andrew Morton <[email protected]>
+Signed-off-by: Linus Torvalds <[email protected]>
+---
+ fs/exec.c                    | 2 +-
+ include/uapi/linux/binfmts.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/exec.c b/fs/exec.c
+index bf0ace3841ad6e..2e0033348d8e10 100644
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -1563,7 +1563,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
+ 
+ /*
+  * Fill the binprm structure from the inode.
+- * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
++ * Check permissions, then read the first BINPRM_BUF_SIZE bytes
+  *
+  * This may be called multiple times for binary chains (scripts for example).
+  */
+diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
+index 4abad03a885305..689025d9c185b0 100644
+--- a/include/uapi/linux/binfmts.h
++++ b/include/uapi/linux/binfmts.h
+@@ -16,6 +16,6 @@ struct pt_regs;
+ #define MAX_ARG_STRINGS 0x7FFFFFFF
+ 
+ /* sizeof(linux_binprm->buf) */
+-#define BINPRM_BUF_SIZE 128
++#define BINPRM_BUF_SIZE 256
+ 
+ #endif /* _UAPI_LINUX_BINFMTS_H */

Reply via email to