s390/unwind: filter out unreliable bogus %r14
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 27 Nov 2019 17:12:04 +0000 (18:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Jan 2020 18:18:29 +0000 (19:18 +0100)
commitcff542509ec302ea63b9cc19ae2226740883ba63
treee981a340eb9e2c58d73aac63f92ec6de02c3dd3d
parentebd75fea2cda2a1ecfe2a63ed2316665ed193f97
s390/unwind: filter out unreliable bogus %r14

[ Upstream commit bf018ee644897d7982e1b8dd8b15e97db6e1a4da ]

Currently unwinder unconditionally returns %r14 from the first frame
pointed by %r15 from pt_regs. A task could be interrupted when a function
already allocated this frame (if it needs it) for its callees or to
store local variables. In that case this frame would contain random
values from stack or values stored there by a callee. As we are only
interested in %r14 to get potential return address, skip bogus return
addresses which doesn't belong to kernel text.

This helps to avoid duplicating filtering logic in unwider users, most
of which use unwind_get_return_address() and would choke on bogus 0
address returned by it otherwise.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/unwind_bc.c