aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-08-08 17:04:50 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-08 17:04:50 +0200
commit17a0470620d8031c82bff3f45a7688a06bd77fdd (patch)
tree5fded82afb16de5f808857e58363cfd819d2ed3d /executor/common_linux.h
parentd46deef51c0809429c414eea99566b82b6d5fbbf (diff)
executor: manually define struct fsxattr
It should be in <linux/fs.h> but is not there on some distros/arches as expected. Travis build fails with: <stdin>: In function ‘remove_dir’: <stdin>:152:13: error: variable ‘attr’ has initializer but incomplete type <stdin>:152:13: error: excess elements in struct initializer [-Werror] <stdin>:152:13: error: (near initialization for ‘attr’) [-Werror] <stdin>:152:21: error: storage size of ‘attr’ isn’t known <stdin>:153:20: error: ‘FS_IOC_FSSETXATTR’ undeclared (first use in this function) <stdin>:153:20: note: each undeclared identifier is reported only once for each function it appears in <stdin>:152:21: error: unused variable ‘attr’ [-Werror=unused-variable] cc1: all warnings being treated as errors https://travis-ci.org/google/syzkaller/jobs/413574080
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 2a1d14e2b..53684f646 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -1734,10 +1734,22 @@ static int do_sandbox_namespace(void)
#if SYZ_EXECUTOR || SYZ_REPEAT && SYZ_USE_TMP_DIR
#include <dirent.h>
#include <errno.h>
-#include <linux/fs.h>
#include <string.h>
+#include <sys/ioctl.h>
#include <sys/mount.h>
+// This should be in <linux/fs.h> but is not there on some distros/arches as expected.
+struct fsxattr {
+ uint32 fsx_xflags;
+ uint32 fsx_extsize;
+ uint32 fsx_nextents;
+ uint32 fsx_projid;
+ uint32 fsx_cowextsize;
+ char fsx_pad[8];
+};
+
+#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
+
// One does not simply remove a directory.
// There can be mounts, so we need to try to umount.
// Moreover, a mount can be mounted several times, so we need to try to umount in a loop.