Commit 38a2c275 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'parisc-for-6.18-rc5' of...

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
parents a2e33fb9 fd9f30d1
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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;
		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;
		}