* [BUG] arm64/hw_breakpoint: trigger breakpoint exception infinitely
@ 2016-04-26 8:23 Li Bin
2016-04-26 12:22 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Li Bin @ 2016-04-26 8:23 UTC (permalink / raw)
To: linux-arm-kernel
This bug can be reproduced by compiling the hw_breakpoint sample
module that is in the kernel tree, when loading it with parameter
ksym=nfsdstats, and running nfsstat:
$ insmod data_breakpoint.ko ksym=nfsdstats
$ nfsstat
It will trigger breakpoint exception infinitely:
nfsdstats value is changed
...
Call trace:
...
Dump stack from sample_hbp_handler
nfsdstats value is changed
...
Call trace:
...
Dump stack from sample_hbp_handler
......
......
This is because that the overflow_handler is set to the callback
in the module, and in watchpoint_handler, it will not disable the
breakpoint (and set single step that reenable it), so when exception
return, it will trigger the breakpoint exception again immediately...
Li Bin
^ permalink raw reply [flat|nested] 3+ messages in thread
* [BUG] arm64/hw_breakpoint: trigger breakpoint exception infinitely
2016-04-26 8:23 [BUG] arm64/hw_breakpoint: trigger breakpoint exception infinitely Li Bin
@ 2016-04-26 12:22 ` Will Deacon
2016-04-27 2:35 ` Li Bin
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2016-04-26 12:22 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 26, 2016 at 04:23:19PM +0800, Li Bin wrote:
> This bug can be reproduced by compiling the hw_breakpoint sample
> module that is in the kernel tree, when loading it with parameter
> ksym=nfsdstats, and running nfsstat:
>
> $ insmod data_breakpoint.ko ksym=nfsdstats
> $ nfsstat
>
> It will trigger breakpoint exception infinitely:
>
> nfsdstats value is changed
> ...
> Call trace:
> ...
> Dump stack from sample_hbp_handler
> nfsdstats value is changed
> ...
> Call trace:
> ...
> Dump stack from sample_hbp_handler
> ......
> ......
>
> This is because that the overflow_handler is set to the callback
> in the module, and in watchpoint_handler, it will not disable the
> breakpoint (and set single step that reenable it), so when exception
> return, it will trigger the breakpoint exception again immediately...
As I explained before, GDB/ptrace *relies* on this behaviour. If you
register an breakpoint overflow handler on arm64, then you need to handle
the step.
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* [BUG] arm64/hw_breakpoint: trigger breakpoint exception infinitely
2016-04-26 12:22 ` Will Deacon
@ 2016-04-27 2:35 ` Li Bin
0 siblings, 0 replies; 3+ messages in thread
From: Li Bin @ 2016-04-27 2:35 UTC (permalink / raw)
To: linux-arm-kernel
on 2016/4/26 20:22, Will Deacon wrote:
> On Tue, Apr 26, 2016 at 04:23:19PM +0800, Li Bin wrote:
>> This bug can be reproduced by compiling the hw_breakpoint sample
>> module that is in the kernel tree, when loading it with parameter
>> ksym=nfsdstats, and running nfsstat:
>>
>> $ insmod data_breakpoint.ko ksym=nfsdstats
>> $ nfsstat
>>
>> It will trigger breakpoint exception infinitely:
>>
>> nfsdstats value is changed
>> ...
>> Call trace:
>> ...
>> Dump stack from sample_hbp_handler
>> nfsdstats value is changed
>> ...
>> Call trace:
>> ...
>> Dump stack from sample_hbp_handler
>> ......
>> ......
>>
>> This is because that the overflow_handler is set to the callback
>> in the module, and in watchpoint_handler, it will not disable the
>> breakpoint (and set single step that reenable it), so when exception
>> return, it will trigger the breakpoint exception again immediately...
>
> As I explained before, GDB/ptrace *relies* on this behaviour. If you
> register an breakpoint overflow handler on arm64, then you need to handle
> the step.
So it is a bug of samples/hw_breakpoint/data_breakpoint.c for arm64.
Should we fix it (may need to change the kernel code), or disable it
for arm64?
Thanks,
Li Bin
>
> Will
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-27 2:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26 8:23 [BUG] arm64/hw_breakpoint: trigger breakpoint exception infinitely Li Bin
2016-04-26 12:22 ` Will Deacon
2016-04-27 2:35 ` Li Bin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).