aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/kfuzztest/testdata/common.h58
-rw-r--r--tools/android/jni/sandbox_test.c52
-rw-r--r--tools/syz-declextract/testdata/cover.c6
-rw-r--r--tools/syz-declextract/testdata/cover.c.info10
-rw-r--r--tools/syz-declextract/testdata/cover.c.json26
-rw-r--r--tools/syz-declextract/testdata/file_operations.c83
-rw-r--r--tools/syz-declextract/testdata/file_operations.c.info36
-rw-r--r--tools/syz-declextract/testdata/file_operations.c.json68
-rw-r--r--tools/syz-declextract/testdata/functions.c41
-rw-r--r--tools/syz-declextract/testdata/functions.c.info2
-rw-r--r--tools/syz-declextract/testdata/functions.c.json42
-rw-r--r--tools/syz-declextract/testdata/include/fs.h9
-rw-r--r--tools/syz-declextract/testdata/include/netlink.h49
-rw-r--r--tools/syz-declextract/testdata/include/syscall.h5
-rw-r--r--tools/syz-declextract/testdata/include/types.h8
-rw-r--r--tools/syz-declextract/testdata/include/uapi/file_operations.h18
-rw-r--r--tools/syz-declextract/testdata/include/uapi/ioctl.h34
-rw-r--r--tools/syz-declextract/testdata/include/uapi/netlink_family.h22
-rw-r--r--tools/syz-declextract/testdata/include/uapi/unused_ioctl.h2
-rw-r--r--tools/syz-declextract/testdata/io_uring.c60
-rw-r--r--tools/syz-declextract/testdata/io_uring.c.info6
-rw-r--r--tools/syz-declextract/testdata/io_uring.c.json26
-rw-r--r--tools/syz-declextract/testdata/netlink.c124
-rw-r--r--tools/syz-declextract/testdata/netlink.c.info6
-rw-r--r--tools/syz-declextract/testdata/netlink.c.json24
-rw-r--r--tools/syz-declextract/testdata/scopes.c10
-rw-r--r--tools/syz-declextract/testdata/scopes.c.info28
-rw-r--r--tools/syz-declextract/testdata/scopes.c.json52
-rw-r--r--tools/syz-declextract/testdata/syscall.c6
-rw-r--r--tools/syz-declextract/testdata/syscall.c.info4
-rw-r--r--tools/syz-declextract/testdata/syscall.c.json6
-rw-r--r--tools/syz-declextract/testdata/types.c72
-rw-r--r--tools/syz-declextract/testdata/types.c.info6
-rw-r--r--tools/syz-declextract/testdata/types.c.json34
-rw-r--r--tools/syz-headerparser/test_headers/th_a.h4
-rw-r--r--tools/syz-headerparser/test_headers/th_b.h10
36 files changed, 578 insertions, 471 deletions
diff --git a/pkg/kfuzztest/testdata/common.h b/pkg/kfuzztest/testdata/common.h
index 29e8b193e..f1c1a0fba 100644
--- a/pkg/kfuzztest/testdata/common.h
+++ b/pkg/kfuzztest/testdata/common.h
@@ -12,8 +12,8 @@
#include <stdint.h>
struct kfuzztest_target {
- const char *name;
- const char *arg_type_name;
+ const char* name;
+ const char* arg_type_name;
uintptr_t write_input_cb;
} __attribute__((aligned(32)));
@@ -28,8 +28,8 @@ enum kfuzztest_constraint_type {
};
struct kfuzztest_constraint {
- const char *input_type;
- const char *field_name;
+ const char* input_type;
+ const char* field_name;
uintptr_t value1;
uintptr_t value2;
enum kfuzztest_constraint_type type;
@@ -42,40 +42,40 @@ enum kfuzztest_annotation_attribute {
};
struct kfuzztest_annotation {
- const char *input_type;
- const char *field_name;
- const char *linked_field_name;
+ const char* input_type;
+ const char* field_name;
+ const char* linked_field_name;
enum kfuzztest_annotation_attribute attrib;
} __attribute__((aligned(32)));
-#define DEFINE_FUZZ_TARGET(test_name, test_arg_type) \
- struct kfuzztest_target __fuzz_test__##test_name \
- __attribute__((section(".kfuzztest_target"), __used__)) = { \
- .name = #test_name, \
- .arg_type_name = #test_arg_type, \
- }; \
- /* Avoid the compiler optimizing out the struct definition. */ \
+#define DEFINE_FUZZ_TARGET(test_name, test_arg_type) \
+ struct kfuzztest_target __fuzz_test__##test_name \
+ __attribute__((section(".kfuzztest_target"), __used__)) = { \
+ .name = #test_name, \
+ .arg_type_name = #test_arg_type, \
+ }; \
+ /* Avoid the compiler optimizing out the struct definition. */ \
static test_arg_type arg;
#define DEFINE_CONSTRAINT(arg_type, field, val1, val2, tpe) \
static struct kfuzztest_constraint __constraint_##arg_type##_##field \
- __attribute__((section(".kfuzztest_constraint"), \
- __used__)) = { \
- .input_type = "struct " #arg_type, \
- .field_name = #field, \
- .value1 = (uintptr_t)val1, \
- .value2 = (uintptr_t)val2, \
- .type = tpe, \
- }
+ __attribute__((section(".kfuzztest_constraint"), \
+ __used__)) = { \
+ .input_type = "struct " #arg_type, \
+ .field_name = #field, \
+ .value1 = (uintptr_t)val1, \
+ .value2 = (uintptr_t)val2, \
+ .type = tpe, \
+ }
#define DEFINE_ANNOTATION(arg_type, field, linked_field, attribute) \
static struct kfuzztest_annotation __annotation_##arg_type##_##field \
- __attribute__((section(".kfuzztest_annotation"), \
- __used__)) = { \
- .input_type = "struct " #arg_type, \
- .field_name = #field, \
- .linked_field_name = #linked_field, \
- .attrib = attribute, \
- }
+ __attribute__((section(".kfuzztest_annotation"), \
+ __used__)) = { \
+ .input_type = "struct " #arg_type, \
+ .field_name = #field, \
+ .linked_field_name = #linked_field, \
+ .attrib = attribute, \
+ }
#endif /* COMMON_H */
diff --git a/tools/android/jni/sandbox_test.c b/tools/android/jni/sandbox_test.c
index 467ba3313..723e52803 100644
--- a/tools/android/jni/sandbox_test.c
+++ b/tools/android/jni/sandbox_test.c
@@ -1,43 +1,55 @@
#define GOOS_linux 1
#define SYZ_SANDBOX_ANDROID_UNTRUSTED_APP 1
#define SYZ_USE_TMP_DIR 1
-#define fail(...) do { dprintf(2, __VA_ARGS__); dprintf(2, "\n"); perror("errno"); exit(1); } while(0)
-#define error(...) do { dprintf(2, __VA_ARGS__); } while(0)
-#define debug(...) do { dprintf(2, __VA_ARGS__); } while(0)
+#define fail(...) \
+ do { \
+ dprintf(2, __VA_ARGS__); \
+ dprintf(2, "\n"); \
+ perror("errno"); \
+ exit(1); \
+ } while (0)
+#define error(...) \
+ do { \
+ dprintf(2, __VA_ARGS__); \
+ } while (0)
+#define debug(...) \
+ do { \
+ dprintf(2, __VA_ARGS__); \
+ } while (0)
#include <stdlib.h>
#include <string.h>
void doexit(int status)
{
- exit(status);
+ exit(status);
}
-static void loop() {
- exit(system("id"));
+static void loop()
+{
+ exit(system("id"));
}
static void use_temporary_dir(void)
{
#if SYZ_SANDBOX_ANDROID_UNTRUSTED_APP
- char tmpdir_template[] = "/data/data/syzkaller/syzkaller.XXXXXX";
+ char tmpdir_template[] = "/data/data/syzkaller/syzkaller.XXXXXX";
#else
- char tmpdir_template[] = "./syzkaller.XXXXXX";
+ char tmpdir_template[] = "./syzkaller.XXXXXX";
#endif
- char* tmpdir = mkdtemp(tmpdir_template);
- if (!tmpdir)
- fail("failed to mkdtemp");
- if (chmod(tmpdir, 0777))
- fail("failed to chmod");
- if (chdir(tmpdir))
- fail("failed to chdir");
+ char* tmpdir = mkdtemp(tmpdir_template);
+ if (!tmpdir)
+ fail("failed to mkdtemp");
+ if (chmod(tmpdir, 0777))
+ fail("failed to chmod");
+ if (chdir(tmpdir))
+ fail("failed to chdir");
}
-
-
#include "executor/common_linux.h"
-int main() {
- use_temporary_dir();
- do_sandbox_android_untrusted_app();
+int main()
+{
+ use_temporary_dir();
+ do_sandbox_android_untrusted_app();
}
diff --git a/tools/syz-declextract/testdata/cover.c b/tools/syz-declextract/testdata/cover.c
index b692c3557..4b4836bfe 100644
--- a/tools/syz-declextract/testdata/cover.c
+++ b/tools/syz-declextract/testdata/cover.c
@@ -8,7 +8,8 @@
#define COVER_IOCTL3 3
#define COVER_IOCTL4 4
-static void cover_helper(int cmd) {
+static void cover_helper(int cmd)
+{
int tmp = 0;
tmp++;
switch (cmd) {
@@ -20,7 +21,8 @@ static void cover_helper(int cmd) {
}
}
-SYSCALL_DEFINE1(cover, int cmd) {
+SYSCALL_DEFINE1(cover, int cmd)
+{
int tmp = 0;
tmp++;
switch (cmd) {
diff --git a/tools/syz-declextract/testdata/cover.c.info b/tools/syz-declextract/testdata/cover.c.info
index 32bb62210..6b0b9de45 100644
--- a/tools/syz-declextract/testdata/cover.c.info
+++ b/tools/syz-declextract/testdata/cover.c.info
@@ -1,5 +1,5 @@
-SYSCALL cover func:__do_sys_cover loc:22 coverage:75 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
-SYSCALL cover$COVER_IOCTL1 func:__do_sys_cover loc:7 coverage:100 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
-SYSCALL cover$COVER_IOCTL2 func:__do_sys_cover loc:7 coverage:67 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
-SYSCALL cover$COVER_IOCTL3 func:__do_sys_cover loc:15 coverage:100 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
-SYSCALL cover$COVER_IOCTL4 func:__do_sys_cover loc:16 coverage:80 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
+SYSCALL cover func:__do_sys_cover loc:24 coverage:75 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
+SYSCALL cover$COVER_IOCTL1 func:__do_sys_cover loc:8 coverage:67 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
+SYSCALL cover$COVER_IOCTL2 func:__do_sys_cover loc:8 coverage:100 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
+SYSCALL cover$COVER_IOCTL3 func:__do_sys_cover loc:17 coverage:84 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
+SYSCALL cover$COVER_IOCTL4 func:__do_sys_cover loc:18 coverage:100 access:unknown manual_desc:false auto_desc:true file:cover.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/cover.c.json b/tools/syz-declextract/testdata/cover.c.json
index c34bc0a20..91aef2ca5 100644
--- a/tools/syz-declextract/testdata/cover.c.json
+++ b/tools/syz-declextract/testdata/cover.c.json
@@ -3,8 +3,8 @@
{
"name": "__do_sys_cover",
"file": "cover.c",
- "start_line": 23,
- "end_line": 37,
+ "start_line": 24,
+ "end_line": 39,
"scopes": [
{
"arg": -1,
@@ -28,16 +28,16 @@
"values": [
"COVER_IOCTL1"
],
- "start_line": 27,
- "end_line": 29
+ "start_line": 29,
+ "end_line": 31
},
{
"arg": 0,
"values": [
"COVER_IOCTL2"
],
- "start_line": 29,
- "end_line": 31
+ "start_line": 31,
+ "end_line": 33
},
{
"arg": 0,
@@ -45,8 +45,8 @@
"COVER_IOCTL3",
"COVER_IOCTL4"
],
- "start_line": 31,
- "end_line": 35,
+ "start_line": 33,
+ "end_line": 37,
"calls": [
"cover_helper"
],
@@ -73,7 +73,7 @@
"name": "cover_helper",
"file": "cover.c",
"start_line": 11,
- "end_line": 21,
+ "end_line": 22,
"is_static": true,
"scopes": [
{
@@ -84,16 +84,16 @@
"values": [
"COVER_IOCTL3"
],
- "start_line": 15,
- "end_line": 17
+ "start_line": 16,
+ "end_line": 18
},
{
"arg": 0,
"values": [
"COVER_IOCTL4"
],
- "start_line": 17,
- "end_line": 20
+ "start_line": 18,
+ "end_line": 21
}
]
}
diff --git a/tools/syz-declextract/testdata/file_operations.c b/tools/syz-declextract/testdata/file_operations.c
index a27fa55f5..199467776 100644
--- a/tools/syz-declextract/testdata/file_operations.c
+++ b/tools/syz-declextract/testdata/file_operations.c
@@ -1,8 +1,8 @@
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-#include "include/fs.h"
#include "include/uapi/file_operations.h"
+#include "include/fs.h"
#include "include/uapi/unused_ioctl.h"
enum {
@@ -13,13 +13,24 @@ enum {
config_foo
};
-static void foo_open() {}
-static void foo_read() {}
-static void foo_write() {}
-static void foo_mmap() {}
-static void foo_mmap2() {}
+static void foo_open()
+{
+}
+static void foo_read()
+{
+}
+static void foo_write()
+{
+}
+static void foo_mmap()
+{
+}
+static void foo_mmap2()
+{
+}
-static void foo_ioctl2(unsigned int cmd, unsigned long arg) {
+static void foo_ioctl2(unsigned int cmd, unsigned long arg)
+{
switch (cmd) {
case FOO_IOCTL6:
case FOO_IOCTL7:
@@ -27,7 +38,8 @@ static void foo_ioctl2(unsigned int cmd, unsigned long arg) {
}
}
-static void foo_ioctl(void* file, unsigned int cmd, unsigned long arg) {
+static void foo_ioctl(void* file, unsigned int cmd, unsigned long arg)
+{
switch (cmd) {
case FOO_IOCTL1:
case FOO_IOCTL2:
@@ -42,35 +54,44 @@ static void foo_ioctl(void* file, unsigned int cmd, unsigned long arg) {
}
const struct file_operations foo = {
- .open = foo_open,
- .read = foo_read,
- .write = foo_write,
- .unlocked_ioctl = foo_ioctl,
- // Such code happens after macro expansion,
- // we want to extract the first function name.
- .mmap = ((config_foo) ? foo_mmap : foo_mmap2),
+ .open = foo_open,
+ .read = foo_read,
+ .write = foo_write,
+ .unlocked_ioctl = foo_ioctl,
+ // Such code happens after macro expansion,
+ // we want to extract the first function name.
+ .mmap = ((config_foo) ? foo_mmap : foo_mmap2),
};
-static void proc_open() {}
-static void proc_read() {}
-static void proc_write() {}
-static void proc_ioctl(void* file, unsigned int cmd, unsigned long arg) {}
+static void proc_open()
+{
+}
+static void proc_read()
+{
+}
+static void proc_write()
+{
+}
+static void proc_ioctl(void* file, unsigned int cmd, unsigned long arg)
+{
+}
const struct file_operations proc_ops[] = {
- {
- .open = proc_open,
- .read_iter = proc_read,
- .write_iter = proc_write,
- },
- {
- .open = proc_open,
- .unlocked_ioctl = proc_ioctl,
- },
+ {
+ .open = proc_open,
+ .read_iter = proc_read,
+ .write_iter = proc_write,
+ },
+ {
+ .open = proc_open,
+ .unlocked_ioctl = proc_ioctl,
+ },
};
-#define UNUSED_IOCTL2 _IO('c', 2)
+#define UNUSED_IOCTL2 _IO('c', 2)
-static void unused_ioctl(void* file, unsigned int cmd, unsigned long arg) {
+static void unused_ioctl(void* file, unsigned int cmd, unsigned long arg)
+{
switch (cmd) {
case UNUSED_IOCTL1:
case UNUSED_IOCTL2:
@@ -78,5 +99,5 @@ static void unused_ioctl(void* file, unsigned int cmd, unsigned long arg) {
}
const struct file_operations unused = {
- .unlocked_ioctl = unused_ioctl,
+ .unlocked_ioctl = unused_ioctl,
};
diff --git a/tools/syz-declextract/testdata/file_operations.c.info b/tools/syz-declextract/testdata/file_operations.c.info
index 809bf7338..96866560e 100644
--- a/tools/syz-declextract/testdata/file_operations.c.info
+++ b/tools/syz-declextract/testdata/file_operations.c.info
@@ -1,18 +1,18 @@
-FILEOP foo_mmap func:foo_mmap loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
-FILEOP foo_read func:foo_read loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
-FILEOP foo_write func:foo_write loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
-FILEOP proc_read func:proc_read loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
-FILEOP proc_write func:proc_write loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL1 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL10 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL11 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL12 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL2 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL3 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL4 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL5 func:foo_ioctl loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL6 func:foo_ioctl loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL FOO_IOCTL7 func:foo_ioctl loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
-IOCTL UNUSED_IOCTL1 func:unused_ioctl loc:4 coverage:0 access:unknown manual_desc:false auto_desc:false file:file_operations.c subsystem:kernel
-IOCTL UNUSED_IOCTL2 func:unused_ioctl loc:4 coverage:0 access:unknown manual_desc:false auto_desc:false file:file_operations.c subsystem:kernel
-IOCTL proc_ioctl func:proc_ioctl loc:0 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
+FILEOP foo_mmap func:foo_mmap loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
+FILEOP foo_read func:foo_read loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
+FILEOP foo_write func:foo_write loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:true file:file_operations.c subsystem:kernel
+FILEOP proc_read func:proc_read loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
+FILEOP proc_write func:proc_write loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL1 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL10 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL11 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL12 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL2 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL3 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL4 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL5 func:foo_ioctl loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL6 func:foo_ioctl loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL FOO_IOCTL7 func:foo_ioctl loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:file_operations.c subsystem:kernel
+IOCTL UNUSED_IOCTL1 func:unused_ioctl loc:5 coverage:0 access:unknown manual_desc:false auto_desc:false file:file_operations.c subsystem:kernel
+IOCTL UNUSED_IOCTL2 func:unused_ioctl loc:5 coverage:0 access:unknown manual_desc:false auto_desc:false file:file_operations.c subsystem:kernel
+IOCTL proc_ioctl func:proc_ioctl loc:1 coverage:0 access:unknown manual_desc:unknown auto_desc:false file:file_operations.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/file_operations.c.json b/tools/syz-declextract/testdata/file_operations.c.json
index a63a5f2fc..8a0ca7687 100644
--- a/tools/syz-declextract/testdata/file_operations.c.json
+++ b/tools/syz-declextract/testdata/file_operations.c.json
@@ -3,8 +3,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
- "start_line": 18,
- "end_line": 19,
+ "start_line": 19,
+ "end_line": 21,
"is_static": true,
"scopes": [
{
@@ -16,7 +16,7 @@
"name": "alloc_fd",
"file": "include/fs.h",
"start_line": 14,
- "end_line": 16,
+ "end_line": 17,
"is_static": true,
"scopes": [
{
@@ -27,8 +27,8 @@
{
"name": "foo_ioctl",
"file": "file_operations.c",
- "start_line": 30,
- "end_line": 42,
+ "start_line": 41,
+ "end_line": 54,
"is_static": true,
"scopes": [
{
@@ -79,16 +79,16 @@
"FOO_IOCTL11",
"FOO_IOCTL12"
],
- "start_line": 32,
- "end_line": 40
+ "start_line": 44,
+ "end_line": 52
}
]
},
{
"name": "foo_ioctl2",
"file": "file_operations.c",
- "start_line": 22,
- "end_line": 28,
+ "start_line": 32,
+ "end_line": 39,
"is_static": true,
"scopes": [
{
@@ -100,16 +100,16 @@
"FOO_IOCTL6",
"FOO_IOCTL7"
],
- "start_line": 24,
- "end_line": 27
+ "start_line": 35,
+ "end_line": 38
}
]
},
{
"name": "foo_mmap",
"file": "file_operations.c",
- "start_line": 19,
- "end_line": 19,
+ "start_line": 25,
+ "end_line": 27,
"is_static": true,
"scopes": [
{
@@ -120,8 +120,8 @@
{
"name": "foo_mmap2",
"file": "file_operations.c",
- "start_line": 20,
- "end_line": 20,
+ "start_line": 28,
+ "end_line": 30,
"is_static": true,
"scopes": [
{
@@ -133,7 +133,7 @@
"name": "foo_open",
"file": "file_operations.c",
"start_line": 16,
- "end_line": 16,
+ "end_line": 18,
"is_static": true,
"scopes": [
{
@@ -144,8 +144,8 @@
{
"name": "foo_read",
"file": "file_operations.c",
- "start_line": 17,
- "end_line": 17,
+ "start_line": 19,
+ "end_line": 21,
"is_static": true,
"scopes": [
{
@@ -156,8 +156,8 @@
{
"name": "foo_write",
"file": "file_operations.c",
- "start_line": 18,
- "end_line": 18,
+ "start_line": 22,
+ "end_line": 24,
"is_static": true,
"scopes": [
{
@@ -168,8 +168,8 @@
{
"name": "from_kuid",
"file": "include/fs.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 23,
+ "end_line": 26,
"is_static": true,
"scopes": [
{
@@ -180,8 +180,8 @@
{
"name": "proc_ioctl",
"file": "file_operations.c",
- "start_line": 57,
- "end_line": 57,
+ "start_line": 75,
+ "end_line": 77,
"is_static": true,
"scopes": [
{
@@ -192,8 +192,8 @@
{
"name": "proc_open",
"file": "file_operations.c",
- "start_line": 54,
- "end_line": 54,
+ "start_line": 66,
+ "end_line": 68,
"is_static": true,
"scopes": [
{
@@ -204,8 +204,8 @@
{
"name": "proc_read",
"file": "file_operations.c",
- "start_line": 55,
- "end_line": 55,
+ "start_line": 69,
+ "end_line": 71,
"is_static": true,
"scopes": [
{
@@ -216,8 +216,8 @@
{
"name": "proc_write",
"file": "file_operations.c",
- "start_line": 56,
- "end_line": 56,
+ "start_line": 72,
+ "end_line": 74,
"is_static": true,
"scopes": [
{
@@ -228,8 +228,8 @@
{
"name": "unused_ioctl",
"file": "file_operations.c",
- "start_line": 73,
- "end_line": 78,
+ "start_line": 93,
+ "end_line": 99,
"is_static": true,
"scopes": [
{
@@ -241,8 +241,8 @@
"UNUSED_IOCTL1",
"UNUSED_IOCTL2"
],
- "start_line": 75,
- "end_line": 77
+ "start_line": 96,
+ "end_line": 98
}
]
}
diff --git a/tools/syz-declextract/testdata/functions.c b/tools/syz-declextract/testdata/functions.c
index 30e544702..0ae312d44 100644
--- a/tools/syz-declextract/testdata/functions.c
+++ b/tools/syz-declextract/testdata/functions.c
@@ -2,17 +2,20 @@
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
#include "include/fs.h"
-#include "include/types.h"
#include "include/syscall.h"
+#include "include/types.h"
-static void func_foo() {
+static void func_foo()
+{
}
-static void func_bar() {
+static void func_bar()
+{
func_foo();
}
-int func_baz(int f) {
+int func_baz(int f)
+{
func_foo();
if (f)
func_bar();
@@ -23,30 +26,34 @@ int func_baz(int f) {
return alloc_fd();
}
-int func_qux() {
+int func_qux()
+{
int fd = alloc_fd();
return fd;
}
-SYSCALL_DEFINE1(functions, long x) {
+SYSCALL_DEFINE1(functions, long x)
+{
__fget_light(x);
return func_baz(1);
}
struct Typed {
- int a;
- int b;
- int c;
+ int a;
+ int b;
+ int c;
};
-int typing1(int a, int b) {
- return a;
+int typing1(int a, int b)
+{
+ return a;
}
-int typing(struct Typed* t1, int i) {
- struct Typed t2;
- t2.a = t1->b;
- int l = typing1(i, t2.a);
- t1->c = l;
- return l;
+int typing(struct Typed* t1, int i)
+{
+ struct Typed t2;
+ t2.a = t1->b;
+ int l = typing1(i, t2.a);
+ t1->c = l;
+ return l;
}
diff --git a/tools/syz-declextract/testdata/functions.c.info b/tools/syz-declextract/testdata/functions.c.info
index 5659a86ce..3675ed9e1 100644
--- a/tools/syz-declextract/testdata/functions.c.info
+++ b/tools/syz-declextract/testdata/functions.c.info
@@ -1 +1 @@
-SYSCALL functions func:__do_sys_functions loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:functions.c subsystem:kernel
+SYSCALL functions func:__do_sys_functions loc:20 coverage:0 access:unknown manual_desc:false auto_desc:true file:functions.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/functions.c.json b/tools/syz-declextract/testdata/functions.c.json
index b4766e73e..0ac5e2d0d 100644
--- a/tools/syz-declextract/testdata/functions.c.json
+++ b/tools/syz-declextract/testdata/functions.c.json
@@ -3,8 +3,8 @@
{
"name": "__do_sys_functions",
"file": "functions.c",
- "start_line": 31,
- "end_line": 34,
+ "start_line": 35,
+ "end_line": 39,
"scopes": [
{
"arg": -1,
@@ -46,8 +46,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
- "start_line": 18,
- "end_line": 19,
+ "start_line": 19,
+ "end_line": 21,
"is_static": true,
"scopes": [
{
@@ -59,7 +59,7 @@
"name": "alloc_fd",
"file": "include/fs.h",
"start_line": 14,
- "end_line": 16,
+ "end_line": 17,
"is_static": true,
"scopes": [
{
@@ -71,7 +71,7 @@
"name": "atomic_load32",
"file": "include/types.h",
"start_line": 17,
- "end_line": 19,
+ "end_line": 20,
"is_static": true,
"scopes": [
{
@@ -82,8 +82,8 @@
{
"name": "atomic_load64",
"file": "include/types.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 22,
+ "end_line": 25,
"scopes": [
{
"arg": -1
@@ -93,8 +93,8 @@
{
"name": "from_kuid",
"file": "include/fs.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 23,
+ "end_line": 26,
"is_static": true,
"scopes": [
{
@@ -105,8 +105,8 @@
{
"name": "func_bar",
"file": "functions.c",
- "start_line": 11,
- "end_line": 13,
+ "start_line": 12,
+ "end_line": 15,
"is_static": true,
"scopes": [
{
@@ -120,8 +120,8 @@
{
"name": "func_baz",
"file": "functions.c",
- "start_line": 15,
- "end_line": 24,
+ "start_line": 17,
+ "end_line": 27,
"scopes": [
{
"arg": -1,
@@ -165,7 +165,7 @@
"name": "func_foo",
"file": "functions.c",
"start_line": 8,
- "end_line": 9,
+ "end_line": 10,
"is_static": true,
"scopes": [
{
@@ -176,8 +176,8 @@
{
"name": "func_qux",
"file": "functions.c",
- "start_line": 26,
- "end_line": 29,
+ "start_line": 29,
+ "end_line": 33,
"scopes": [
{
"arg": -1,
@@ -216,8 +216,8 @@
{
"name": "typing",
"file": "functions.c",
- "start_line": 46,
- "end_line": 52,
+ "start_line": 52,
+ "end_line": 59,
"scopes": [
{
"arg": -1,
@@ -311,8 +311,8 @@
{
"name": "typing1",
"file": "functions.c",
- "start_line": 42,
- "end_line": 44,
+ "start_line": 47,
+ "end_line": 50,
"scopes": [
{
"arg": -1,
diff --git a/tools/syz-declextract/testdata/include/fs.h b/tools/syz-declextract/testdata/include/fs.h
index b4eba0bd7..0d0875b65 100644
--- a/tools/syz-declextract/testdata/include/fs.h
+++ b/tools/syz-declextract/testdata/include/fs.h
@@ -11,13 +11,16 @@ struct file_operations {
void (*mmap)(void);
};
-static int alloc_fd() {
+static int alloc_fd()
+{
return 1;
}
-static void __fget_light(int fd) {
+static void __fget_light(int fd)
+{
}
-static int from_kuid() {
+static int from_kuid()
+{
return 1;
}
diff --git a/tools/syz-declextract/testdata/include/netlink.h b/tools/syz-declextract/testdata/include/netlink.h
index ee8091290..e40ec994d 100644
--- a/tools/syz-declextract/testdata/include/netlink.h
+++ b/tools/syz-declextract/testdata/include/netlink.h
@@ -30,34 +30,36 @@ enum {
};
struct nla_policy {
- u8 type;
- u8 validation_type;
- u16 len;
+ u8 type;
+ u8 validation_type;
+ u16 len;
union {
const u32 bitfield32_valid;
const u32 mask;
- const struct nla_policy *nested_policy;
- struct { s16 min, max; };
+ const struct nla_policy* nested_policy;
+ struct {
+ s16 min, max;
+ };
};
};
-#define NLA_POLICY_NESTED(policy) { .type = NLA_NESTED, .nested_policy = policy, .len = sizeof(policy)/sizeof(policy[0]) }
+#define NLA_POLICY_NESTED(policy) {.type = NLA_NESTED, .nested_policy = policy, .len = sizeof(policy) / sizeof(policy[0])}
#define GENL_ADMIN_PERM 0x01
#define GENL_UNS_ADMIN_PERM 0x10
struct genl_ops {
- u8 cmd;
- u8 flags;
- const struct nla_policy* policy;
- void (*doit)(void);
- void (*dumpit)(void);
+ u8 cmd;
+ u8 flags;
+ const struct nla_policy* policy;
+ void (*doit)(void);
+ void (*dumpit)(void);
};
struct genl_split_ops {
- u8 cmd;
- u8 flags;
- const struct nla_policy *policy;
+ u8 cmd;
+ u8 flags;
+ const struct nla_policy* policy;
union {
struct {
void (*pre_doit)(void);
@@ -72,15 +74,16 @@ struct genl_split_ops {
};
};
-struct genl_small_ops {};
+struct genl_small_ops {
+};
struct genl_family {
- char name[64];
- u8 n_ops;
- u8 n_small_ops;
- u8 n_split_ops;
- const struct nla_policy* policy;
- const struct genl_ops* ops;
- const struct genl_small_ops* mall_ops;
- const struct genl_split_ops* split_ops;
+ char name[64];
+ u8 n_ops;
+ u8 n_small_ops;
+ u8 n_split_ops;
+ const struct nla_policy* policy;
+ const struct genl_ops* ops;
+ const struct genl_small_ops* mall_ops;
+ const struct genl_split_ops* split_ops;
};
diff --git a/tools/syz-declextract/testdata/include/syscall.h b/tools/syz-declextract/testdata/include/syscall.h
index 601480cb4..a377ab7d6 100644
--- a/tools/syz-declextract/testdata/include/syscall.h
+++ b/tools/syz-declextract/testdata/include/syscall.h
@@ -3,5 +3,6 @@
#define SYSCALL_DEFINE1(NAME, ...) SYSCALL_DEFINEx(1, NAME, __VA_ARGS__)
#define SYSCALL_DEFINE2(NAME, ...) SYSCALL_DEFINEx(2, NAME, __VA_ARGS__)
-#define SYSCALL_DEFINEx(NARGS, NAME, ...) long __do_sys_##NAME(__VA_ARGS__); \
-long __do_sys_##NAME(__VA_ARGS__)
+#define SYSCALL_DEFINEx(NARGS, NAME, ...) \
+ long __do_sys_##NAME(__VA_ARGS__); \
+ long __do_sys_##NAME(__VA_ARGS__)
diff --git a/tools/syz-declextract/testdata/include/types.h b/tools/syz-declextract/testdata/include/types.h
index 286d29089..03bebb953 100644
--- a/tools/syz-declextract/testdata/include/types.h
+++ b/tools/syz-declextract/testdata/include/types.h
@@ -12,12 +12,14 @@ typedef unsigned long long u64;
#define __user __attribute__((btf_type_tag("user")))
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-static inline u32 atomic_load32(u32* p) {
+static inline u32 atomic_load32(u32* p)
+{
return __atomic_load_n(p, __ATOMIC_RELAXED);
}
-inline u64 atomic_load64(u64* p) {
+inline u64 atomic_load64(u64* p)
+{
return __atomic_load_n(p, __ATOMIC_RELAXED);
}
diff --git a/tools/syz-declextract/testdata/include/uapi/file_operations.h b/tools/syz-declextract/testdata/include/uapi/file_operations.h
index a4fa3a21e..c874415d3 100644
--- a/tools/syz-declextract/testdata/include/uapi/file_operations.h
+++ b/tools/syz-declextract/testdata/include/uapi/file_operations.h
@@ -3,15 +3,15 @@
#include "ioctl.h"
-#define FOO_IOCTL1 _IO('c', 1)
-#define FOO_IOCTL2 _IOR('c', 2, int)
-#define FOO_IOCTL3 _IOR('c', 3, struct foo_ioctl_arg)
-#define FOO_IOCTL4 _IOW('c', 4, struct foo_ioctl_arg)
-#define FOO_IOCTL5 _IOWR('c', 5, struct foo_ioctl_arg)
-#define FOO_IOCTL6 _IO('c', 6)
-#define FOO_IOCTL7 _IO('c', 7)
-#define FOO_IOCTL8 _IO('c', 8)
-#define FOO_IOCTL9 _IO('c', 9)
+#define FOO_IOCTL1 _IO('c', 1)
+#define FOO_IOCTL2 _IOR('c', 2, int)
+#define FOO_IOCTL3 _IOR('c', 3, struct foo_ioctl_arg)
+#define FOO_IOCTL4 _IOW('c', 4, struct foo_ioctl_arg)
+#define FOO_IOCTL5 _IOWR('c', 5, struct foo_ioctl_arg)
+#define FOO_IOCTL6 _IO('c', 6)
+#define FOO_IOCTL7 _IO('c', 7)
+#define FOO_IOCTL8 _IO('c', 8)
+#define FOO_IOCTL9 _IO('c', 9)
enum {
FOO_IOCTL10 = _IOR('c', 10, int),
diff --git a/tools/syz-declextract/testdata/include/uapi/ioctl.h b/tools/syz-declextract/testdata/include/uapi/ioctl.h
index fae14a74e..6c0b01bfe 100644
--- a/tools/syz-declextract/testdata/include/uapi/ioctl.h
+++ b/tools/syz-declextract/testdata/include/uapi/ioctl.h
@@ -1,24 +1,24 @@
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-#define _IOC_NONE 0U
-#define _IOC_WRITE 1U
-#define _IOC_READ 2U
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
-#define _IOC_NRBITS 8
-#define _IOC_TYPEBITS 8
-#define _IOC_SIZEBITS 14
-#define _IOC_DIRBITS 2
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
-#define _IOC_NRSHIFT 0
-#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
-#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
-#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
-#define _IOC(dir, type, nr, size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \
- ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
+#define _IOC(dir, type, nr, size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
-#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
-#define _IOR(type, nr, arg) _IOC(_IOC_READ, (type), (nr), (sizeof(arg)))
-#define _IOW(type, nr, arg) _IOC(_IOC_WRITE, (type), (nr), (sizeof(arg)))
-#define _IOWR(type, nr, arg) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (sizeof(arg)))
+#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
+#define _IOR(type, nr, arg) _IOC(_IOC_READ, (type), (nr), (sizeof(arg)))
+#define _IOW(type, nr, arg) _IOC(_IOC_WRITE, (type), (nr), (sizeof(arg)))
+#define _IOWR(type, nr, arg) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (sizeof(arg)))
diff --git a/tools/syz-declextract/testdata/include/uapi/netlink_family.h b/tools/syz-declextract/testdata/include/uapi/netlink_family.h
index ffaf66bf7..11a5dee8f 100644
--- a/tools/syz-declextract/testdata/include/uapi/netlink_family.h
+++ b/tools/syz-declextract/testdata/include/uapi/netlink_family.h
@@ -4,24 +4,24 @@
// Description of some hypothetic netlink family.
enum netlink_foo_cmds {
- NETLINK_FOO_CMD_FOO,
- NETLINK_FOO_CMD_BAR,
+ NETLINK_FOO_CMD_FOO,
+ NETLINK_FOO_CMD_BAR,
};
enum netlink_foo_attrs {
- NETLINK_FOO_ATTR1,
- NETLINK_FOO_ATTR2,
- NETLINK_FOO_ATTR3 = NETLINK_FOO_ATTR2 + 3, // make them non-dense
- NETLINK_FOO_ATTR4,
- NETLINK_FOO_ATTR5,
- NETLINK_FOO_ATTR6,
- NETLINK_FOO_ATTR7,
+ NETLINK_FOO_ATTR1,
+ NETLINK_FOO_ATTR2,
+ NETLINK_FOO_ATTR3 = NETLINK_FOO_ATTR2 + 3, // make them non-dense
+ NETLINK_FOO_ATTR4,
+ NETLINK_FOO_ATTR5,
+ NETLINK_FOO_ATTR6,
+ NETLINK_FOO_ATTR7,
};
struct netlink_foo_struct1 {
- int a, b, c;
+ int a, b, c;
};
typedef struct {
- double a, b, c;
+ double a, b, c;
} netlink_foo_struct2;
diff --git a/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h b/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h
index 6c3dbb036..b8176ffdc 100644
--- a/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h
+++ b/tools/syz-declextract/testdata/include/uapi/unused_ioctl.h
@@ -3,4 +3,4 @@
#include "ioctl.h"
-#define UNUSED_IOCTL1 _IO('c', 1)
+#define UNUSED_IOCTL1 _IO('c', 1)
diff --git a/tools/syz-declextract/testdata/io_uring.c b/tools/syz-declextract/testdata/io_uring.c
index 20f85f0e5..26ac49790 100644
--- a/tools/syz-declextract/testdata/io_uring.c
+++ b/tools/syz-declextract/testdata/io_uring.c
@@ -8,29 +8,43 @@ struct io_issue_def {
void (*issue)(void);
};
-void io_eopnotsupp_prep() {}
-void io_nop_prep() {}
-void io_nop() {}
-void io_readv_prep() {}
-void io_read() {}
-void io_writev_prep() {}
-void io_write() {}
+void io_eopnotsupp_prep()
+{
+}
+void io_nop_prep()
+{
+}
+void io_nop()
+{
+}
+void io_readv_prep()
+{
+}
+void io_read()
+{
+}
+void io_writev_prep()
+{
+}
+void io_write()
+{
+}
const struct io_issue_def ops[] = {
- [IORING_OP_NOP] = {
- .prep = io_nop_prep,
- .issue = io_nop,
- },
- [IORING_OP_READV] = {
- .prep = io_readv_prep,
- .issue = io_read,
- },
- [IORING_OP_WRITEV] = {
- .prep = io_writev_prep,
- .issue = io_write,
- },
- [IORING_OP_NOT_SUPPORTED] = {
- .prep = io_eopnotsupp_prep,
- .issue = io_write,
- },
+ [IORING_OP_NOP] = {
+ .prep = io_nop_prep,
+ .issue = io_nop,
+ },
+ [IORING_OP_READV] = {
+ .prep = io_readv_prep,
+ .issue = io_read,
+ },
+ [IORING_OP_WRITEV] = {
+ .prep = io_writev_prep,
+ .issue = io_write,
+ },
+ [IORING_OP_NOT_SUPPORTED] = {
+ .prep = io_eopnotsupp_prep,
+ .issue = io_write,
+ },
};
diff --git a/tools/syz-declextract/testdata/io_uring.c.info b/tools/syz-declextract/testdata/io_uring.c.info
index 032fcaf41..5be7dc6ba 100644
--- a/tools/syz-declextract/testdata/io_uring.c.info
+++ b/tools/syz-declextract/testdata/io_uring.c.info
@@ -1,3 +1,3 @@
-IOURING IORING_OP_NOP func:io_nop loc:0 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
-IOURING IORING_OP_READV func:io_read loc:0 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
-IOURING IORING_OP_WRITEV func:io_write loc:0 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
+IOURING IORING_OP_NOP func:io_nop loc:1 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
+IOURING IORING_OP_READV func:io_read loc:1 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
+IOURING IORING_OP_WRITEV func:io_write loc:1 coverage:0 access:user manual_desc:false auto_desc:false file:io_uring.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/io_uring.c.json b/tools/syz-declextract/testdata/io_uring.c.json
index e82cf6c8c..edf29930f 100644
--- a/tools/syz-declextract/testdata/io_uring.c.json
+++ b/tools/syz-declextract/testdata/io_uring.c.json
@@ -4,7 +4,7 @@
"name": "io_eopnotsupp_prep",
"file": "io_uring.c",
"start_line": 11,
- "end_line": 11,
+ "end_line": 13,
"scopes": [
{
"arg": -1
@@ -14,8 +14,8 @@
{
"name": "io_nop",
"file": "io_uring.c",
- "start_line": 13,
- "end_line": 13,
+ "start_line": 17,
+ "end_line": 19,
"scopes": [
{
"arg": -1
@@ -25,8 +25,8 @@
{
"name": "io_nop_prep",
"file": "io_uring.c",
- "start_line": 12,
- "end_line": 12,
+ "start_line": 14,
+ "end_line": 16,
"scopes": [
{
"arg": -1
@@ -36,8 +36,8 @@
{
"name": "io_read",
"file": "io_uring.c",
- "start_line": 15,
- "end_line": 15,
+ "start_line": 23,
+ "end_line": 25,
"scopes": [
{
"arg": -1
@@ -47,8 +47,8 @@
{
"name": "io_readv_prep",
"file": "io_uring.c",
- "start_line": 14,
- "end_line": 14,
+ "start_line": 20,
+ "end_line": 22,
"scopes": [
{
"arg": -1
@@ -58,8 +58,8 @@
{
"name": "io_write",
"file": "io_uring.c",
- "start_line": 17,
- "end_line": 17,
+ "start_line": 29,
+ "end_line": 31,
"scopes": [
{
"arg": -1
@@ -69,8 +69,8 @@
{
"name": "io_writev_prep",
"file": "io_uring.c",
- "start_line": 16,
- "end_line": 16,
+ "start_line": 26,
+ "end_line": 28,
"scopes": [
{
"arg": -1
diff --git a/tools/syz-declextract/testdata/netlink.c b/tools/syz-declextract/testdata/netlink.c
index dc6ea4388..84a9ffce6 100644
--- a/tools/syz-declextract/testdata/netlink.c
+++ b/tools/syz-declextract/testdata/netlink.c
@@ -7,93 +7,103 @@
// These consts are defined not in uapi .h, so the descriptions should contain
// values for them rather than includes.
enum netlink_foo_nested_attrs {
- NETLINK_FOO_NESTED_ATTR1,
- NETLINK_FOO_NESTED_ATTR2,
+ NETLINK_FOO_NESTED_ATTR1,
+ NETLINK_FOO_NESTED_ATTR2,
};
static netlink_foo_struct2 var;
const struct nla_policy foo_genl_nested_policy[] = {
- [NETLINK_FOO_NESTED_ATTR1] = { .type = NLA_U32 },
- [NETLINK_FOO_NESTED_ATTR2] = { .type = NLA_U32 },
+ [NETLINK_FOO_NESTED_ATTR1] = {.type = NLA_U32},
+ [NETLINK_FOO_NESTED_ATTR2] = {.type = NLA_U32},
};
const struct nla_policy foo_genl_policy[] = {
- [NETLINK_FOO_ATTR1] = { .type = NLA_U32 },
- [NETLINK_FOO_ATTR2] = { .type = NLA_STRING, .len = 10 },
- [NETLINK_FOO_ATTR3] = { .type = NLA_NESTED },
- [NETLINK_FOO_ATTR4] = NLA_POLICY_NESTED(foo_genl_nested_policy),
- [NETLINK_FOO_ATTR5] = { .len = sizeof(struct netlink_foo_struct1) },
- [NETLINK_FOO_ATTR6] = { .len = sizeof(netlink_foo_struct2) * 10 },
- [NETLINK_FOO_ATTR7] = { .len = sizeof(var) },
+ [NETLINK_FOO_ATTR1] = {.type = NLA_U32},
+ [NETLINK_FOO_ATTR2] = {.type = NLA_STRING, .len = 10},
+ [NETLINK_FOO_ATTR3] = {.type = NLA_NESTED},
+ [NETLINK_FOO_ATTR4] = NLA_POLICY_NESTED(foo_genl_nested_policy),
+ [NETLINK_FOO_ATTR5] = {.len = sizeof(struct netlink_foo_struct1)},
+ [NETLINK_FOO_ATTR6] = {.len = sizeof(netlink_foo_struct2) * 10},
+ [NETLINK_FOO_ATTR7] = {.len = sizeof(var)},
};
const struct nla_policy foo_dump_genl_policy[] = {
- [NETLINK_FOO_ATTR1] = { .type = NLA_U32 },
+ [NETLINK_FOO_ATTR1] = {.type = NLA_U32},
};
const struct nla_policy genl_policy_reject_all[] = {
- { .type = NLA_REJECT },
- { .type = NLA_REJECT },
+ {.type = NLA_REJECT},
+ {.type = NLA_REJECT},
};
const struct nla_policy policy_forward_decl[10];
-static void foo_cmd() {}
-static void bar_cmd() {}
+static void foo_cmd()
+{
+}
+static void bar_cmd()
+{
+}
static const struct genl_ops foo_ops[] = {
- {
- .cmd = NETLINK_FOO_CMD_FOO,
- .flags = GENL_ADMIN_PERM,
- .doit = foo_cmd,
- },
- {
- .cmd = NETLINK_FOO_CMD_BAR,
- .flags = GENL_UNS_ADMIN_PERM,
- .doit = bar_cmd,
- },
- {
- .cmd = NETLINK_FOO_CMD_BAR,
- .flags = GENL_UNS_ADMIN_PERM,
- .dumpit = bar_cmd,
- .policy = foo_dump_genl_policy,
- },
+ {
+ .cmd = NETLINK_FOO_CMD_FOO,
+ .flags = GENL_ADMIN_PERM,
+ .doit = foo_cmd,
+ },
+ {
+ .cmd = NETLINK_FOO_CMD_BAR,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .doit = bar_cmd,
+ },
+ {
+ .cmd = NETLINK_FOO_CMD_BAR,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .dumpit = bar_cmd,
+ .policy = foo_dump_genl_policy,
+ },
};
static struct genl_family foo_family = {
- .ops = foo_ops,
- .n_ops = ARRAY_SIZE(foo_ops),
- .name = "foo family",
- .policy = foo_genl_policy,
+ .ops = foo_ops,
+ .n_ops = ARRAY_SIZE(foo_ops),
+ .name = "foo family",
+ .policy = foo_genl_policy,
};
enum {
NETLINK_BAR_CMD_FOO,
};
-static void bar_pre_doit() {}
-static void bar_doit() {}
-static void bar_post_doit() {}
+static void bar_pre_doit()
+{
+}
+static void bar_doit()
+{
+}
+static void bar_post_doit()
+{
+}
static const struct genl_split_ops bar_ops[] = {
- {
- .cmd = NETLINK_BAR_CMD_FOO,
- .pre_doit = bar_pre_doit,
- .doit = bar_doit,
- .post_doit = bar_post_doit,
- },
+ {
+ .cmd = NETLINK_BAR_CMD_FOO,
+ .pre_doit = bar_pre_doit,
+ .doit = bar_doit,
+ .post_doit = bar_post_doit,
+ },
};
struct genl_family bar_family = {
- .split_ops = bar_ops,
- .n_split_ops = ARRAY_SIZE(bar_ops),
- .name = "BAR",
- .policy = foo_genl_policy,
+ .split_ops = bar_ops,
+ .n_split_ops = ARRAY_SIZE(bar_ops),
+ .name = "BAR",
+ .policy = foo_genl_policy,
};
struct genl_family noops_family = {
- .name = "NOOPS",
+ .name = "NOOPS",
};
enum netlink_nopolicy_cmds {
@@ -101,14 +111,14 @@ enum netlink_nopolicy_cmds {
};
static const struct genl_ops nopolicy_ops[] = {
- {
- .cmd = NETLINK_NOPOLICY_CMD,
- .doit = foo_cmd,
- },
+ {
+ .cmd = NETLINK_NOPOLICY_CMD,
+ .doit = foo_cmd,
+ },
};
struct genl_family nopolicy_family = {
- .name = "nopolicy",
- .ops = nopolicy_ops,
- .n_ops = ARRAY_SIZE(nopolicy_ops),
+ .name = "nopolicy",
+ .ops = nopolicy_ops,
+ .n_ops = ARRAY_SIZE(nopolicy_ops),
};
diff --git a/tools/syz-declextract/testdata/netlink.c.info b/tools/syz-declextract/testdata/netlink.c.info
index 004b45a85..2c4a2e231 100644
--- a/tools/syz-declextract/testdata/netlink.c.info
+++ b/tools/syz-declextract/testdata/netlink.c.info
@@ -1,4 +1,4 @@
NETLINK NETLINK_BAR_CMD_FOO func: loc:0 coverage:0 access:user manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
-NETLINK NETLINK_FOO_CMD_BAR func:bar_cmd loc:0 coverage:0 access:ns_admin manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
-NETLINK NETLINK_FOO_CMD_FOO func:foo_cmd loc:0 coverage:0 access:admin manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
-NETLINK NETLINK_NOPOLICY_CMD func:foo_cmd loc:0 coverage:0 access:user manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
+NETLINK NETLINK_FOO_CMD_BAR func:bar_cmd loc:1 coverage:0 access:ns_admin manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
+NETLINK NETLINK_FOO_CMD_FOO func:foo_cmd loc:1 coverage:0 access:admin manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
+NETLINK NETLINK_NOPOLICY_CMD func:foo_cmd loc:1 coverage:0 access:user manual_desc:false auto_desc:true file:netlink.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/netlink.c.json b/tools/syz-declextract/testdata/netlink.c.json
index 8a1324fa4..94a4622ef 100644
--- a/tools/syz-declextract/testdata/netlink.c.json
+++ b/tools/syz-declextract/testdata/netlink.c.json
@@ -4,7 +4,7 @@
"name": "atomic_load32",
"file": "include/types.h",
"start_line": 17,
- "end_line": 19,
+ "end_line": 20,
"is_static": true,
"scopes": [
{
@@ -15,8 +15,8 @@
{
"name": "atomic_load64",
"file": "include/types.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 22,
+ "end_line": 25,
"scopes": [
{
"arg": -1
@@ -26,8 +26,8 @@
{
"name": "bar_cmd",
"file": "netlink.c",
- "start_line": 43,
- "end_line": 43,
+ "start_line": 45,
+ "end_line": 47,
"is_static": true,
"scopes": [
{
@@ -38,8 +38,8 @@
{
"name": "bar_doit",
"file": "netlink.c",
- "start_line": 76,
- "end_line": 76,
+ "start_line": 82,
+ "end_line": 84,
"is_static": true,
"scopes": [
{
@@ -50,8 +50,8 @@
{
"name": "bar_post_doit",
"file": "netlink.c",
- "start_line": 77,
- "end_line": 77,
+ "start_line": 85,
+ "end_line": 87,
"is_static": true,
"scopes": [
{
@@ -62,8 +62,8 @@
{
"name": "bar_pre_doit",
"file": "netlink.c",
- "start_line": 75,
- "end_line": 75,
+ "start_line": 79,
+ "end_line": 81,
"is_static": true,
"scopes": [
{
@@ -75,7 +75,7 @@
"name": "foo_cmd",
"file": "netlink.c",
"start_line": 42,
- "end_line": 42,
+ "end_line": 44,
"is_static": true,
"scopes": [
{
diff --git a/tools/syz-declextract/testdata/scopes.c b/tools/syz-declextract/testdata/scopes.c
index 57809ae3d..18f0b8b0e 100644
--- a/tools/syz-declextract/testdata/scopes.c
+++ b/tools/syz-declextract/testdata/scopes.c
@@ -5,10 +5,11 @@
#include "include/syscall.h"
#include "include/uapi/file_operations.h"
-#define LARGE_UINT (1ull<<63) // this is supposed to overflow int64
-#define LARGE_SINT (20ll<<63) // this is supposed to overflow uint64
+#define LARGE_UINT (1ull << 63) // this is supposed to overflow int64
+#define LARGE_SINT (20ll << 63) // this is supposed to overflow uint64
-static int scopes_helper(long cmd, long aux) {
+static int scopes_helper(long cmd, long aux)
+{
switch (cmd) {
case FOO_IOCTL7:
return alloc_fd();
@@ -22,7 +23,8 @@ static int scopes_helper(long cmd, long aux) {
return 0;
}
-SYSCALL_DEFINE1(scopes0, int x, long cmd, long aux) {
+SYSCALL_DEFINE1(scopes0, int x, long cmd, long aux)
+{
int tmp = 0;
__fget_light(aux);
switch (cmd) {
diff --git a/tools/syz-declextract/testdata/scopes.c.info b/tools/syz-declextract/testdata/scopes.c.info
index 71ff898d0..4ecc65a3c 100644
--- a/tools/syz-declextract/testdata/scopes.c.info
+++ b/tools/syz-declextract/testdata/scopes.c.info
@@ -1,14 +1,14 @@
-SYSCALL scopes0 func:__do_sys_scopes0 loc:37 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$100 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$101 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$102 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$1074291461 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$1074291462 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL1 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL2 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL3 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL4 func:__do_sys_scopes0 loc:8 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL7 func:__do_sys_scopes0 loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$FOO_IOCTL8 func:__do_sys_scopes0 loc:15 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$LARGE_SINT func:__do_sys_scopes0 loc:5 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
-SYSCALL scopes0$LARGE_UINT func:__do_sys_scopes0 loc:5 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0 func:__do_sys_scopes0 loc:41 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$100 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$101 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$102 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$1074291461 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$1074291462 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL1 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL2 func:__do_sys_scopes0 loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL3 func:__do_sys_scopes0 loc:13 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL4 func:__do_sys_scopes0 loc:10 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL7 func:__do_sys_scopes0 loc:19 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL8 func:__do_sys_scopes0 loc:18 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$LARGE_SINT func:__do_sys_scopes0 loc:7 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$LARGE_UINT func:__do_sys_scopes0 loc:7 coverage:0 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/scopes.c.json b/tools/syz-declextract/testdata/scopes.c.json
index fc39485c0..2ac04dd46 100644
--- a/tools/syz-declextract/testdata/scopes.c.json
+++ b/tools/syz-declextract/testdata/scopes.c.json
@@ -3,8 +3,8 @@
{
"name": "__do_sys_scopes0",
"file": "scopes.c",
- "start_line": 25,
- "end_line": 51,
+ "start_line": 26,
+ "end_line": 53,
"scopes": [
{
"arg": -1,
@@ -45,8 +45,8 @@
"values": [
"FOO_IOCTL1"
],
- "start_line": 29,
- "end_line": 32,
+ "start_line": 31,
+ "end_line": 34,
"calls": [
"__fget_light"
],
@@ -73,8 +73,8 @@
"FOO_IOCTL2",
"FOO_IOCTL3"
],
- "start_line": 32,
- "end_line": 36,
+ "start_line": 34,
+ "end_line": 38,
"calls": [
"alloc_fd"
],
@@ -112,8 +112,8 @@
"1074291461",
"1074291462"
],
- "start_line": 36,
- "end_line": 39
+ "start_line": 38,
+ "end_line": 41
},
{
"arg": 1,
@@ -121,8 +121,8 @@
"FOO_IOCTL7",
"FOO_IOCTL8"
],
- "start_line": 39,
- "end_line": 43,
+ "start_line": 41,
+ "end_line": 45,
"calls": [
"scopes_helper"
],
@@ -176,13 +176,13 @@
"101",
"102"
],
- "start_line": 43,
- "end_line": 46
+ "start_line": 45,
+ "end_line": 48
},
{
"arg": 1,
- "start_line": 46,
- "end_line": 49,
+ "start_line": 48,
+ "end_line": 51,
"facts": [
{
"src": {
@@ -204,8 +204,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
- "start_line": 18,
- "end_line": 19,
+ "start_line": 19,
+ "end_line": 21,
"is_static": true,
"scopes": [
{
@@ -217,7 +217,7 @@
"name": "alloc_fd",
"file": "include/fs.h",
"start_line": 14,
- "end_line": 16,
+ "end_line": 17,
"is_static": true,
"scopes": [
{
@@ -228,8 +228,8 @@
{
"name": "from_kuid",
"file": "include/fs.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 23,
+ "end_line": 26,
"is_static": true,
"scopes": [
{
@@ -241,7 +241,7 @@
"name": "scopes_helper",
"file": "scopes.c",
"start_line": 11,
- "end_line": 23,
+ "end_line": 24,
"is_static": true,
"scopes": [
{
@@ -252,8 +252,8 @@
"values": [
"FOO_IOCTL7"
],
- "start_line": 13,
- "end_line": 15,
+ "start_line": 14,
+ "end_line": 16,
"calls": [
"alloc_fd"
],
@@ -277,8 +277,8 @@
"values": [
"FOO_IOCTL8"
],
- "start_line": 15,
- "end_line": 18,
+ "start_line": 16,
+ "end_line": 19,
"calls": [
"__fget_light"
],
@@ -305,8 +305,8 @@
"LARGE_UINT",
"LARGE_SINT"
],
- "start_line": 18,
- "end_line": 21
+ "start_line": 19,
+ "end_line": 22
}
]
}
diff --git a/tools/syz-declextract/testdata/syscall.c b/tools/syz-declextract/testdata/syscall.c
index be247151b..aa3ffcaa3 100644
--- a/tools/syz-declextract/testdata/syscall.c
+++ b/tools/syz-declextract/testdata/syscall.c
@@ -3,10 +3,12 @@
#include "include/syscall.h"
-SYSCALL_DEFINE1(open, const char* filename, int flags, int mode) {
+SYSCALL_DEFINE1(open, const char* filename, int flags, int mode)
+{
return 0;
}
-SYSCALL_DEFINE1(chmod, const char* filename, int mode) {
+SYSCALL_DEFINE1(chmod, const char* filename, int mode)
+{
return 0;
}
diff --git a/tools/syz-declextract/testdata/syscall.c.info b/tools/syz-declextract/testdata/syscall.c.info
index fcfa0ecfe..cb611d16c 100644
--- a/tools/syz-declextract/testdata/syscall.c.info
+++ b/tools/syz-declextract/testdata/syscall.c.info
@@ -1,2 +1,2 @@
-SYSCALL chmod func:__do_sys_chmod loc:1 coverage:0 access:unknown manual_desc:false auto_desc:true file:syscall.c subsystem:kernel
-SYSCALL open func:__do_sys_open loc:1 coverage:0 access:unknown manual_desc:false auto_desc:true file:syscall.c subsystem:kernel
+SYSCALL chmod func:__do_sys_chmod loc:2 coverage:0 access:unknown manual_desc:false auto_desc:true file:syscall.c subsystem:kernel
+SYSCALL open func:__do_sys_open loc:2 coverage:0 access:unknown manual_desc:false auto_desc:true file:syscall.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/syscall.c.json b/tools/syz-declextract/testdata/syscall.c.json
index 371fe183b..12605a2ae 100644
--- a/tools/syz-declextract/testdata/syscall.c.json
+++ b/tools/syz-declextract/testdata/syscall.c.json
@@ -3,8 +3,8 @@
{
"name": "__do_sys_chmod",
"file": "syscall.c",
- "start_line": 10,
- "end_line": 12,
+ "start_line": 11,
+ "end_line": 14,
"scopes": [
{
"arg": -1
@@ -15,7 +15,7 @@
"name": "__do_sys_open",
"file": "syscall.c",
"start_line": 6,
- "end_line": 8,
+ "end_line": 9,
"scopes": [
{
"arg": -1
diff --git a/tools/syz-declextract/testdata/types.c b/tools/syz-declextract/testdata/types.c
index 1b7f3fb96..43aa97681 100644
--- a/tools/syz-declextract/testdata/types.c
+++ b/tools/syz-declextract/testdata/types.c
@@ -1,28 +1,50 @@
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-#include "include/syscall.h"
#include "include/types.h"
+#include "include/syscall.h"
-typedef struct { float f; } anon_t;
-struct empty_struct {};
+typedef struct {
+ float f;
+} anon_t;
+struct empty_struct {
+};
typedef int fd_t;
typedef struct forward forward_t;
struct anon_struct {
- // Various tricky anon cases.
- struct { int x; } a;
- struct {} b;
- struct { int y; };
- union { int q; long w; };
- anon_t foo;
- forward_t* forward;
- struct { int a; int b; } array[4];
- struct { int a; int b; } *ptr;
- struct { int a; int b; } *ptr_array[4];
+ // Various tricky anon cases.
+ struct {
+ int x;
+ } a;
+ struct {
+ } b;
+ struct {
+ int y;
+ };
+ union {
+ int q;
+ long w;
+ };
+ anon_t foo;
+ forward_t* forward;
+ struct {
+ int a;
+ int b;
+ } array[4];
+ struct {
+ int a;
+ int b;
+ }* ptr;
+ struct {
+ int a;
+ int b;
+ }* ptr_array[4];
};
-enum bitfield_enum { a, b, c };
+enum bitfield_enum { a,
+ b,
+ c };
struct bitfields {
int a : 1;
@@ -51,8 +73,9 @@ struct recursive {
};
SYSCALL_DEFINE1(types_syscall, struct anon_struct* p, struct empty_struct* y,
- struct bitfields* b, int pid, fd_t f, struct various __user* v,
- int __user* pi, u32 __user* pu) {
+ struct bitfields* b, int pid, fd_t f, struct various __user* v,
+ int __user* pi, u32 __user* pu)
+{
return 0;
}
@@ -66,11 +89,13 @@ typedef const enum {
enum_bar_b,
} enum_bar;
-SYSCALL_DEFINE1(types_syscall2, const enum enum_foo foo, const enum_bar bar) {
+SYSCALL_DEFINE1(types_syscall2, const enum enum_foo foo, const enum_bar bar)
+{
return 0;
}
-void anon_flow(int x) {
+void anon_flow(int x)
+{
struct anon_struct s;
s.a.x = x;
s.y = x;
@@ -81,8 +106,11 @@ void anon_flow(int x) {
s.ptr_array[1]->b = x;
}
-struct aligned_empty_struct {} __attribute__((aligned(8)));
-struct large_struct { long foo[10]; };
+struct aligned_empty_struct {
+} __attribute__((aligned(8)));
+struct large_struct {
+ long foo[10];
+};
struct align1 {
char f1;
@@ -108,7 +136,7 @@ struct align4 {
char f2;
};
-SYSCALL_DEFINE1(align_syscall, struct align1* a1, struct align2* a2, struct align3* a3, struct align4* a4) {
+SYSCALL_DEFINE1(align_syscall, struct align1* a1, struct align2* a2, struct align3* a3, struct align4* a4)
+{
return 0;
}
-
diff --git a/tools/syz-declextract/testdata/types.c.info b/tools/syz-declextract/testdata/types.c.info
index 560b38f1a..07e049492 100644
--- a/tools/syz-declextract/testdata/types.c.info
+++ b/tools/syz-declextract/testdata/types.c.info
@@ -1,3 +1,3 @@
-SYSCALL align_syscall func:__do_sys_align_syscall loc:1 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
-SYSCALL types_syscall func:__do_sys_types_syscall loc:3 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
-SYSCALL types_syscall2 func:__do_sys_types_syscall2 loc:1 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
+SYSCALL align_syscall func:__do_sys_align_syscall loc:2 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
+SYSCALL types_syscall func:__do_sys_types_syscall loc:4 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
+SYSCALL types_syscall2 func:__do_sys_types_syscall2 loc:2 coverage:0 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/types.c.json b/tools/syz-declextract/testdata/types.c.json
index 58469c703..a8dce8af6 100644
--- a/tools/syz-declextract/testdata/types.c.json
+++ b/tools/syz-declextract/testdata/types.c.json
@@ -3,8 +3,8 @@
{
"name": "__do_sys_align_syscall",
"file": "types.c",
- "start_line": 111,
- "end_line": 113,
+ "start_line": 139,
+ "end_line": 142,
"scopes": [
{
"arg": -1
@@ -14,8 +14,8 @@
{
"name": "__do_sys_types_syscall",
"file": "types.c",
- "start_line": 53,
- "end_line": 57,
+ "start_line": 75,
+ "end_line": 80,
"scopes": [
{
"arg": -1
@@ -25,8 +25,8 @@
{
"name": "__do_sys_types_syscall2",
"file": "types.c",
- "start_line": 69,
- "end_line": 71,
+ "start_line": 92,
+ "end_line": 95,
"scopes": [
{
"arg": -1
@@ -36,8 +36,8 @@
{
"name": "anon_flow",
"file": "types.c",
- "start_line": 73,
- "end_line": 82,
+ "start_line": 97,
+ "end_line": 107,
"scopes": [
{
"arg": -1,
@@ -51,7 +51,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126317",
+ "struct": "11253655576479126320",
"field": "x"
}
}
@@ -65,7 +65,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126319",
+ "struct": "11253655576479126325",
"field": "y"
}
}
@@ -79,7 +79,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126320",
+ "struct": "11253655576479126328",
"field": "w"
}
}
@@ -107,7 +107,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126323",
+ "struct": "11253655576479126334",
"field": "a"
}
}
@@ -121,7 +121,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126324",
+ "struct": "11253655576479126338",
"field": "a"
}
}
@@ -135,7 +135,7 @@
},
"dst": {
"field": {
- "struct": "11253655576479126325",
+ "struct": "11253655576479126342",
"field": "b"
}
}
@@ -148,7 +148,7 @@
"name": "atomic_load32",
"file": "include/types.h",
"start_line": 17,
- "end_line": 19,
+ "end_line": 20,
"is_static": true,
"scopes": [
{
@@ -159,8 +159,8 @@
{
"name": "atomic_load64",
"file": "include/types.h",
- "start_line": 21,
- "end_line": 23,
+ "start_line": 22,
+ "end_line": 25,
"scopes": [
{
"arg": -1
diff --git a/tools/syz-headerparser/test_headers/th_a.h b/tools/syz-headerparser/test_headers/th_a.h
index f2afc8752..a0d0bd195 100644
--- a/tools/syz-headerparser/test_headers/th_a.h
+++ b/tools/syz-headerparser/test_headers/th_a.h
@@ -8,8 +8,8 @@
#define RANDOM_MACRO_2 2
struct A {
- struct B *B_item;
- const char *char_ptr;
+ struct B* B_item;
+ const char* char_ptr;
unsigned int an_unsigned_int;
/*
* Some comments
diff --git a/tools/syz-headerparser/test_headers/th_b.h b/tools/syz-headerparser/test_headers/th_b.h
index 4b32e6041..7a42735fe 100644
--- a/tools/syz-headerparser/test_headers/th_b.h
+++ b/tools/syz-headerparser/test_headers/th_b.h
@@ -4,11 +4,11 @@
#ifndef _TEST_HEADER_B
#define _TEST_HEADER_B
-#include <linux/types.h> /* header comment */
+#include <linux/types.h> /* header comment */
enum random_enum {
- ONE = 1<<0,
- TWO = 1<<1,
+ ONE = 1 << 0,
+ TWO = 1 << 1,
};
struct B {
@@ -19,8 +19,8 @@ struct B {
struct struct_containing_union {
int something;
union {
- char *a_char;
- struct B *B_ptr;
+ char* a_char;
+ struct B* B_ptr;
} a_union;
};