Bug 20412 - PTRACE_SINGLESTEP'ing an instruction that calls user helpers never stops the child on ARM
Summary: PTRACE_SINGLESTEP'ing an instruction that calls user helpers never stops the ...
Status: RESOLVED INVALID
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: ARM (show other bugs)
Hardware: All Linux
: P1 low
Assignee: linux-arm-kernel@lists.arm.linux.org.uk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-16 13:19 UTC by Timo Lindfors
Modified: 2012-08-14 11:21 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
[PATCH] Make PTRACE_SINGLESTEP work with user helpers (1.22 KB, patch)
2010-10-16 13:19 UTC, Timo Lindfors
Details | Diff

Description Timo Lindfors 2010-10-16 13:19:07 UTC
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.
Comment 1 Alan 2012-08-14 11:14:16 UTC
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
Comment 2 Timo Lindfors 2012-08-14 11:21:26 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.