Add support for the unwind user FP/RA recovery rule "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 --- 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 89c71a4553b2..fac8f470b597 100644 --- a/include/linux/unwind_user_types.h +++ b/include/linux/unwind_user_types.h @@ -45,6 +45,7 @@ struct unwind_user_cfa_rule_data { }; enum unwind_user_rule { + UNWIND_USER_RULE_ZERO, /* entity = 0 */ UNWIND_USER_RULE_RETAIN, /* entity = entity */ UNWIND_USER_RULE_CFA_OFFSET, /* entity = CFA + offset */ UNWIND_USER_RULE_REG_OFFSET, /* entity = register + offset */ diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index e21d088f7543..036328cb9ee8 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -114,6 +114,10 @@ static int unwind_user_next_common(struct unwind_user_state *state, return -EINVAL; fp += frame->fp.offset; break; + case UNWIND_USER_RULE_ZERO: + /* FP cannot be unwound. Not an error. Set to zero. */ + fp = 0; + break; default: WARN_ON_ONCE(1); return -EINVAL; -- 2.51.0