From b4a549d771562e464840b1c4777405513df46fcf Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 28 Feb 2021 15:02:17 +0100 Subject: [PATCH] 4.14-stable patches added patches: kdb-make-memory-allocations-more-robust.patch mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch random-fix-the-rndreseedcrng-ioctl.patch --- ...-make-memory-allocations-more-robust.patch | 40 +++++++++++ ...dd-missing-page_aligned_data-section.patch | 66 +++++++++++++++++++ .../random-fix-the-rndreseedcrng-ioctl.patch | 38 +++++++++++ queue-4.14/series | 3 + 4 files changed, 147 insertions(+) create mode 100644 queue-4.14/kdb-make-memory-allocations-more-robust.patch create mode 100644 queue-4.14/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch create mode 100644 queue-4.14/random-fix-the-rndreseedcrng-ioctl.patch diff --git a/queue-4.14/kdb-make-memory-allocations-more-robust.patch b/queue-4.14/kdb-make-memory-allocations-more-robust.patch new file mode 100644 index 00000000000..f3e3f9f5e01 --- /dev/null +++ b/queue-4.14/kdb-make-memory-allocations-more-robust.patch @@ -0,0 +1,40 @@ +From 93f7a6d818deef69d0ba652d46bae6fbabbf365c Mon Sep 17 00:00:00 2001 +From: Sumit Garg +Date: Fri, 22 Jan 2021 16:35:56 +0530 +Subject: kdb: Make memory allocations more robust + +From: Sumit Garg + +commit 93f7a6d818deef69d0ba652d46bae6fbabbf365c upstream. + +Currently kdb uses in_interrupt() to determine whether its library +code has been called from the kgdb trap handler or from a saner calling +context such as driver init. This approach is broken because +in_interrupt() alone isn't able to determine kgdb trap handler entry from +normal task context. This can happen during normal use of basic features +such as breakpoints and can also be trivially reproduced using: +echo g > /proc/sysrq-trigger + +We can improve this by adding check for in_dbg_master() instead which +explicitly determines if we are running in debugger context. + +Cc: stable@vger.kernel.org +Signed-off-by: Sumit Garg +Link: https://lore.kernel.org/r/1611313556-4004-1-git-send-email-sumit.garg@linaro.org +Signed-off-by: Daniel Thompson +Signed-off-by: Greg Kroah-Hartman +--- + kernel/debug/kdb/kdb_private.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/debug/kdb/kdb_private.h ++++ b/kernel/debug/kdb/kdb_private.h +@@ -233,7 +233,7 @@ extern struct task_struct *kdb_curr_task + #define kdb_do_each_thread(g, p) do_each_thread(g, p) + #define kdb_while_each_thread(g, p) while_each_thread(g, p) + +-#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) ++#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL) + + extern void *debug_kmalloc(size_t size, gfp_t flags); + extern void debug_kfree(void *); diff --git a/queue-4.14/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch b/queue-4.14/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch new file mode 100644 index 00000000000..60961a2dfb8 --- /dev/null +++ b/queue-4.14/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch @@ -0,0 +1,66 @@ +From 8ac7c87acdcac156670f9920c8acbd84308ff4b1 Mon Sep 17 00:00:00 2001 +From: Alexander Lobakin +Date: Sun, 10 Jan 2021 11:56:08 +0000 +Subject: MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section + +From: Alexander Lobakin + +commit 8ac7c87acdcac156670f9920c8acbd84308ff4b1 upstream. + +MIPS uses its own declaration of rwdata, and thus it should be kept +in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is +missing from the linker script, which emits the following ld +warnings: + +mips-alpine-linux-musl-ld: warning: orphan section +`.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed +in section `.data..page_aligned' +mips-alpine-linux-musl-ld: warning: orphan section +`.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed +in section `.data..page_aligned' + +Add the necessary declaration, so the mentioned structures will be +placed in vmlinux as intended: + +ffffffff80630580 D __end_once +ffffffff80630580 D __start___dyndbg +ffffffff80630580 D __start_once +ffffffff80630580 D __stop___dyndbg +ffffffff80634000 d mips_vdso_data +ffffffff80638000 d vdso_data +ffffffff80638580 D _gp +ffffffff8063c000 T __init_begin +ffffffff8063c000 D _edata +ffffffff8063c000 T _sinittext + +-> + +ffffffff805a4000 D __end_init_task +ffffffff805a4000 D __nosave_begin +ffffffff805a4000 D __nosave_end +ffffffff805a4000 d mips_vdso_data +ffffffff805a8000 d vdso_data +ffffffff805ac000 D mmlist_lock +ffffffff805ac080 D tasklist_lock + +Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") +Signed-off-by: Alexander Lobakin +Reviewed-by: Kees Cook +Reviewed-by: Nathan Chancellor +Cc: stable@vger.kernel.org # 4.4+ +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/kernel/vmlinux.lds.S | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -93,6 +93,7 @@ SECTIONS + + INIT_TASK_DATA(THREAD_SIZE) + NOSAVE_DATA ++ PAGE_ALIGNED_DATA(PAGE_SIZE) + CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) + READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) + DATA_DATA diff --git a/queue-4.14/random-fix-the-rndreseedcrng-ioctl.patch b/queue-4.14/random-fix-the-rndreseedcrng-ioctl.patch new file mode 100644 index 00000000000..9cc0800c63c --- /dev/null +++ b/queue-4.14/random-fix-the-rndreseedcrng-ioctl.patch @@ -0,0 +1,38 @@ +From 11a0b5e0ec8c13bef06f7414f9e914506140d5cb Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 12 Jan 2021 11:28:18 -0800 +Subject: random: fix the RNDRESEEDCRNG ioctl + +From: Eric Biggers + +commit 11a0b5e0ec8c13bef06f7414f9e914506140d5cb upstream. + +The RNDRESEEDCRNG ioctl reseeds the primary_crng from itself, which +doesn't make sense. Reseed it from the input_pool instead. + +Fixes: d848e5f8e1eb ("random: add new ioctl RNDRESEEDCRNG") +Cc: stable@vger.kernel.org +Cc: linux-crypto@vger.kernel.org +Cc: Andy Lutomirski +Cc: Jann Horn +Cc: Theodore Ts'o +Reviewed-by: Jann Horn +Acked-by: Ard Biesheuvel +Signed-off-by: Eric Biggers +Link: https://lore.kernel.org/r/20210112192818.69921-1-ebiggers@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -1984,7 +1984,7 @@ static long random_ioctl(struct file *f, + return -EPERM; + if (crng_init < 2) + return -ENODATA; +- crng_reseed(&primary_crng, NULL); ++ crng_reseed(&primary_crng, &input_pool); + crng_global_init_time = jiffies - 1; + return 0; + default: diff --git a/queue-4.14/series b/queue-4.14/series index 493018f063a..75e1d76cd02 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -6,3 +6,6 @@ net-usb-qmi_wwan-adding-support-for-cinterion-mv31.patch cifs-set-cifs_mount_use_prefix_path-flag-on-setting-.patch scripts-recordmcount.pl-support-big-endian-for-arch-.patch vmlinux.lds.h-add-dwarf-v5-sections.patch +kdb-make-memory-allocations-more-robust.patch +mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch +random-fix-the-rndreseedcrng-ioctl.patch -- 2.47.3