aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/kfuzztest/testdata/1
diff options
context:
space:
mode:
authorEthan Graham <ethangraham@google.com>2025-09-15 12:56:38 +0000
committerAleksandr Nogikh <nogikh@google.com>2025-09-22 09:11:54 +0000
commit9a3002038e891237ff5b561f756a0ff6e32d1d2f (patch)
treede544a42881a86c3d5e60f31bd83a1d5dd52425c /pkg/kfuzztest/testdata/1
parent91601ce4199e5c85a51aa48270101c7fa5bff51a (diff)
pkg/kfuzztest: add pkg/kfuzztest
Add a new package, pkg/kfuzztest, that implements dynamic discovery of KFuzzTest targets by parsing a vmlinux kernel binary. Signed-off-by: Ethan Graham <ethangraham@google.com>
Diffstat (limited to 'pkg/kfuzztest/testdata/1')
-rw-r--r--pkg/kfuzztest/testdata/1/desc.txt7
-rw-r--r--pkg/kfuzztest/testdata/1/prog.c24
2 files changed, 31 insertions, 0 deletions
diff --git a/pkg/kfuzztest/testdata/1/desc.txt b/pkg/kfuzztest/testdata/1/desc.txt
new file mode 100644
index 000000000..71c4acb39
--- /dev/null
+++ b/pkg/kfuzztest/testdata/1/desc.txt
@@ -0,0 +1,7 @@
+# This description was automatically generated with tools/kfuzztest-gen
+pkcs7_parse_message_arg {
+ data ptr[in, array[int8]]
+ datalen len[data, int64]
+}
+
+syz_kfuzztest_run$test_pkcs7_parse_message(name ptr[in, string["test_pkcs7_parse_message"]], data ptr[in, pkcs7_parse_message_arg], len bytesize[data]) (kfuzz_test)
diff --git a/pkg/kfuzztest/testdata/1/prog.c b/pkg/kfuzztest/testdata/1/prog.c
new file mode 100644
index 000000000..b1940ba1f
--- /dev/null
+++ b/pkg/kfuzztest/testdata/1/prog.c
@@ -0,0 +1,24 @@
+// Copyright 2025 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 "../common.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+struct pkcs7_parse_message_arg {
+ const void* data;
+ size_t datalen;
+};
+
+DEFINE_FUZZ_TARGET(test_pkcs7_parse_message, struct pkcs7_parse_message_arg);
+/* Expect data != NULL. */
+DEFINE_CONSTRAINT(pkcs7_parse_message_arg, data, NULL, NULL, EXPECT_NE);
+/* Expect datalen == len(data). */
+DEFINE_ANNOTATION(pkcs7_parse_message_arg, datalen, data, ATTRIBUTE_LEN);
+/* Annotate data as an array. */
+DEFINE_ANNOTATION(pkcs7_parse_message_arg, data, , ATTRIBUTE_ARRAY);
+
+/* Define a main function, otherwise the compiler complains. */
+int main(void)
+{
+}