All of lore.kernel.org
 help / color / mirror / Atom feed
From: wangnan0@huawei.com (Wang Nan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v12 7/7] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Fri, 5 Dec 2014 11:38:06 +0800	[thread overview]
Message-ID: <5481289E.4060504@huawei.com> (raw)
In-Reply-To: <1417710073.2239.10.camel@linaro.org>

On 2014/12/5 0:21, Jon Medhurst (Tixy) wrote:
> On Thu, 2014-12-04 at 13:36 +0800, Wang Nan wrote:
> 

[trim some text]

> 
> I have retested this patch and on one of the arm test cases I get an
> undefined instruction exception in kprobe_arm_test_cases. When this
> happens PC points to the second nop below. 
> 
> 
> 80028a38:	e320f000 	nop	{0}
> 80028a3c:	e11000b2 	ldrh	r0, [r0, -r2]
> 80028a40:	e320f000 	nop	{0}
> 
> As all three instructions will have probes on them during testing, and
> un-optimised probes are implemented by using an undefined instruction to
> act as a breakpoint, my first thought was that we have a race condition
> somewhere with adding, removing or optimizing probes. Though a reboot a
> retest failed in the same way on the same instruction, so I'm not 100%
> convinced about strictly timing related bugs.
>  

Does the problem appear in your platform in each time? Currently I have only
QEMU machine for testing and haven't seen problem like this before. Could
you please provide a detail steps for me to reproduce it? Or do you just
enable kprobe test code when booting and this exception simply appear twice?

> Meanwhile, I have some review comments of the code below...
> 

[trim some code]

>> +	/*
>> +	 * Add more 4 byte for potential AEABI requirement. If probing is triggered
>> +	 * when SP % 8 == 4, we sub SP by another 4 bytes.
>> +	 */
>> +	stack_protect += orig->ainsn.stack_space + 4;
> 
> The above comment and code don't match up any more with the code in
> optprobe_template_entry, it should be '+ 7' here. Alternatively, change
> the code in optprobe_template_entry back to use 4 as I suggested.
> 
> 

Looks like we don't really need this 4 bytes. ASM code should operate SP correctly in
each case.

WARNING: multiple messages have this Message-ID (diff)
From: Wang Nan <wangnan0@huawei.com>
To: "Jon Medhurst (Tixy)" <tixy@linaro.org>
Cc: <masami.hiramatsu.pt@hitachi.com>, <linux@arm.linux.org.uk>,
	<lizefan@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v12 7/7] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Fri, 5 Dec 2014 11:38:06 +0800	[thread overview]
Message-ID: <5481289E.4060504@huawei.com> (raw)
In-Reply-To: <1417710073.2239.10.camel@linaro.org>

On 2014/12/5 0:21, Jon Medhurst (Tixy) wrote:
> On Thu, 2014-12-04 at 13:36 +0800, Wang Nan wrote:
> 

[trim some text]

> 
> I have retested this patch and on one of the arm test cases I get an
> undefined instruction exception in kprobe_arm_test_cases. When this
> happens PC points to the second nop below. 
> 
> 
> 80028a38:	e320f000 	nop	{0}
> 80028a3c:	e11000b2 	ldrh	r0, [r0, -r2]
> 80028a40:	e320f000 	nop	{0}
> 
> As all three instructions will have probes on them during testing, and
> un-optimised probes are implemented by using an undefined instruction to
> act as a breakpoint, my first thought was that we have a race condition
> somewhere with adding, removing or optimizing probes. Though a reboot a
> retest failed in the same way on the same instruction, so I'm not 100%
> convinced about strictly timing related bugs.
>  

Does the problem appear in your platform in each time? Currently I have only
QEMU machine for testing and haven't seen problem like this before. Could
you please provide a detail steps for me to reproduce it? Or do you just
enable kprobe test code when booting and this exception simply appear twice?

> Meanwhile, I have some review comments of the code below...
> 

[trim some code]

>> +	/*
>> +	 * Add more 4 byte for potential AEABI requirement. If probing is triggered
>> +	 * when SP % 8 == 4, we sub SP by another 4 bytes.
>> +	 */
>> +	stack_protect += orig->ainsn.stack_space + 4;
> 
> The above comment and code don't match up any more with the code in
> optprobe_template_entry, it should be '+ 7' here. Alternatively, change
> the code in optprobe_template_entry back to use 4 as I suggested.
> 
> 

Looks like we don't really need this 4 bytes. ASM code should operate SP correctly in
each case.




  reply	other threads:[~2014-12-05  3:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  5:32 [PATCH v12 0/7] ARM: kprobes: OPTPROBES and other improvements Wang Nan
2014-12-04  5:32 ` Wang Nan
2014-12-04  5:34 ` [PATCH v12 1/7] ARM: probes: move all probe code to dedicate directory Wang Nan
2014-12-04  5:34   ` Wang Nan
2014-12-04  5:35 ` [PATCH v12 2/7] ARM: kprobes: introduces checker Wang Nan
2014-12-04  5:35   ` Wang Nan
2014-12-04  5:35 ` [PATCH v12 3/7] ARM: kprobes: collects stack consumption for store instructions Wang Nan
2014-12-04  5:35   ` Wang Nan
2014-12-04  5:35 ` [PATCH v12 4/7] ARM: kprobes: disallow probing stack consuming instructions Wang Nan
2014-12-04  5:35   ` Wang Nan
2014-12-04  5:35 ` [PATCH v12 5/7] ARM: kprobes: Add test cases for " Wang Nan
2014-12-04  5:35   ` Wang Nan
2014-12-04 16:22   ` Jon Medhurst (Tixy)
2014-12-04 16:22     ` Jon Medhurst (Tixy)
2014-12-04  5:35 ` [PATCH v12 6/7] kprobes: Pass the original kprobe for preparing optimized kprobe Wang Nan
2014-12-04  5:35   ` Wang Nan
2014-12-04 16:28   ` Jon Medhurst (Tixy)
2014-12-04 16:28     ` Jon Medhurst (Tixy)
2014-12-04  5:36 ` [PATCH v12 7/7] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2014-12-04  5:36   ` Wang Nan
2014-12-04 16:21   ` Jon Medhurst (Tixy)
2014-12-04 16:21     ` Jon Medhurst (Tixy)
2014-12-05  3:38     ` Wang Nan [this message]
2014-12-05  3:38       ` Wang Nan
2014-12-05 10:10       ` Jon Medhurst (Tixy)
2014-12-05 10:10         ` Jon Medhurst (Tixy)
2014-12-05 10:32         ` Wang Nan
2014-12-05 10:32           ` Wang Nan
2014-12-05 10:48           ` Jon Medhurst (Tixy)
2014-12-05 10:48             ` Jon Medhurst (Tixy)
2014-12-05 14:59         ` Jon Medhurst (Tixy)
2014-12-05 14:59           ` Jon Medhurst (Tixy)
2014-12-08  6:34           ` Wang Nan
2014-12-08  6:34             ` Wang Nan
2014-12-05 19:57         ` Peter Maydell
2014-12-05 19:57           ` Peter Maydell
2014-12-04 18:29   ` Russell King - ARM Linux
2014-12-04 18:29     ` Russell King - ARM Linux

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=5481289E.4060504@huawei.com \
    --to=wangnan0@huawei.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.