Bug 20412
Summary: | PTRACE_SINGLESTEP'ing an instruction that calls user helpers never stops the child on ARM | ||
---|---|---|---|
Product: | Platform Specific/Hardware | Reporter: | Timo Lindfors (timo.lindfors) |
Component: | ARM | Assignee: | linux-arm-kernel (linux-arm-kernel) |
Status: | RESOLVED INVALID | ||
Severity: | low | CC: | alan |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | Subsystem: | ||
Regression: | No | Bisected commit-id: | |
Attachments: | [PATCH] Make PTRACE_SINGLESTEP work with user helpers |
Bugzilla is only used for tracking bugs, patches are not accepted via bugzilla. Patches should go to the linux-arm list linux-arm-kernel@lists.infradead.org For the record: the patch was posted to the mailing list: http://www.spinics.net/lists/arm/msg15766.html The issue is still unresolved. Afaik there were plans to remove single stepping support from ARM completely. |
Created attachment 33762 [details] [PATCH] Make PTRACE_SINGLESTEP work with user helpers On ARM glibc contains 0x4009b864 <getchar+240>: sub pc, r3, #63 ; 0x3f that jumps to the kernel provided user helper page to access __kernel_cmpxchg at 0xffff0fc0. If I try to PTRACE_SINGLESTEP this instruction the child never stops. Parent keeps wait()ing forever but child effectively escapes the tracing completely and continues executing instructions without notifying the parent. On ARM single stepping is done by adding a breakpoint to possible branch targets of each instruction. I guess when ptrace_set_bpt() tries to add_breakpoint() to this page it just fails? (There's even a comment that says it can fail and that return value is not checked...) Since all user helpers return to LR I think we could teach get_branch_address to treat jumps to user helpers as instructions that branch to lr? The attached patch works for me but I am not sure if it is a good solution.