From: Sasha Levin Date: Sat, 28 Dec 2024 23:39:29 +0000 (-0500) Subject: Fixes for 6.6 X-Git-Tag: v6.1.123~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30850ee6f312334fc2cce55f4cd60af6ac90d059;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/mips-mipsregs-set-proper-isa-level-for-virt-extensio.patch b/queue-6.6/mips-mipsregs-set-proper-isa-level-for-virt-extensio.patch new file mode 100644 index 00000000000..eaa362c88d5 --- /dev/null +++ b/queue-6.6/mips-mipsregs-set-proper-isa-level-for-virt-extensio.patch @@ -0,0 +1,81 @@ +From 5b9c0d2c9aef842b945109c721e7f5887255a5e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 14:22:39 +0800 +Subject: MIPS: mipsregs: Set proper ISA level for virt extensions + +From: Jiaxun Yang + +[ Upstream commit a640d6762a7d404644201ebf6d2a078e8dc84f97 ] + +c994a3ec7ecc ("MIPS: set mips32r5 for virt extensions") setted +some instructions in virt extensions to ISA level mips32r5. + +However TLB related vz instructions was leftover, also this +shouldn't be done to a R5 or R6 kernel buid. + +Reorg macros to set ISA level as needed when _ASM_SET_VIRT +is called. + +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: WangYuli +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/mipsregs.h | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h +index 2d53704d9f24..e959a6b1a325 100644 +--- a/arch/mips/include/asm/mipsregs.h ++++ b/arch/mips/include/asm/mipsregs.h +@@ -2078,7 +2078,14 @@ do { \ + _ASM_INSN_IF_MIPS(0x4200000c) \ + _ASM_INSN32_IF_MM(0x0000517c) + #else /* !TOOLCHAIN_SUPPORTS_VIRT */ +-#define _ASM_SET_VIRT ".set\tvirt\n\t" ++#if MIPS_ISA_REV >= 5 ++#define _ASM_SET_VIRT_ISA ++#elif defined(CONFIG_64BIT) ++#define _ASM_SET_VIRT_ISA ".set\tmips64r5\n\t" ++#else ++#define _ASM_SET_VIRT_ISA ".set\tmips32r5\n\t" ++#endif ++#define _ASM_SET_VIRT _ASM_SET_VIRT_ISA ".set\tvirt\n\t" + #define _ASM_SET_MFGC0 _ASM_SET_VIRT + #define _ASM_SET_DMFGC0 _ASM_SET_VIRT + #define _ASM_SET_MTGC0 _ASM_SET_VIRT +@@ -2099,7 +2106,6 @@ do { \ + ({ int __res; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ +- ".set\tmips32r5\n\t" \ + _ASM_SET_MFGC0 \ + "mfgc0\t%0, " #source ", %1\n\t" \ + _ASM_UNSET_MFGC0 \ +@@ -2113,7 +2119,6 @@ do { \ + ({ unsigned long long __res; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ +- ".set\tmips64r5\n\t" \ + _ASM_SET_DMFGC0 \ + "dmfgc0\t%0, " #source ", %1\n\t" \ + _ASM_UNSET_DMFGC0 \ +@@ -2127,7 +2132,6 @@ do { \ + do { \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ +- ".set\tmips32r5\n\t" \ + _ASM_SET_MTGC0 \ + "mtgc0\t%z0, " #register ", %1\n\t" \ + _ASM_UNSET_MTGC0 \ +@@ -2140,7 +2144,6 @@ do { \ + do { \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ +- ".set\tmips64r5\n\t" \ + _ASM_SET_DMTGC0 \ + "dmtgc0\t%z0, " #register ", %1\n\t" \ + _ASM_UNSET_DMTGC0 \ +-- +2.39.5 + diff --git a/queue-6.6/mips-probe-toolchain-support-of-msym32.patch b/queue-6.6/mips-probe-toolchain-support-of-msym32.patch new file mode 100644 index 00000000000..8479b903806 --- /dev/null +++ b/queue-6.6/mips-probe-toolchain-support-of-msym32.patch @@ -0,0 +1,38 @@ +From 90fe2ee93384e866677c21d17617f7bd8f5b993f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 14:09:18 +0800 +Subject: MIPS: Probe toolchain support of -msym32 + +From: Jiaxun Yang + +[ Upstream commit 18ca63a2e23c5e170d2d7552b64b1f5ad019cd9b ] + +msym32 is not supported by LLVM toolchain. +Workaround by probe toolchain support of msym32 for KBUILD_SYM32 +feature. + +Link: https://github.com/ClangBuiltLinux/linux/issues/1544 +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: WangYuli +Signed-off-by: Sasha Levin +--- + arch/mips/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/mips/Makefile b/arch/mips/Makefile +index f49807e1f19b..0888074f4dfe 100644 +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -299,7 +299,7 @@ drivers-$(CONFIG_PCI) += arch/mips/pci/ + ifdef CONFIG_64BIT + ifndef KBUILD_SYM32 + ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0) +- KBUILD_SYM32 = y ++ KBUILD_SYM32 = $(call cc-option-yn, -msym32) + endif + endif + +-- +2.39.5 + diff --git a/queue-6.6/sched-task_stack-fix-object_is_on_stack-for-kasan-ta.patch b/queue-6.6/sched-task_stack-fix-object_is_on_stack-for-kasan-ta.patch new file mode 100644 index 00000000000..1370d13304e --- /dev/null +++ b/queue-6.6/sched-task_stack-fix-object_is_on_stack-for-kasan-ta.patch @@ -0,0 +1,96 @@ +From 4c7c9685ffb334f9d5bf3be8a04381c5793c58a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 16:10:57 +0800 +Subject: sched/task_stack: fix object_is_on_stack() for KASAN tagged pointers + +From: Qun-Wei Lin + +[ Upstream commit fd7b4f9f46d46acbc7af3a439bb0d869efdc5c58 ] + +When CONFIG_KASAN_SW_TAGS and CONFIG_KASAN_STACK are enabled, the +object_is_on_stack() function may produce incorrect results due to the +presence of tags in the obj pointer, while the stack pointer does not have +tags. This discrepancy can lead to incorrect stack object detection and +subsequently trigger warnings if CONFIG_DEBUG_OBJECTS is also enabled. + +Example of the warning: + +ODEBUG: object 3eff800082ea7bb0 is NOT on stack ffff800082ea0000, but annotated. +------------[ cut here ]------------ +WARNING: CPU: 0 PID: 1 at lib/debugobjects.c:557 __debug_object_init+0x330/0x364 +Modules linked in: +CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc5 #4 +Hardware name: linux,dummy-virt (DT) +pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) +pc : __debug_object_init+0x330/0x364 +lr : __debug_object_init+0x330/0x364 +sp : ffff800082ea7b40 +x29: ffff800082ea7b40 x28: 98ff0000c0164518 x27: 98ff0000c0164534 +x26: ffff800082d93ec8 x25: 0000000000000001 x24: 1cff0000c00172a0 +x23: 0000000000000000 x22: ffff800082d93ed0 x21: ffff800081a24418 +x20: 3eff800082ea7bb0 x19: efff800000000000 x18: 0000000000000000 +x17: 00000000000000ff x16: 0000000000000047 x15: 206b63617473206e +x14: 0000000000000018 x13: ffff800082ea7780 x12: 0ffff800082ea78e +x11: 0ffff800082ea790 x10: 0ffff800082ea79d x9 : 34d77febe173e800 +x8 : 34d77febe173e800 x7 : 0000000000000001 x6 : 0000000000000001 +x5 : feff800082ea74b8 x4 : ffff800082870a90 x3 : ffff80008018d3c4 +x2 : 0000000000000001 x1 : ffff800082858810 x0 : 0000000000000050 +Call trace: + __debug_object_init+0x330/0x364 + debug_object_init_on_stack+0x30/0x3c + schedule_hrtimeout_range_clock+0xac/0x26c + schedule_hrtimeout+0x1c/0x30 + wait_task_inactive+0x1d4/0x25c + kthread_bind_mask+0x28/0x98 + init_rescuer+0x1e8/0x280 + workqueue_init+0x1a0/0x3cc + kernel_init_freeable+0x118/0x200 + kernel_init+0x28/0x1f0 + ret_from_fork+0x10/0x20 +---[ end trace 0000000000000000 ]--- +ODEBUG: object 3eff800082ea7bb0 is NOT on stack ffff800082ea0000, but annotated. +------------[ cut here ]------------ + +Link: https://lkml.kernel.org/r/20241113042544.19095-1-qun-wei.lin@mediatek.com +Signed-off-by: Qun-Wei Lin +Cc: Andrew Yang +Cc: AngeloGioacchino Del Regno +Cc: Casper Li +Cc: Catalin Marinas +Cc: Chinwen Chang +Cc: Kent Overstreet +Cc: Matthias Brugger +Cc: Pasha Tatashin +Cc: Shakeel Butt +Cc: +Signed-off-by: Andrew Morton +[ Resolve line conflicts ] +Signed-off-by: Wenshan Lan +Signed-off-by: Sasha Levin +--- + include/linux/sched/task_stack.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h +index f158b025c175..d2117e1c8fa5 100644 +--- a/include/linux/sched/task_stack.h ++++ b/include/linux/sched/task_stack.h +@@ -8,6 +8,7 @@ + + #include + #include ++#include + + #ifdef CONFIG_THREAD_INFO_IN_TASK + +@@ -88,6 +89,7 @@ static inline int object_is_on_stack(const void *obj) + { + void *stack = task_stack_page(current); + ++ obj = kasan_reset_tag(obj); + return (obj >= stack) && (obj < (stack + THREAD_SIZE)); + } + +-- +2.39.5 + diff --git a/queue-6.6/series b/queue-6.6/series index 13d3cd69156..b2b36e9b121 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -49,3 +49,6 @@ drm-dp_mst-ensure-mst_primary-pointer-is-valid-in-dr.patch virtio-blk-don-t-keep-queue-frozen-during-system-sus.patch blk-mq-register-cpuhp-callback-after-hctx-is-added-t.patch blk-mq-move-cpuhp-callback-registering-out-of-q-sysf.patch +mips-probe-toolchain-support-of-msym32.patch +mips-mipsregs-set-proper-isa-level-for-virt-extensio.patch +sched-task_stack-fix-object_is_on_stack-for-kasan-ta.patch