WSL2-Linux-Kernel/arch
Haibo Li 1eae6e9196 ARM: 9295/1: unwind:fix unwind abort for uleb128 case
[ Upstream commit fa3eeb638d ]

When unwind instruction is 0xb2,the subsequent instructions
are uleb128 bytes.
For now,it uses only the first uleb128 byte in code.

For vsp increments of 0x204~0x400,use one uleb128 byte like below:
0xc06a00e4 <unwind_test_work>: 0x80b27fac
  Compact model index: 0
  0xb2 0x7f vsp = vsp + 1024
  0xac      pop {r4, r5, r6, r7, r8, r14}

For vsp increments larger than 0x400,use two uleb128 bytes like below:
0xc06a00e4 <unwind_test_work>: @0xc0cc9e0c
  Compact model index: 1
  0xb2 0x81 0x01 vsp = vsp + 1032
  0xac      pop {r4, r5, r6, r7, r8, r14}
The unwind works well since the decoded uleb128 byte is also 0x81.

For vsp increments larger than 0x600,use two uleb128 bytes like below:
0xc06a00e4 <unwind_test_work>: @0xc0cc9e0c
  Compact model index: 1
  0xb2 0x81 0x02 vsp = vsp + 1544
  0xac      pop {r4, r5, r6, r7, r8, r14}
In this case,the decoded uleb128 result is 0x101(vsp=0x204+(0x101<<2)).
While the uleb128 used in code is 0x81(vsp=0x204+(0x81<<2)).
The unwind aborts at this frame since it gets incorrect vsp.

To fix this,add uleb128 decode to cover all the above case.

Signed-off-by: Haibo Li <haibo.li@mediatek.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-09 10:32:20 +02:00
..
alpha
arc
arm ARM: 9295/1: unwind:fix unwind abort for uleb128 case 2023-06-09 10:32:20 +02:00
arm64 arm64: dts: imx8mn-var-som: fix PHY detection bug by adding deassert delay 2023-05-30 13:55:33 +01:00
csky
h8300
hexagon
ia64 ia64: fix an addr to taddr in huge_pte_offset() 2023-05-11 23:00:39 +09:00
m68k m68k: Move signal frame following exception on 68020/030 2023-05-30 13:55:30 +01:00
microblaze
mips MIPS: fw: Allow firmware to pass a empty env 2023-05-11 23:00:17 +09:00
nds32
nios2
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-11 23:00:37 +09:00
parisc parisc: Fix flush_dcache_page() for usage from irq context 2023-05-30 13:55:30 +01:00
powerpc powerpc/64s/radix: Fix soft dirty tracking 2023-05-24 17:36:55 +01:00
riscv riscv: Fix unused variable warning when BUILTIN_DTB is set 2023-06-09 10:32:15 +02:00
s390
sh sh: nmi_debug: fix return value of __setup handler 2023-05-17 11:50:23 +02:00
sparc
um
x86 x86/show_trace_log_lvl: Ensure stack pointer is aligned, again 2023-05-30 13:55:32 +01:00
xtensa
.gitignore
Kconfig