{{Header}} {{Title|title= Debugging Systemd Seccomp }} {{#seo: |description=Seccomp Issues }}
* [[systemd|systemd]] * [[seccomp|seccomp]]
{{intro| Seccomp Issues }} Depends on architecture. What works on Intel/AMD64 (amd64) might not work on arm64, and vice versa. {{IconSet|h1|1}} Install auditd. {{Install_Package|package= auditd }} {{IconSet|h1|2}} To monitor systemd seccomp issues: {{CodeSelect|code= sudo journalctl _AUDIT_TYPE_NAME=SECCOMP -f }} {{IconSet|h1|3}} Sample issue '''bold''' added.
SECCOMP auid=4294967295 uid=108 gid=118 ses=4294967295 subj==/usr/bin/sdwdate (enforce) pid=9740 comm="sdwdate" exe="/usr/bin/python3.7" sig=31 arch=c0000015 '''syscall=140''' compat=0 ip=0x7fff96cc7df4 code=0x0
{{IconSet|h1|4}} Find out the syscall number. The relevant part of the log output snippet above is syscall=140. The syscall number will very likely be different in your case. {{IconSet|h1|5}} Translate syscall number into syscall name. This can be done with the ausyscall tool. * Note: Replace 140 with the actual syscall number. * [https://manpages.debian.org//ausyscall ausyscall] man page. {{CodeSelect|code= ausyscall 140 }} {{IconSet|h1|6}} Expected output. Sample output. Example:
getpriority
In this example, the name of the syscall is getpriority. In your case, the name of the syscall will likely be different. {{IconSet|h1|7}} Add syscall name to systemd unit file. Once you have the syscall name, add it to the system call whitelist in the systemd unit of the malfunctioning process. Note: Replace sdwdate with the systemd unit name you are debugging. sdwdate example: * {{CodeSelect|code= sudoedit /usr/lib/systemd/system/sdwdate.service && sudo systemctl daemon-reload && sudo systemctl restart sdwdate && sudo systemctl --no-pager --full status sdwdate }} kloak example: * {{CodeSelect|code= sudoedit /usr/lib/systemd/system/kloak.service && sudo systemctl daemon-reload && sudo systemctl restart kloak && sudo systemctl --no-pager --full status kloak }} The SystemCallFilter= value needs to be adjusted. Append the missing syscall name. {{IconSet|h1|8}} Done. See also: [https://github.com/Whonix/kloak/pull/1 Whonix kloak pull request 1] = Other Syscall Number to Name Lookup Methods = Usually not required. The syscall table for your particular machine is defined in a header file. Open {{CodeSelect|inline=true|code= /usr/include/ARCH-linux-gnu/asm/unistd.h }}, replacing ARCH. This should give you a pointer (in the form of a #include statement) to the file containing the syscall table. You may have to "dig" more than one level deep to find it. The correct file will contain a list of numbers and syscall names that looks something like this: {{CodeSelect|code= #define __NR_read 0 #define __NR_write 1 #define __NR_open 2 #define __NR_close 3 #define __NR_stat 4 #define __NR_fstat 5 #define __NR_lstat 6 }} In this case we know that read has syscall number 0, write has syscall number 1, etc. Find the syscall number reported in the journal, and determine its corresponding name from the list. If you cannot find the syscall table on your system, you may need to install linux-libc-dev. There are online syscall tables, such as [https://chromium.googlesource.com/chromiumos/docs/+/master/constants/syscalls.md Chromium OS syscall tables] and [https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html Marcin Juszkiewicz syscall tables]. However, these are not guaranteed to be accurate for your system. It is highly recommended to use the syscall table for your distribution as documented above. = Footnotes = {{Footer}} [[Category:Documentation]]