s390/stacktrace: Improve detection of invalid instruction pointers
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 29 Apr 2024 12:28:46 +0000 (14:28 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Tue, 14 May 2024 11:37:06 +0000 (13:37 +0200)
commitcd58109283944ea8bdcd0a8211a86cbd2450716a
tree3efcc9cea02174f0a29c7e2a2bb26e58771b67e5
parent87eceb17a987802aeee718be4decd19b56fc8e33
s390/stacktrace: Improve detection of invalid instruction pointers

Add basic checks to identify invalid instruction pointers when walking
stack frames:

Instruction pointers must

- have even addresses
- be larger than mmap_min_addr
- lower than the asce_limit of the process

Alternatively it would also be possible to walk page tables similar to fast
GUP and verify that the mapping of the corresponding page is executable,
however that seems to be overkill.

Fixes: aa44433ac4ee ("s390: add USER_STACKTRACE support")
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/stacktrace.c