-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
'Failed to allocate trace_probe' on Arch Linux kernel 4.15.9-1 #1634
Comments
This may theoretically be connected to anti-Spectre patches in new kernel https://www.phoronix.com/scan.php?page=news_item&px=Linux-4.15-rc8-BPF-Security |
Both For example, in your
And in your kallsyms, you may have
Both the above two functions are in The tool can be improved to exclude these symbols whose address range is in |
Fix issue #1634. When kernel is about to attach a kprobe, the following functions are called: register_kprobe check_kprobe_address_safe kernel_text_address core_kernel_text In core_kernel_text, we have: if (addr >= (unsigned long)_stext && addr < (unsigned long)_etext) return 1; Basically, any address outside of [_stext, _etext] will be rejected. The functions marked as __init are outside [_stext, _etext]. That is why vfs_caches_init_early and vfs_caches_init are rejected by trace_kprobe. Given a regex, this patch avoided attaching these functions if their func addresses are outside [_stext, _etext] range. Signed-off-by: Yonghong Song <[email protected]>
Fix issue #1634. When kernel is about to attach a kprobe, the following functions are called: register_kprobe check_kprobe_address_safe kernel_text_address core_kernel_text In core_kernel_text, we have: if (addr >= (unsigned long)_stext && addr < (unsigned long)_etext) return 1; Basically, any address outside of [_stext, _etext] will be rejected. The functions marked as __init are outside [_stext, _etext]. That is why vfs_caches_init_early and vfs_caches_init are rejected by trace_kprobe. Given a regex, this patch avoided attaching these functions if their func addresses are outside [_stext, _etext] range. Signed-off-by: Yonghong Song <[email protected]>
Tried to run tests with your last patch, @yonghong-song . Most of them still failed, even though dmesg looks better now. Failed tests:
Here's an updated dmesg:
It's also a little bit weird it's arguing about "eth0" even though I have systemd and my ifaces are named like "enp7s0". Some hardcode? |
The
The test run command is
The TEST_WRAPPER is at
In your case, based on my past experience, it is due to two things:
Unfortunately, you need to run individual test to debug this. Could you try this and may submit a patch for documentation with your finding, so it becomes clear what additional configuration steps are required for the test to run? Thanks! |
Okay, so here's the verbose output for test_libbcc:
As far as I understand, it fails to attach probes somewhere deep inside the code. Also, failing regexp at the beginning looks weird. What should I do? |
The parsing error is expected. So it is not an error. The assertion at line 127 indicates that the ruby in your system does not have USDTs.
|
Thanks, I'll research this ruby thing. But I think we're getting further and further from the original question "why attaching kprobe fails". Let's go a little back, so, it doesn't really matter that tests fail. Here's the strace dump from trying to run "trace" program. Any ideas?
|
For your original failure, vfs function related should have been fixed. The md_flush_request may be a kernel config issue and your kernel config may not have CONFIG_BLK_DEV_MD. What is your trace command line for the above kprobe failure? |
I have
... and then I'm calling the trace utility from bcc over this test executable:
|
Your command line is incorrect. It should be |
Nice! So much for informative error messages 🥇 Thanks a lot for clarification! |
The original cannot attaching kprobe issue has been fixed. Let us close this issue. |
Fix issue iovisor#1634. When kernel is about to attach a kprobe, the following functions are called: register_kprobe check_kprobe_address_safe kernel_text_address core_kernel_text In core_kernel_text, we have: if (addr >= (unsigned long)_stext && addr < (unsigned long)_etext) return 1; Basically, any address outside of [_stext, _etext] will be rejected. The functions marked as __init are outside [_stext, _etext]. That is why vfs_caches_init_early and vfs_caches_init are rejected by trace_kprobe. Given a regex, this patch avoided attaching these functions if their func addresses are outside [_stext, _etext] range. Signed-off-by: Yonghong Song <[email protected]>
Fix issue iovisor#1634. When kernel is about to attach a kprobe, the following functions are called: register_kprobe check_kprobe_address_safe kernel_text_address core_kernel_text In core_kernel_text, we have: if (addr >= (unsigned long)_stext && addr < (unsigned long)_etext) return 1; Basically, any address outside of [_stext, _etext] will be rejected. The functions marked as __init are outside [_stext, _etext]. That is why vfs_caches_init_early and vfs_caches_init are rejected by trace_kprobe. Given a regex, this patch avoided attaching these functions if their func addresses are outside [_stext, _etext] range. Signed-off-by: Yonghong Song <[email protected]>
I have Arch Linux and one of the latest stable kernels (just default linux package):
Bcc is installed from AUR using yaourt without any issues. When trying to execute tests or run trace, for example, I'm getting this message:
When checking dmesg, I see this:
Or, when running tests, something like this:
Kernel has all the required params:
I also found there are some parameters that are used by tool like SystemTap (https://wiki.archlinux.org/index.php/SystemTap) and those are not there by default:
Should I recompile my kernel with these now? Or what should I do?
The text was updated successfully, but these errors were encountered: