-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
systemd seccomp filters cause systemd-timesyncd core dumps on Kernel 6.11 when an app uses eBPF modules #1205
Comments
Hi @XZVB12 , I haven't analyzed nor try to reproduce this issue, but per similar cases we've had in the past, this is usually a bug in the other program (systemd-timesyncd in this case). We used to crash Transmission for example, or even the kernel, because there were some conditions not handled correctly (delayed connections, connections unexpectedly blocked/killed, ...) I'll try to reproduce it, but before that some questions:
On the other hand, @Flat commented on systemd/systemd#34615 (comment):
Could you post the output of Thank you! |
Hi.Yes, this is "regular" Manjaro Linux kernel
I’ll try it later
|
According to systemd-coredump event occurred at 13:25:27
For this time in opensnitch log there are the following entries:
The error I see here: I attached a log file with information where systemd-timesync starts, so you should easily find . Maybe it will help more |
thank you @XZVB12 ! I've managed to reproduce it on manjaro with systemd-timesyncd 256.6 and kernel 6.11.0.6-MANJARO. The problematic ebpf module is opensnitch-dns.o , if you rename it, systemd-timesyncd will stop crashing: I'll try to understand why systemd-timesyncd is crashing and if we can do anything about it. |
we hook 2 libc functions: gethostbyname and getaddrinfo. systemd-timesyncd crashes when a ebpf hook is attached to uretprobe getaddrinfo (just hooking it, even without reading any variable or register). The hooks for gethostbyname or uprobe getaddrinfo work just fine. Here's a bpftrace script that causes systemd-timesyncd to crash, without opensnitch running: (rename it to .bt, and execute it with so in my opinion, even if we're indirectly causing it, the bug is not in our code. This segfault will occur with any software that hooks libc's getaddrinfo uretprobe. |
I'd just like to add that I've also had the same issue happen with python using the archlinux reflector script, https://wiki.archlinux.org/title/Reflector so it does not seem to be solely systemd-timesyncd |
Any idea what might be the reason? At this point, the kernel is 6.11.2 , and the problem still persists and apparently not noticed. Although I initially noticed this bug in the -RC versions of the kernel, I just didn’t report it before the final release |
no idea @XZVB12 , a change in the 6.11.x kernels maybe. I've just tested it on kernel 6.10.11-2-MANJARO and systemd-timesyncd doesn't crash, so maybe some of the changes of uretprobes might be the reason of the crashes: 91bd008d4e2b4962ecb9a10e40c2fb666b0aeb92 |
Sounds like it could be related to this
|
So it’s not a bug now, but a new way of "speeds up" ? |
it could be a bug in the 6.11 kernel (or systemd maybe). let's summarize what's happening:
Workaround 1: rename opensnitchd-dns.o and restart opensnitch ~ $ sudo mv /usr/lib/opensnitchd/ebpf/opensnitch-dns.o /usr/lib/opensnitchd/ebpf/opensnitch-dns.o.bak
~ $ sudo systemctl restart opensnitchd Workaround 2: #1205 (comment)
|
@XZVB12 , even if this is a kernel bug, the process which is crashing is So maybe they should take a look at this problem. They can use the steps above to reproduce it. |
I am pretty sure it is due to the SystemCallFilter option set in the .service file used to launch via systemd. If you remove that line it will not crash. The odd part is it should not be a SIGSEV it should be EPERM or EACCES. Adding uretprobe syscall to the filters does not help either. |
Just a heads up, this is crashing |
Just did a test, and removing the SystemCallFilter fixes both the issues on my machine. Oddly enough, you can also get them running again by reinstalling the glibc package... For some reason the SystemCallFilter doesn't trip if you reinstall glibc then run the systemd services... |
It seems that any distribution with the 6.11 kernel will be affected by this problem
I reopened the discussion and gave links to new information . Perhaps you could also join the discussion, maybe it would be easier to communicate directly. |
This is back again, but this time the boot freezes for 60s when trying to sync, and then Same thing happens on 6.6 LTS, (freezes for one minute) BUT the service does NOT fail, only gets stuck for 60s. After boot:
Works just fine, so this is something at boot time. If you want me to make a new post I can do that, but since this seems to be some kind of regression, I started by posting here. |
The original issue still hasn't been resolved. libseccomp will need a new release with the syscalls added. seccomp/libseccomp#439 once this has been merged and libseccomp updated it should resolve this issue. |
Ah, that is what is happening. I DID try to check seccomp first before posting here with the links referenced (seccomp/libseccomp#438 > seccomp/libseccomp#435) and they looked merged, but clearly there is more judging by the link you provided. Ie, my "research" was sloppy. Thank you for the clarification! |
Include the following information:
To Reproduce
Describe in detail as much as you can what happened.
Steps to reproduce the behavior:
This issue appears on 6.11 kernel and does not affect older version.
A more detailed discussion: systemd/systemd#34615
Removing eBPF modules solves the problem.
The text was updated successfully, but these errors were encountered: