All of lore.kernel.org
 help / color / mirror / Atom feed
From: wade_farnsworth@mentor.com (Wade Farnsworth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: support syscall tracing
Date: Wed, 15 Aug 2012 09:58:44 -0700	[thread overview]
Message-ID: <502BD544.70903@mentor.com> (raw)
In-Reply-To: <20120815162157.GJ29448@mudshark.cambridge.arm.com>

Will Deacon wrote:
> Hi Wade,
>
> On Wed, Aug 15, 2012 at 04:14:20PM +0100, Wade Farnsworth wrote:
>> diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
>> index 3e0fc5f..4e82fc1 100644
>> --- a/arch/arm/kernel/ptrace.c
>> +++ b/arch/arm/kernel/ptrace.c
>> @@ -30,6 +30,9 @@
>>   #include<asm/pgtable.h>
>>   #include<asm/traps.h>
>>
>> +#define CREATE_TRACE_POINTS
>> +#include<trace/events/syscalls.h>
>> +
>>   #define REG_PC	15
>>   #define REG_PSR	16
>>   /*
>> @@ -918,7 +921,8 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
>>   {
>>   	unsigned long ip;
>>
>> -	if (!test_thread_flag(TIF_SYSCALL_TRACE))
>> +	if (!test_thread_flag(TIF_SYSCALL_TRACE)&&
>> +	    !test_thread_flag(TIF_SYSCALL_TRACEPOINT))
>>   		return scno;
>
> Can we now remove this hunk?
>
>>   	current_thread_info()->syscall = scno;
>> @@ -930,10 +934,12 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
>>   	ip = regs->ARM_ip;
>>   	regs->ARM_ip = dir;
>>
>> -	if (dir == PTRACE_SYSCALL_EXIT)
>> -		tracehook_report_syscall_exit(regs, 0);
>> -	else if (tracehook_report_syscall_entry(regs))
>> -		current_thread_info()->syscall = -1;
>> +	if (test_thread_flag(TIF_SYSCALL_TRACE)) {
>> +		if (dir == PTRACE_SYSCALL_EXIT)
>> +			tracehook_report_syscall_exit(regs, 0);
>> +		else if (tracehook_report_syscall_entry(regs))
>> +			current_thread_info()->syscall = -1;
>> +	}
>
> and also this one?
>

We need to set current_thread_info()->syscall, since it's used in the 
call to syscall_get_nr() in perf_syscall_{enter,exit}.

What about moving the setting of ->syscall to 
syscall_trace_{enter,exit}?  That would preserve ptrace_syscall_trace() 
for the TIF_SYSCALL_TRACE case only, but ensure that the field is set 
the TRACEPOINT case as well.  Thoughts?

Thanks for the feedback!

Wade

  reply	other threads:[~2012-08-15 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 15:14 [PATCH v2] ARM: support syscall tracing Wade Farnsworth
2012-08-15 16:21 ` Will Deacon
2012-08-15 16:58   ` Wade Farnsworth [this message]
2012-08-15 17:27     ` Will Deacon
2012-08-15 19:35       ` Wade Farnsworth
2012-08-15 20:21         ` Wade Farnsworth
2012-08-16  9:54           ` Will Deacon
2012-08-16 14:33             ` Wade Farnsworth

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=502BD544.70903@mentor.com \
    --to=wade_farnsworth@mentor.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.