From 9db789b4498d4130450e988757914c03e42b40f5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 19 Jun 2023 18:33:36 -0700
Subject: [PATCH] executor: Include missing linux/falloc.h

Its needed for FALLOC_FL_ZERO_RANGE which needs this header, it works
with glibc because fcntl.h includes this header indirectly, however the
failure comes to fore with musl C library where this header is not
included indirectly by other system headers, therefore include it as
required.

Fixes
In file included from executor/common.h:505:
executor/common_linux.h:5604:16: error: use of undeclared identifier 'FALLOC_FL_ZERO_RANGE'
        fallocate(fd, FALLOC_FL_ZERO_RANGE, 0, SWAP_FILE_SIZE);
                      ^
Upstream-Status: Submitted [https://github.com/google/syzkaller/pull/3974]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 executor/common_linux.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/executor/common_linux.h b/executor/common_linux.h
index d5152e058..9ae3fb159 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -5585,6 +5585,7 @@ static long syz_pkey_set(volatile long pkey, volatile long val)
 #include <sys/stat.h>
 #include <sys/swap.h>
 #include <sys/types.h>
+#include <linux/falloc.h>
 
 #define SWAP_FILE "./swap-file"
 #define SWAP_FILE_SIZE (128 * 1000 * 1000) // 128 MB.
-- 
2.41.0

