-
Notifications
You must be signed in to change notification settings - Fork 6
uprobe,bpf: Allow to change app registers from uprobe registers #5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
uprobe,bpf: Allow to change app registers from uprobe registers #5968
Conversation
Upstream branch: b13448d |
2b3c471
to
2211108
Compare
Upstream branch: 180a46b |
b17cd82
to
32ca42d
Compare
2211108
to
acca942
Compare
Upstream branch: 6ff4a0f |
32ca42d
to
7c9dd8d
Compare
acca942
to
0821404
Compare
Upstream branch: 3547a61 |
7c9dd8d
to
4b4b4d6
Compare
0821404
to
028d6d4
Compare
Upstream branch: 8cd189e |
4b4b4d6
to
42291ce
Compare
028d6d4
to
0c300ac
Compare
Upstream branch: 815276d |
42291ce
to
89949c7
Compare
0c300ac
to
b38c040
Compare
Upstream branch: 57cb269 |
89949c7
to
b4191ae
Compare
b38c040
to
1a8f119
Compare
Currently uprobe (BPF_PROG_TYPE_KPROBE) program can't write to the context registers data. While this makes sense for kprobe attachments, for uprobe attachment it might make sense to be able to change user space registers to alter application execution. Since uprobe and kprobe programs share the same type (BPF_PROG_TYPE_KPROBE), we can't deny write access to context during the program load. We need to check on it during program attachment to see if it's going to be kprobe or uprobe. Storing the program's write attempt to context and checking on it during the attachment. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
If uprobe handler changes instruction pointer we still execute single step) or emulate the original instruction and increment the (new) ip with its length. This makes the new instruction pointer bogus and application will likely crash on illegal instruction execution. If user decided to take execution elsewhere, it makes little sense to execute the original instruction, so let's skip it. Acked-by: Oleg Nesterov <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Adding test to check we can change common register values through uprobe program. It's x86_64 specific test. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Adding test to check we can change the application execution through instruction pointer change through uprobe program. It's x86_64 specific test. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Adding test to check we can't attach standard kprobe program that writes to the context. It's x86_64 specific test. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Adding test to check we can't attach kprobe multi program that writes to the context. It's x86_64 specific test. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
Upstream branch: 5612ea8 |
b4191ae
to
c4f056d
Compare
Pull request for series with
subject: uprobe,bpf: Allow to change app registers from uprobe registers
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1003090