diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-11-07 18:07:03 +0300 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2017-03-13 23:40:17 +0300 |
commit | 50ef9df8672655f3bb111223045ab5ce45d5655e (patch) | |
tree | 2c967353d90b9ef8f130a79b16b8d5a6a2c8bcb4 /virt | |
parent | 839f081610437d03b101286d8d386006044ab816 (diff) | |
download | linux-50ef9df8672655f3bb111223045ab5ce45d5655e.tar.xz |
MIPS: Prevent unaligned accesses during stack unwinding
commit a3552dace7d1d0cabf573e88fc3025cb90c4a601 upstream.
During stack unwinding we call a number of functions to determine what
type of instruction we're looking at. The union mips_instruction pointer
provided to them may be pointing at a 2 byte, but not 4 byte, aligned
address & we thus cannot directly access the 4 byte wide members of the
union mips_instruction. To avoid this is_ra_save_ins() copies the
required half-words of the microMIPS instruction to a correctly aligned
union mips_instruction on the stack, which it can then access safely.
The is_jump_ins() & is_sp_move_ins() functions do not correctly perform
this temporary copy, and instead attempt to directly dereference 4 byte
fields which may be misaligned and lead to an address exception.
Fix this by copying the instruction halfwords to a temporary union
mips_instruction in get_frame_info() such that we can provide a 4 byte
aligned union mips_instruction to the is_*_ins() functions and they do
not need to deal with misalignment themselves.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 34c2f668d0f6 ("MIPS: microMIPS: Add unaligned access support.")
Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14529/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions