parisc architecture fix for kernel v6.18-rc5:
- fix crash triggered by unaligned access in parisc unwinder -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCaQ5IBgAKCRD3ErUQojoP X0GaAP9K2e9TZyIB0cnPzk0+uWIa8Py1Pzfz6eTHjjb958W6JAEAwLexSNhqNoVo TjjdThDqjWUG1AW3ptsa662x5v+/aAA= =h5Vt -----END PGP SIGNATURE----- Merge tag 'parisc-for-6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux Pull parisc fix from Helge Deller: - fix crash triggered by unaligned access in parisc unwinder * tag 'parisc-for-6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Avoid crash due to unaligned access in unwinder
This commit is contained in:
commit
38a2c275c3
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#define KERNEL_START (KERNEL_BINARY_TEXT_START)
|
||||
|
||||
#define ALIGNMENT_OK(ptr, type) (((ptr) & (sizeof(type) - 1)) == 0)
|
||||
|
||||
extern struct unwind_table_entry __start___unwind[];
|
||||
extern struct unwind_table_entry __stop___unwind[];
|
||||
|
||||
|
|
@ -257,12 +259,15 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int
|
|||
if (pc_is_kernel_fn(pc, _switch_to) ||
|
||||
pc == (unsigned long)&_switch_to_ret) {
|
||||
info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE;
|
||||
info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET);
|
||||
if (ALIGNMENT_OK(info->prev_sp, long))
|
||||
info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET);
|
||||
else
|
||||
info->prev_ip = info->prev_sp = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IRQSTACKS
|
||||
if (pc == (unsigned long)&_call_on_stack) {
|
||||
if (pc == (unsigned long)&_call_on_stack && ALIGNMENT_OK(info->sp, long)) {
|
||||
info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ);
|
||||
info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET);
|
||||
return 1;
|
||||
|
|
@ -370,8 +375,10 @@ static void unwind_frame_regs(struct unwind_frame_info *info)
|
|||
info->prev_sp = info->sp - frame_size;
|
||||
if (e->Millicode)
|
||||
info->rp = info->r31;
|
||||
else if (rpoffset)
|
||||
else if (rpoffset && ALIGNMENT_OK(info->prev_sp, long))
|
||||
info->rp = *(unsigned long *)(info->prev_sp - rpoffset);
|
||||
else
|
||||
info->rp = 0;
|
||||
info->prev_ip = info->rp;
|
||||
info->rp = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue