]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Apr 2022 10:07:39 +0000 (12:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Apr 2022 10:07:39 +0000 (12:07 +0200)
added patches:
arm-9187-1-jive-fix-return-value-of-__setup-handler.patch
mm-memcontrol-return-1-from-cgroup.memory-__setup-handler.patch
mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch
mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch

queue-5.10/arm-9187-1-jive-fix-return-value-of-__setup-handler.patch [new file with mode: 0644]
queue-5.10/mm-memcontrol-return-1-from-cgroup.memory-__setup-handler.patch [new file with mode: 0644]
queue-5.10/mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch [new file with mode: 0644]
queue-5.10/mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/arm-9187-1-jive-fix-return-value-of-__setup-handler.patch b/queue-5.10/arm-9187-1-jive-fix-return-value-of-__setup-handler.patch
new file mode 100644 (file)
index 0000000..08f0177
--- /dev/null
@@ -0,0 +1,56 @@
+From 8b2360c7157b462c4870d447d1e65d30ef31f9aa Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Sat, 12 Mar 2022 07:36:09 +0100
+Subject: ARM: 9187/1: JIVE: fix return value of __setup handler
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit 8b2360c7157b462c4870d447d1e65d30ef31f9aa upstream.
+
+__setup() handlers should return 1 to obsolete_checksetup() in
+init/main.c to indicate that the boot option has been handled.
+A return of 0 causes the boot option/value to be listed as an Unknown
+kernel parameter and added to init's (limited) argument or environment
+strings. Also, error return codes don't mean anything to
+obsolete_checksetup() -- only non-zero (usually 1) or zero.
+So return 1 from jive_mtdset().
+
+Fixes: 9db829f485c5 ("[ARM] JIVE: Initial machine support for Logitech Jive")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Cc: Ben Dooks <ben-linux@fluff.org>
+Cc: Krzysztof Kozlowski <krzk@kernel.org>
+Cc: Alim Akhtar <alim.akhtar@samsung.com>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: linux-samsung-soc@vger.kernel.org
+Cc: patches@armlinux.org.uk
+Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/mach-s3c/mach-jive.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/arm/mach-s3c/mach-jive.c
++++ b/arch/arm/mach-s3c/mach-jive.c
+@@ -236,11 +236,11 @@ static int __init jive_mtdset(char *opti
+       unsigned long set;
+       if (options == NULL || options[0] == '\0')
+-              return 0;
++              return 1;
+       if (kstrtoul(options, 10, &set)) {
+               printk(KERN_ERR "failed to parse mtdset=%s\n", options);
+-              return 0;
++              return 1;
+       }
+       switch (set) {
+@@ -255,7 +255,7 @@ static int __init jive_mtdset(char *opti
+                      "using default.", set);
+       }
+-      return 0;
++      return 1;
+ }
+ /* parse the mtdset= option given to the kernel command line */
diff --git a/queue-5.10/mm-memcontrol-return-1-from-cgroup.memory-__setup-handler.patch b/queue-5.10/mm-memcontrol-return-1-from-cgroup.memory-__setup-handler.patch
new file mode 100644 (file)
index 0000000..8e7b7ec
--- /dev/null
@@ -0,0 +1,58 @@
+From 460a79e18842caca6fa0c415de4a3ac1e671ac50 Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Tue, 22 Mar 2022 14:40:31 -0700
+Subject: mm/memcontrol: return 1 from cgroup.memory __setup() handler
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit 460a79e18842caca6fa0c415de4a3ac1e671ac50 upstream.
+
+__setup() handlers should return 1 if the command line option is handled
+and 0 if not (or maybe never return 0; it just pollutes init's
+environment).
+
+The only reason that this particular __setup handler does not pollute
+init's environment is that the setup string contains a '.', as in
+"cgroup.memory".  This causes init/main.c::unknown_boottoption() to
+consider it to be an "Unused module parameter" and ignore it.  (This is
+for parsing of loadable module parameters any time after kernel init.)
+Otherwise the string "cgroup.memory=whatever" would be added to init's
+environment strings.
+
+Instead of relying on this '.' quirk, just return 1 to indicate that the
+boot option has been handled.
+
+Note that there is no warning message if someone enters:
+       cgroup.memory=anything_invalid
+
+Link: https://lkml.kernel.org/r/20220222005811.10672-1-rdunlap@infradead.org
+Fixes: f7e1cb6ec51b0 ("mm: memcontrol: account socket memory in unified hierarchy memory controller")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
+Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
+Reviewed-by: Michal Koutný <mkoutny@suse.com>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Michal Hocko <mhocko@kernel.org>
+Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
+Cc: Roman Gushchin <roman.gushchin@linux.dev>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/memcontrol.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/memcontrol.c
++++ b/mm/memcontrol.c
+@@ -7124,7 +7124,7 @@ static int __init cgroup_memory(char *s)
+               if (!strcmp(token, "nokmem"))
+                       cgroup_memory_nokmem = true;
+       }
+-      return 0;
++      return 1;
+ }
+ __setup("cgroup.memory=", cgroup_memory);
diff --git a/queue-5.10/mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch b/queue-5.10/mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch
new file mode 100644 (file)
index 0000000..5c20f4f
--- /dev/null
@@ -0,0 +1,61 @@
+From e6d094936988910ce6e8197570f2753898830081 Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Tue, 22 Mar 2022 14:42:27 -0700
+Subject: mm/mmap: return 1 from stack_guard_gap __setup() handler
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit e6d094936988910ce6e8197570f2753898830081 upstream.
+
+__setup() handlers should return 1 if the command line option is handled
+and 0 if not (or maybe never return 0; it just pollutes init's
+environment).  This prevents:
+
+  Unknown kernel command line parameters \
+  "BOOT_IMAGE=/boot/bzImage-517rc5 stack_guard_gap=100", will be \
+  passed to user space.
+
+  Run /sbin/init as init process
+   with arguments:
+     /sbin/init
+   with environment:
+     HOME=/
+     TERM=linux
+     BOOT_IMAGE=/boot/bzImage-517rc5
+     stack_guard_gap=100
+
+Return 1 to indicate that the boot option has been handled.
+
+Note that there is no warning message if someone enters:
+       stack_guard_gap=anything_invalid
+and 'val' and stack_guard_gap are both set to 0 due to the use of
+simple_strtoul(). This could be improved by using kstrtoxxx() and
+checking for an error.
+
+It appears that having stack_guard_gap == 0 is valid (if unexpected) since
+using "stack_guard_gap=0" on the kernel command line does that.
+
+Link: https://lkml.kernel.org/r/20220222005817.11087-1-rdunlap@infradead.org
+Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
+Fixes: 1be7107fbe18e ("mm: larger stack guard gap, between vmas")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
+Cc: Hugh Dickins <hughd@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/mmap.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -2577,7 +2577,7 @@ static int __init cmdline_parse_stack_gu
+       if (!*endptr)
+               stack_guard_gap = val << PAGE_SHIFT;
+-      return 0;
++      return 1;
+ }
+ __setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);
diff --git a/queue-5.10/mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch b/queue-5.10/mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch
new file mode 100644 (file)
index 0000000..d11d2af
--- /dev/null
@@ -0,0 +1,63 @@
+From 05fe3c103f7e6b8b4fca8a7001dfc9ed4628085b Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Tue, 22 Mar 2022 14:47:52 -0700
+Subject: mm/usercopy: return 1 from hardened_usercopy __setup() handler
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit 05fe3c103f7e6b8b4fca8a7001dfc9ed4628085b upstream.
+
+__setup() handlers should return 1 if the command line option is handled
+and 0 if not (or maybe never return 0; it just pollutes init's
+environment).  This prevents:
+
+  Unknown kernel command line parameters \
+  "BOOT_IMAGE=/boot/bzImage-517rc5 hardened_usercopy=off", will be \
+  passed to user space.
+
+  Run /sbin/init as init process
+   with arguments:
+     /sbin/init
+   with environment:
+     HOME=/
+     TERM=linux
+     BOOT_IMAGE=/boot/bzImage-517rc5
+     hardened_usercopy=off
+or
+     hardened_usercopy=on
+but when "hardened_usercopy=foo" is used, there is no Unknown kernel
+command line parameter.
+
+Return 1 to indicate that the boot option has been handled.
+Print a warning if strtobool() returns an error on the option string,
+but do not mark this as in unknown command line option and do not cause
+init's environment to be polluted with this string.
+
+Link: https://lkml.kernel.org/r/20220222034249.14795-1-rdunlap@infradead.org
+Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
+Fixes: b5cb15d9372ab ("usercopy: Allow boot cmdline disabling of hardening")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
+Acked-by: Chris von Recklinghausen <crecklin@redhat.com>
+Cc: Kees Cook <keescook@chromium.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/usercopy.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/mm/usercopy.c
++++ b/mm/usercopy.c
+@@ -294,7 +294,10 @@ static bool enable_checks __initdata = t
+ static int __init parse_hardened_usercopy(char *str)
+ {
+-      return strtobool(str, &enable_checks);
++      if (strtobool(str, &enable_checks))
++              pr_warn("Invalid option string for hardened_usercopy: '%s'\n",
++                      str);
++      return 1;
+ }
+ __setup("hardened_usercopy=", parse_hardened_usercopy);
index 961cb80b7a0f3d588eaef80a6d49c9ec7020d34a..8c36f94281a9fa939c1269ce08c79474dbab6c6a 100644 (file)
@@ -573,3 +573,7 @@ proc-bootconfig-add-null-pointer-check.patch
 staging-mt7621-dts-fix-pinctrl-0-items-to-be-size-1-items-on-ethernet.patch
 asoc-soc-compress-change-the-check-for-codec_dai.patch
 batman-adv-check-ptr-for-null-before-reducing-its-refcnt.patch
+mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch
+arm-9187-1-jive-fix-return-value-of-__setup-handler.patch
+mm-memcontrol-return-1-from-cgroup.memory-__setup-handler.patch
+mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch