Add support for an unwind user method to specify that the FP/RA location is unknown. For the frame pointer (FP) set the FP value to zero, so that subsequent unwind next frame that rely on FP fail. For the return address (RA) treat as error.
This enables to implement support for unwinding of user space using back chain on s390 with a subsequent commit, which can only unwind SP and RA, but not FP. Signed-off-by: Jens Remus <[email protected]> --- Notes (jremus): Changes in RFC v3: - New patch. Prerequirement to implement unwind user fp using back chain on s390. include/linux/unwind_user_types.h | 1 + kernel/unwind/user.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_types.h index 4f78999a0750..f44035b98f7c 100644 --- a/include/linux/unwind_user_types.h +++ b/include/linux/unwind_user_types.h @@ -28,6 +28,7 @@ struct unwind_stacktrace { }; enum unwind_user_loc { + UNWIND_USER_LOC_UNKNOWN, UNWIND_USER_LOC_RETAIN, UNWIND_USER_LOC_STACK, UNWIND_USER_LOC_REG, diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 45f82ed28fcb..7d06bdbc7f0d 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -93,6 +93,10 @@ static int unwind_user_next_common(struct unwind_user_state *state, if (!state->topmost || unwind_user_get_reg(&fp, frame->fp.regnum)) return -EINVAL; break; + case UNWIND_USER_LOC_UNKNOWN: + /* FP cannot be unwound. Not an error. Set to zero. */ + fp = 0; + break; default: WARN_ON_ONCE(1); return -EINVAL; -- 2.51.0
