]> git.ipfire.org Git - thirdparty/systemd.git/commit
src/basic/missing_syscall: change #ifndef to #if ! (defined && > 0)
authorDan Streetman <ddstreet@canonical.com>
Thu, 25 Jul 2019 11:57:30 +0000 (07:57 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Aug 2019 16:09:47 +0000 (18:09 +0200)
commit59b657296a2fe104f112b91bbf9301724067cc81
tree444df32d6c148668f8a0a18bf27f8431057a25d5
parentb208cbe5b41df010508f2f190dc69bca04421624
src/basic/missing_syscall: change #ifndef to #if ! (defined && > 0)

The #ifndef check used to work for missing __NR_* syscall defines, but
unfortunately libseccomp now redefines missing syscall number to negative
numbers, in their public header file, e.g.:
https://github.com/seccomp/libseccomp/blob/master/include/seccomp.h.in#L801

When systemd is built, since it includes <seccomp.h>, it pulls in the
incorrect negative value for any __NR_* syscall define that's included in
the seccomp.h header (for those syscalls that the kernel headers don't
yet define, e.g. when built with older/stable-distro kernels).  This leads
to bugs like:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1821625

This changes the check so that it can override the negative number that
libseccomp defines, instead of trying to use the negative syscall number.
To avoid gcc warnings (which are failures with meson --werror), this checks
without generating a redefinition gcc warning.

I have no idea why libseccomp decided to define missing syscalls
to negative numbers inside their *public* header file, causing
problems like this.
src/basic/missing_syscall.h