sched: Fix KCSAN noinstr violation
Subsystems (2)
Sasha Levin
maintainerPATCH 3/6 riscv: Fix EFI stub usage of KASAN instrumented strcmp function
In reply to Sasha LevinFrom: Alexandre Ghiti <[email protected]>
[ Upstream commit 617955ca6e275c4dd0dcf5316fca7fc04a8f2fe6 ]
The EFI stub must not use any KASAN instrumented code as the kernel proper did not initialize the thread pointer and the mapping for the KASAN shadow region.
Avoid using the generic strcmp function, instead use the one in drivers/firmware/efi/libstub/string.c.
--- arch/riscv/kernel/image-vars.h | 2 -- 1 file changed, 2 deletions(-)
arch/riscv/kernel/image-vars.h +0 -2
@@ -23,8 +23,6 @@* linked at. The routines below are all implemented in assembler in a * position independent manner */ -__efistub_strcmp = strcmp; - __efistub__start = _start; __efistub__start_kernel = _start_kernel; __efistub__end = _end;
Signature · 7 lines
2.39.2 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Sasha Levin
maintainerPATCH 4/6 riscv: Unconditionnally select KASAN_VMALLOC if KASAN
In reply to Sasha LevinFrom: Alexandre Ghiti <[email protected]>
[ Upstream commit 864046c512c2cd8418dc928b91981fb12a80396c ]
If KASAN is enabled, VMAP_STACK depends on KASAN_VMALLOC so enable KASAN_VMALLOC with KASAN so that we can enable VMAP_STACK by default.
--- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/riscv/Kconfig +1 -0
@@ -117,6 +117,7 @@ config RISCV select HAVE_RSEQ select IRQ_DOMAIN select IRQ_FORCED_THREADING + select KASAN_VMALLOC if KASAN select MODULES_USE_ELF_RELA if MODULES select MODULE_SECTIONS if MODULES select OF
Signature · 7 lines
2.39.2 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Sasha Levin
maintainerPATCH 1/6 sched: Fix KCSAN noinstr violation
From: Josh Poimboeuf <[email protected]>
[ Upstream commit e0b081d17a9f4e5c0cbb0e5fbeb1abe3de0f7e4e ]
With KCSAN enabled, end_of_stack() can get out-of-lined. Force it inline.
Fixes the following warnings:
vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b: call to end_of_stack() leaves .noinstr.text section
--- include/linux/sched/task_stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched/task_stack.h +1 -1
@@ -23,7 +23,7 @@ static __always_inline void *task_stack_page(const struct task_struct *task)#define setup_thread_stack (new,old) do { } while(0) -static inline unsigned long *end_of_stack (const struct task_struct *task) +static __always_inline unsigned long *end_of_stack (const struct task_struct *task) {#ifdef CONFIG_STACK_GROWSUP return (unsigned long *)((unsigned long )task->stack +THREAD_SIZE ) -1 ;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 2/6 lkdtm/stackleak: Fix noinstr violation
From: Josh Poimboeuf <[email protected]>
[ Upstream commit f571da059f86fd9d432aea32c9c7e5aaa53245d8 ]
Fixes the following warning:
vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b6: call to _printk() leaves .noinstr.text section
--- drivers/misc/lkdtm/stackleak.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/misc/lkdtm/stackleak.c +6 -0
@@ -43,12 +43,14 @@ static void noinstr check_stackleak_irqoff(void)* STACK_END_MAGIC, and in either casee something is seriously wrong. */ if (current_sp < task_stack_low || current_sp >= task_stack_high) { +instrumentation_begin ();pr_err ("FAIL: current_stack_pointer (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n" , current_sp, task_stack_low, task_stack_high -1 ); test_failed = true; goto out; }if (lowest_sp < task_stack_low || lowest_sp >= task_stack_high) { +instrumentation_begin ();pr_err ("FAIL: current->lowest_stack (0x%lx) outside of task stack bounds [0x%lx..0x%lx]\n" , lowest_sp, task_stack_low, task_stack_high -1 ); test_failed = true;
@@ -86,11 +88,14 @@ static void noinstr check_stackleak_irqoff(void)if (*(unsigned long *)poison_low ==STACKLEAK_POISON )continue ; +instrumentation_begin ();pr_err ("FAIL: non-poison value %lu bytes below poison boundary: 0x%lx\n" , poison_high - poison_low, *(unsigned long *)poison_low); test_failed = true; + goto out; } +instrumentation_begin ();pr_info ("stackleak stack usage:\n" " high offset: %lu bytes\n" " current: %lu bytes\n"
@@ -113,6 +118,7 @@ static void noinstr check_stackleak_irqoff(void) }else {pr_info ("OK: the rest of the thread stack is properly erased\n" ); } +instrumentation_end (); }static void lkdtm_STACKLEAK_ERASING (void )
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 5/6 powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 22fdf79171e8509db54599fd2c05ef0022ee83f5 ]
ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and only implied. This is achieved by marking symbol as visible by providing short description. Also adds dependency for this symbol to prevent enabling it on platforms on which driver does not compile.
--- arch/powerpc/platforms/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/Kconfig +3 -1
@@ -261,7 +261,9 @@ config CPM2 on it (826x, 827x, 8560). config FSL_ULI1575 - bool + bool "ULI1575 PCIe south bridge support" + depends on FSL_SOC_BOOKE || PPC_86xx + select FSL_PCI select GENERIC_ISA_DMA help Supports for the ULI1575 PCIe south bridge that exists on some
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 6/6 recordmcount: Fix memory leaks in the uwrite function
In reply to Sasha LevinFrom: Hao Zeng <[email protected]>
[ Upstream commit fa359d068574d29e7d2f0fdd0ebe4c6a12b5cfb9 ]
Common realloc mistake: 'file_append' nulled but not freed upon failure
--- scripts/recordmcount.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/recordmcount.c +5 -1
@@ -110,6 +110,7 @@ static ssize_t uwrite(void const *const buf, size_t const count) {size_t cnt = count;off_t idx =0 ; +void *p =NULL ; file_updated =1 ;
@@ -117,7 +118,10 @@ static ssize_t uwrite(void const *const buf, size_t const count)off_t aoffset = (file_ptr + count) - file_end;if (aoffset > file_append_size) { - file_append =realloc (file_append, aoffset); + p =realloc (file_append, aoffset); +if (!p) +free (file_append); + file_append = p; file_append_size = aoffset; }if (!file_append) {
Signature · 1 line
2.39.2