Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Lars Persson <lars.persson@axis.com>, <linux-mips@linux-mips.org>,
	<ralf@linux-mips.org>
Cc: Lars Persson <larper@axis.com>
Subject: Re: [PATCH] MIPS: Fix syscall_get_nr for the syscall exit tracing.
Date: Thu, 12 Feb 2015 14:26:33 +0000	[thread overview]
Message-ID: <54DCB819.3000406@imgtec.com> (raw)
In-Reply-To: <1422979697-1509-1-git-send-email-larper@axis.com>

On 02/03/2015 04:08 PM, Lars Persson wrote:
> Register 2 is alredy overwritten by the return value when
> syscall_trace_leave() is called.
> 
> Signed-off-by: Lars Persson <larper@axis.com>
> ---
>  arch/mips/include/asm/syscall.h     |    8 +-------
>  arch/mips/include/asm/thread_info.h |    1 +
>  arch/mips/kernel/ptrace.c           |    2 ++
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
> index bb79637..6499d93 100644
> --- a/arch/mips/include/asm/syscall.h
> +++ b/arch/mips/include/asm/syscall.h
> @@ -29,13 +29,7 @@
>  static inline long syscall_get_nr(struct task_struct *task,
>  				  struct pt_regs *regs)
>  {
> -	/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
> -	if ((config_enabled(CONFIG_32BIT) ||
> -	    test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
> -	    (regs->regs[2] == __NR_syscall))
> -		return regs->regs[4];
> -	else
> -		return regs->regs[2];
> +	return current_thread_info()->syscall;
>  }
>  
>  static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
> diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
> index 99eea59..e4440f9 100644
> --- a/arch/mips/include/asm/thread_info.h
> +++ b/arch/mips/include/asm/thread_info.h
> @@ -36,6 +36,7 @@ struct thread_info {
>  						 */
>  	struct restart_block	restart_block;
>  	struct pt_regs		*regs;
> +	long			syscall;	/* syscall number */
>  };
>  
>  /*
> diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
> index 9d1487d..5104528 100644
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -770,6 +770,8 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
>  	long ret = 0;
>  	user_exit();
>  
> +	current_thread_info()->syscall = syscall;
> +
>  	if (secure_computing() == -1)
>  		return -1;
>  
> 

Hi,

This is now in mainline but parts of it can apply to stable as well?
Would you be willing to send a backported version for the stable trees?
Thanks a lot

-- 
markos

WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Lars Persson <lars.persson@axis.com>,
	linux-mips@linux-mips.org, ralf@linux-mips.org
Cc: Lars Persson <larper@axis.com>
Subject: Re: [PATCH] MIPS: Fix syscall_get_nr for the syscall exit tracing.
Date: Thu, 12 Feb 2015 14:26:33 +0000	[thread overview]
Message-ID: <54DCB819.3000406@imgtec.com> (raw)
Message-ID: <20150212142633.y1reV4i3YSL_c9fqlXsWmGsF2z5Xd7GtCESXOw7EZvg@z> (raw)
In-Reply-To: <1422979697-1509-1-git-send-email-larper@axis.com>

On 02/03/2015 04:08 PM, Lars Persson wrote:
> Register 2 is alredy overwritten by the return value when
> syscall_trace_leave() is called.
> 
> Signed-off-by: Lars Persson <larper@axis.com>
> ---
>  arch/mips/include/asm/syscall.h     |    8 +-------
>  arch/mips/include/asm/thread_info.h |    1 +
>  arch/mips/kernel/ptrace.c           |    2 ++
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
> index bb79637..6499d93 100644
> --- a/arch/mips/include/asm/syscall.h
> +++ b/arch/mips/include/asm/syscall.h
> @@ -29,13 +29,7 @@
>  static inline long syscall_get_nr(struct task_struct *task,
>  				  struct pt_regs *regs)
>  {
> -	/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
> -	if ((config_enabled(CONFIG_32BIT) ||
> -	    test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
> -	    (regs->regs[2] == __NR_syscall))
> -		return regs->regs[4];
> -	else
> -		return regs->regs[2];
> +	return current_thread_info()->syscall;
>  }
>  
>  static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
> diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
> index 99eea59..e4440f9 100644
> --- a/arch/mips/include/asm/thread_info.h
> +++ b/arch/mips/include/asm/thread_info.h
> @@ -36,6 +36,7 @@ struct thread_info {
>  						 */
>  	struct restart_block	restart_block;
>  	struct pt_regs		*regs;
> +	long			syscall;	/* syscall number */
>  };
>  
>  /*
> diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
> index 9d1487d..5104528 100644
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -770,6 +770,8 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
>  	long ret = 0;
>  	user_exit();
>  
> +	current_thread_info()->syscall = syscall;
> +
>  	if (secure_computing() == -1)
>  		return -1;
>  
> 

Hi,

This is now in mainline but parts of it can apply to stable as well?
Would you be willing to send a backported version for the stable trees?
Thanks a lot

-- 
markos

  reply	other threads:[~2015-02-12 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 16:08 [PATCH] MIPS: Fix syscall_get_nr for the syscall exit tracing Lars Persson
2015-02-12 14:26 ` Markos Chandras [this message]
2015-02-12 14:26   ` Markos Chandras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54DCB819.3000406@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=larper@axis.com \
    --cc=lars.persson@axis.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox