lkml.org 
[lkml]   [2014]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v9 1/6] arm64: ptrace: add NT_ARM_SYSTEM_CALL regset
Hi Akashi,

On Wed, Nov 26, 2014 at 04:49:46AM +0000, AKASHI Takahiro wrote:
> This regeset is intended to be used to get and set a system call number
> while tracing.
> There was some discussion about possible approaches to do so:
>
> (1) modify x8 register with ptrace(PTRACE_SETREGSET) indirectly,
> and update regs->syscallno later on in syscall_trace_enter(), or
> (2) define a dedicated regset for this purpose as on s390, or
> (3) support ptrace(PTRACE_SET_SYSCALL) as on arch/arm
>
> Thinking of the fact that user_pt_regs doesn't expose 'syscallno' to
> tracer as well as that secure_computing() expects a changed syscall number,
> especially case of -1, to be visible before this function returns in
> syscall_trace_enter(), (1) doesn't work well.
> We will take (2) since it looks much cleaner.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
> arch/arm64/kernel/ptrace.c | 35 +++++++++++++++++++++++++++++++++++
> include/uapi/linux/elf.h | 1 +
> 2 files changed, 36 insertions(+)
>
> diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
> index 8a4ae8e..8b98781 100644
> --- a/arch/arm64/kernel/ptrace.c
> +++ b/arch/arm64/kernel/ptrace.c
> @@ -551,6 +551,32 @@ static int tls_set(struct task_struct *target, const struct user_regset *regset,
> return ret;
> }
>
> +static int system_call_get(struct task_struct *target,
> + const struct user_regset *regset,
> + unsigned int pos, unsigned int count,
> + void *kbuf, void __user *ubuf)
> +{
> + struct pt_regs *regs = task_pt_regs(target);
> +
> + return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> + &regs->syscallno, 0, -1);

Does this work for big-endian machines? regs->syscallno is a u64, but the
regset defines it as an int. I think you need to copy to a temporary
register first.

Will


\
 
 \ /
  Last update: 2014-11-26 14:21    [W:0.087 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site