bcc: bpf_probe_read_user returns error (-14) on Android 11, Kernel 4.14, ARM64
Hi folks,
I’m running BCC on Android 11, Kernel 4.14, ARM64 and bpf_probe_read_user returns an error (-14). As a result opensnoop returns an empty filename string.
I’m aware of #2253 and implemented the solution that supposedly should fix the issue (https://lkml.org/lkml/2019/5/2/1100) to no avail.
#3094 is somewhat related and the solution there looks to be similar to the above (i.e. adding bpf_probe_read_user from the later version).
Has anyone encountered something like that or knows how can I get more information about the issue?
Cheers, Vadim
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 23 (3 by maintainers)
Commits related to this issue
- 修改:bpf_probe_read修正 https: //github.com/iovisor/bcc/issues/3175 Change-Id: I1e31fc6d62a32eebfb68f92ec18c362d14439e30 — committed to HorseLuke/aosp_android_common_kernels by invalid-email-address 4 years ago
- kernel: trace: fix the issue in bpf_probe_read(). https://github.com/iovisor/bcc/issues/3175 — committed to LeviMarvin/android_kernel_xiaomi_alioth by LeviMarvin 4 years ago
Hey folks,
I kind of solved it for my specific case with a simple hack which seems to work. Namely, instead of porting over
bpf_probe_read_userI simply expandedbpf_probe_readfunction (fromkernel/trace/bpf_trace.c), so that it looks like this:Explanation of the code above
Since BCC can’t see
bpf_probe_read_[user|kernel]when I port them manually, I tried a different idea. I know that in absence ofbpf_probe_read_[user|kernel]BCC would fall back tobpf_probe_read. So I changedbpf_probe_readso that ifprobe_kernel_readfails try readingunsafe_ptras a user space pointer (i.e. callprobe_user_read).This fixed my issue and now tools like
opensnoopdisplay the path correctly.But the fact that this hack worked tells me, that previously BCC couldn’t “see”
bpf_probe_read_[user|kernel]despite them being available in the kernel. I don’t know if this is something that BCC developers would consider worth fixing so I’m leaving this ticket open for now. Otherwise please feel free to close this ticket. If you have any more questions about the issue or the “fix” I’ll be happy to help.Thanks all who replied to the ticket, it helped me narrow down the issue.