]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Nov 2021 12:49:00 +0000 (13:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Nov 2021 12:49:00 +0000 (13:49 +0100)
added patches:
block-add-a-helper-to-validate-the-block-size.patch
bootconfig-init-fix-memblock-leak-in-xbc_make_cmdline.patch
fortify-explicitly-disable-clang-support.patch
kvm-fix-steal-time-asm-constraints.patch
loop-use-blk_validate_block_size-to-validate-block-size.patch
revert-drm-fb_helper-fix-config_fb-dependency.patch
revert-drm-fb_helper-improve-config_fb-dependency.patch

queue-5.14/block-add-a-helper-to-validate-the-block-size.patch [new file with mode: 0644]
queue-5.14/bootconfig-init-fix-memblock-leak-in-xbc_make_cmdline.patch [new file with mode: 0644]
queue-5.14/fortify-explicitly-disable-clang-support.patch [new file with mode: 0644]
queue-5.14/kvm-fix-steal-time-asm-constraints.patch [new file with mode: 0644]
queue-5.14/loop-use-blk_validate_block_size-to-validate-block-size.patch [new file with mode: 0644]
queue-5.14/revert-drm-fb_helper-fix-config_fb-dependency.patch [new file with mode: 0644]
queue-5.14/revert-drm-fb_helper-improve-config_fb-dependency.patch [new file with mode: 0644]
queue-5.14/series [new file with mode: 0644]

diff --git a/queue-5.14/block-add-a-helper-to-validate-the-block-size.patch b/queue-5.14/block-add-a-helper-to-validate-the-block-size.patch
new file mode 100644 (file)
index 0000000..a205483
--- /dev/null
@@ -0,0 +1,39 @@
+From 570b1cac477643cbf01a45fa5d018430a1fddbce Mon Sep 17 00:00:00 2001
+From: Xie Yongji <xieyongji@bytedance.com>
+Date: Tue, 26 Oct 2021 22:40:12 +0800
+Subject: block: Add a helper to validate the block size
+
+From: Xie Yongji <xieyongji@bytedance.com>
+
+commit 570b1cac477643cbf01a45fa5d018430a1fddbce upstream.
+
+There are some duplicated codes to validate the block
+size in block drivers. This limitation actually comes
+from block layer, so this patch tries to add a new block
+layer helper for that.
+
+Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
+Link: https://lore.kernel.org/r/20211026144015.188-2-xieyongji@bytedance.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/blkdev.h |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -240,6 +240,14 @@ struct request {
+       void *end_io_data;
+ };
++static inline int blk_validate_block_size(unsigned int bsize)
++{
++      if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
++              return -EINVAL;
++
++      return 0;
++}
++
+ static inline bool blk_op_is_passthrough(unsigned int op)
+ {
+       op &= REQ_OP_MASK;
diff --git a/queue-5.14/bootconfig-init-fix-memblock-leak-in-xbc_make_cmdline.patch b/queue-5.14/bootconfig-init-fix-memblock-leak-in-xbc_make_cmdline.patch
new file mode 100644 (file)
index 0000000..d0eacaa
--- /dev/null
@@ -0,0 +1,33 @@
+From 1ae43851b18afe861120ebd7c426dc44f06bb2bd Mon Sep 17 00:00:00 2001
+From: Masami Hiramatsu <mhiramat@kernel.org>
+Date: Thu, 16 Sep 2021 15:23:12 +0900
+Subject: bootconfig: init: Fix memblock leak in xbc_make_cmdline()
+
+From: Masami Hiramatsu <mhiramat@kernel.org>
+
+commit 1ae43851b18afe861120ebd7c426dc44f06bb2bd upstream.
+
+Free unused memblock in a error case to fix memblock leak
+in xbc_make_cmdline().
+
+Link: https://lkml.kernel.org/r/163177339181.682366.8713781325929549256.stgit@devnote2
+
+Fixes: 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line")
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ init/main.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/init/main.c
++++ b/init/main.c
+@@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(co
+       ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
+       if (ret < 0 || ret > len) {
+               pr_err("Failed to print extra kernel cmdline.\n");
++              memblock_free(__pa(new_cmdline), len + 1);
+               return NULL;
+       }
diff --git a/queue-5.14/fortify-explicitly-disable-clang-support.patch b/queue-5.14/fortify-explicitly-disable-clang-support.patch
new file mode 100644 (file)
index 0000000..f9d8501
--- /dev/null
@@ -0,0 +1,47 @@
+From a52f8a59aef46b59753e583bf4b28fccb069ce64 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Wed, 12 May 2021 21:51:10 -0700
+Subject: fortify: Explicitly disable Clang support
+
+From: Kees Cook <keescook@chromium.org>
+
+commit a52f8a59aef46b59753e583bf4b28fccb069ce64 upstream.
+
+Clang has never correctly compiled the FORTIFY_SOURCE defenses due to
+a couple bugs:
+
+       Eliding inlines with matching __builtin_* names
+       https://bugs.llvm.org/show_bug.cgi?id=50322
+
+       Incorrect __builtin_constant_p() of some globals
+       https://bugs.llvm.org/show_bug.cgi?id=41459
+
+In the process of making improvements to the FORTIFY_SOURCE defenses, the
+first (silent) bug (coincidentally) becomes worked around, but exposes
+the latter which breaks the build. As such, Clang must not be used with
+CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13),
+and the fortify routines have been rearranged.
+
+Update the Kconfig to reflect the reality of the current situation.
+
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Acked-by: Nick Desaulniers <ndesaulniers@google.com>
+Link: https://lore.kernel.org/lkml/CAKwvOd=A+ueGV2ihdy5GtgR2fQbcXjjAtVxv3=cPjffpebZB7A@mail.gmail.com
+Cc: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/Kconfig |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/security/Kconfig
++++ b/security/Kconfig
+@@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN
+ config FORTIFY_SOURCE
+       bool "Harden common str/mem functions against buffer overflows"
+       depends on ARCH_HAS_FORTIFY_SOURCE
++      # https://bugs.llvm.org/show_bug.cgi?id=50322
++      # https://bugs.llvm.org/show_bug.cgi?id=41459
++      depends on !CC_IS_CLANG
+       help
+         Detect overflows of buffers in common string and memory functions
+         where the compiler can determine and validate the buffer sizes.
diff --git a/queue-5.14/kvm-fix-steal-time-asm-constraints.patch b/queue-5.14/kvm-fix-steal-time-asm-constraints.patch
new file mode 100644 (file)
index 0000000..5257518
--- /dev/null
@@ -0,0 +1,42 @@
+From 964b7aa0b040bdc6ec1c543ee620cda3f8b4c68a Mon Sep 17 00:00:00 2001
+From: David Woodhouse <dwmw@amazon.co.uk>
+Date: Sun, 14 Nov 2021 08:59:02 +0000
+Subject: KVM: Fix steal time asm constraints
+
+From: David Woodhouse <dwmw@amazon.co.uk>
+
+commit 964b7aa0b040bdc6ec1c543ee620cda3f8b4c68a upstream.
+
+In 64-bit mode, x86 instruction encoding allows us to use the low 8 bits
+of any GPR as an 8-bit operand. In 32-bit mode, however, we can only use
+the [abcd] registers. For which, GCC has the "q" constraint instead of
+the less restrictive "r".
+
+Also fix st->preempted, which is an input/output operand rather than an
+input.
+
+Fixes: 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status")
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Message-Id: <89bf72db1b859990355f9c40713a34e0d2d86c98.camel@infradead.org>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/x86.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -3237,9 +3237,9 @@ static void record_steal_time(struct kvm
+                            "xor %1, %1\n"
+                            "2:\n"
+                            _ASM_EXTABLE_UA(1b, 2b)
+-                           : "+r" (st_preempted),
+-                             "+&r" (err)
+-                           : "m" (st->preempted));
++                           : "+q" (st_preempted),
++                             "+&r" (err),
++                             "+m" (st->preempted));
+               if (err)
+                       goto out;
diff --git a/queue-5.14/loop-use-blk_validate_block_size-to-validate-block-size.patch b/queue-5.14/loop-use-blk_validate_block_size-to-validate-block-size.patch
new file mode 100644 (file)
index 0000000..aaf979f
--- /dev/null
@@ -0,0 +1,61 @@
+From af3c570fb0df422b4906ebd11c1bf363d89961d5 Mon Sep 17 00:00:00 2001
+From: Xie Yongji <xieyongji@bytedance.com>
+Date: Tue, 26 Oct 2021 22:40:14 +0800
+Subject: loop: Use blk_validate_block_size() to validate block size
+
+From: Xie Yongji <xieyongji@bytedance.com>
+
+commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream.
+
+Remove loop_validate_block_size() and use the block layer helper
+to validate block size.
+
+Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
+Link: https://lore.kernel.org/r/20211026144015.188-4-xieyongji@bytedance.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/loop.c |   17 ++---------------
+ 1 file changed, 2 insertions(+), 15 deletions(-)
+
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -273,19 +273,6 @@ static void __loop_update_dio(struct loo
+ }
+ /**
+- * loop_validate_block_size() - validates the passed in block size
+- * @bsize: size to validate
+- */
+-static int
+-loop_validate_block_size(unsigned short bsize)
+-{
+-      if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
+-              return -EINVAL;
+-
+-      return 0;
+-}
+-
+-/**
+  * loop_set_size() - sets device size and notifies userspace
+  * @lo: struct loop_device to set the size for
+  * @size: new size of the loop device
+@@ -1235,7 +1222,7 @@ static int loop_configure(struct loop_de
+       }
+       if (config->block_size) {
+-              error = loop_validate_block_size(config->block_size);
++              error = blk_validate_block_size(config->block_size);
+               if (error)
+                       goto out_unlock;
+       }
+@@ -1761,7 +1748,7 @@ static int loop_set_block_size(struct lo
+       if (lo->lo_state != Lo_bound)
+               return -ENXIO;
+-      err = loop_validate_block_size(arg);
++      err = blk_validate_block_size(arg);
+       if (err)
+               return err;
diff --git a/queue-5.14/revert-drm-fb_helper-fix-config_fb-dependency.patch b/queue-5.14/revert-drm-fb_helper-fix-config_fb-dependency.patch
new file mode 100644 (file)
index 0000000..324043b
--- /dev/null
@@ -0,0 +1,34 @@
+From acae23dd371a39f792d5da13666876285b58c35b Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Fri, 19 Nov 2021 12:30:13 +0100
+Subject: Revert "drm: fb_helper: fix CONFIG_FB dependency"
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+This reverts commit c95380ba527ae0aee29b2a133c5d0c481d472759 which is
+commit 606b102876e3741851dfb09d53f3ee57f650a52c upstream.
+
+It causes some build problems as reported by Jiri.
+
+Link: https://lore.kernel.org/r/9fdb2bf1-de52-1b9d-4783-c61ce39e8f51@kernel.org
+Reported-by: Jiri Slaby <jirislaby@kernel.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/Kconfig |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/Kconfig
++++ b/drivers/gpu/drm/Kconfig
+@@ -98,7 +98,7 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
+ config DRM_FBDEV_EMULATION
+       bool "Enable legacy fbdev support for your modesetting driver"
+       depends on DRM
+-      depends on FB=y || FB=DRM
++      depends on FB
+       select DRM_KMS_HELPER
+       select FB_CFB_FILLRECT
+       select FB_CFB_COPYAREA
diff --git a/queue-5.14/revert-drm-fb_helper-improve-config_fb-dependency.patch b/queue-5.14/revert-drm-fb_helper-improve-config_fb-dependency.patch
new file mode 100644 (file)
index 0000000..cf882ff
--- /dev/null
@@ -0,0 +1,39 @@
+From 84705e42a0d08434045955845e0c53ee0acbd7b5 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Fri, 19 Nov 2021 12:30:10 +0100
+Subject: Revert "drm: fb_helper: improve CONFIG_FB dependency"
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+This reverts commit 94e18f5a5dd1b5e3b89c665fc5ff780858b1c9f6 which is
+commit 9d6366e743f37d36ef69347924ead7bcc596076e upstream.
+
+It causes some build problems as reported by Jiri.
+
+Link: https://lore.kernel.org/r/9fdb2bf1-de52-1b9d-4783-c61ce39e8f51@kernel.org
+Reported-by: Jiri Slaby <jirislaby@kernel.org>
+Cc: Jani Nikula <jani.nikula@intel.com>
+Cc: Javier Martinez Canillas <javierm@redhat.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/Kconfig |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/Kconfig
++++ b/drivers/gpu/drm/Kconfig
+@@ -97,8 +97,9 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
+ config DRM_FBDEV_EMULATION
+       bool "Enable legacy fbdev support for your modesetting driver"
+-      depends on DRM_KMS_HELPER
+-      depends on FB=y || FB=DRM_KMS_HELPER
++      depends on DRM
++      depends on FB=y || FB=DRM
++      select DRM_KMS_HELPER
+       select FB_CFB_FILLRECT
+       select FB_CFB_COPYAREA
+       select FB_CFB_IMAGEBLIT
diff --git a/queue-5.14/series b/queue-5.14/series
new file mode 100644 (file)
index 0000000..3fa9140
--- /dev/null
@@ -0,0 +1,7 @@
+revert-drm-fb_helper-improve-config_fb-dependency.patch
+revert-drm-fb_helper-fix-config_fb-dependency.patch
+kvm-fix-steal-time-asm-constraints.patch
+fortify-explicitly-disable-clang-support.patch
+block-add-a-helper-to-validate-the-block-size.patch
+loop-use-blk_validate_block_size-to-validate-block-size.patch
+bootconfig-init-fix-memblock-leak-in-xbc_make_cmdline.patch