]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Check for defined __SNR_MOUNT_setattr and __NR_mount_setattr
authorStefan Berger <stefanb@linux.ibm.com>
Mon, 22 Aug 2022 18:11:47 +0000 (14:11 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Mon, 22 Aug 2022 19:27:17 +0000 (15:27 -0400)
Address the following compilation error on Debian:

In file included from /usr/include/seccomp.h:821,
                 from seccomp_profile.c:44:
seccomp_profile.c: In function 'create_seccomp_profile':
seccomp_profile.c:115:9: error: '__NR_mount_setattr' undeclared (first use in this function)
  115 |         SCMP_SYS(mount_setattr),
      |         ^~~~~~~~
seccomp_profile.c:115:9: note: each undeclared identifier is reported only once for each function it appears in
seccomp_profile.c:172:9: error: '__NR_quotactl_fd' undeclared (first use in this function)
  172 |         SCMP_SYS(quotactl_fd),
      |         ^~~~~~~~

We need to do this since they are defined like this:

 #define __SNR_mount_setattr             __NR_mount_setattr
 #define __SNR_quotactl_fd               __NR_quotactl_fd

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/seccomp_profile.c

index 903ee277c7de8faf3f39e326b4092395c0de3487..7299b89d9284911c42f6b941ae23290b2772c60e 100644 (file)
@@ -111,7 +111,7 @@ int create_seccomp_profile(bool cusetpm, unsigned int action)
 #ifdef __SNR_move_mount
         SCMP_SYS(move_mount),
 #endif
-#ifdef __SNR_mount_setattr
+#if defined(__SNR_mount_setattr) && defined(__NR_mount_setattr)
         SCMP_SYS(mount_setattr),
 #endif
         SCMP_SYS(umount2),
@@ -168,7 +168,7 @@ int create_seccomp_profile(bool cusetpm, unsigned int action)
         SCMP_SYS(sethostname),
         SCMP_SYS(setdomainname),
         SCMP_SYS(quotactl),
-#ifdef __SNR_quotactl_fd
+#if defined(__SNR_quotactl_fd) && defined(__NR_quotactl_fd)
         SCMP_SYS(quotactl_fd),
 #endif
         SCMP_SYS(readahead),