summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/ptrace.h
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@linaro.org>2019-08-06 18:00:14 +0800
committerWill Deacon <will@kernel.org>2019-08-07 13:53:09 +0100
commit42d038c4fb00f1ec1a4c4616784da4561385b628 (patch)
treec8c5335e01986c073ae56ca1df94eeed5c13fe1e /arch/arm64/include/asm/ptrace.h
parent45880f7b7b19e043ce0aaa4cb7d05369425c82fa (diff)
arm64: Add support for function error injection
Inspired by the commit 7cd01b08d35f ("powerpc: Add support for function error injection"), this patch supports function error injection for Arm64. This patch mainly support two functions: one is regs_set_return_value() which is used to overwrite the return value; the another function is override_function_with_return() which is to override the probed function returning and jump to its caller. Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm/ptrace.h')
-rw-r--r--arch/arm64/include/asm/ptrace.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 1dcf63a9ac1f..fbebb411ae20 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -301,6 +301,11 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
return regs->regs[0];
}
+static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
+{
+ regs->regs[0] = rc;
+}
+
/**
* regs_get_kernel_argument() - get Nth function argument in kernel
* @regs: pt_regs of that context