Skip to content

Commit 3c250ae

Browse files
committed
LoongArch: Fix build errors for CONFIG_RANDSTRUCT
When CONFIG_RANDSTRUCT enabled, members of task_struct are randomized. There is a chance that TASK_STACK_CANARY be out of 12bit immediate's range and causes build errors. TASK_STACK_CANARY is naturally aligned, so fix it by replacing ld.d/st.d with ldptr.d/stptr.d which have 14bit immediates. Cc: stable@vger.kernel.org Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202511240656.0NaPcJs1-lkp@intel.com/ Suggested-by: Rui Wang <wangrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 17fcc4b commit 3c250ae

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/loongarch/kernel/switch.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ SYM_FUNC_START(__switch_to)
2525
stptr.d a4, a0, THREAD_SCHED_CFA
2626
#if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_SMP)
2727
la t7, __stack_chk_guard
28-
LONG_L t8, a1, TASK_STACK_CANARY
29-
LONG_S t8, t7, 0
28+
ldptr.d t8, a1, TASK_STACK_CANARY
29+
stptr.d t8, t7, 0
3030
#endif
3131
move tp, a2
3232
cpu_restore_nonscratch a1

0 commit comments

Comments
 (0)