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

exec: increase BINPRM_BUF_SIZE to 256

Bug: 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 ae4affb3..3e951bdc 100644
--- a/0000_README
+++ b/0000_README
@@ -1183,6 +1183,10 @@ Patch:  1700_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/20190522070540.48895-1-mar...@holtmann.org/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 <o...@redhat.com>
+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.
+
+[o...@redhat.com: update comment, per Kees]
+Link: http://lkml.kernel.org/r/20181112160956.ga28...@redhat.com
+Signed-off-by: Oleg Nesterov <o...@redhat.com>
+Reported-by: Ben Woodard <wood...@redhat.com>
+Reviewed-by: Andrew Morton <a...@linux-foundation.org>
+Acked-by: Michal Hocko <mho...@suse.com>
+Acked-by: Kees Cook <keesc...@chromium.org>
+Cc: "Eric W. Biederman" <ebied...@xmission.com>
+Signed-off-by: Andrew Morton <a...@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
+---
+ 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