- Enable cgo with this version
- Fix build with musl

Signed-off-by: Khem Raj <[email protected]>
---
 ...cutor-Include-missing-linux-falloc.h.patch | 37 +++++++++++++++++++
 ...ets.go-allow-users-to-override-hardc.patch | 13 ++-----
 .../recipes-test/syzkaller/syzkaller_git.bb   |  5 ++-
 3 files changed, 44 insertions(+), 11 deletions(-)
 create mode 100644 
meta-oe/recipes-test/syzkaller/syzkaller/0001-executor-Include-missing-linux-falloc.h.patch

diff --git 
a/meta-oe/recipes-test/syzkaller/syzkaller/0001-executor-Include-missing-linux-falloc.h.patch
 
b/meta-oe/recipes-test/syzkaller/syzkaller/0001-executor-Include-missing-linux-falloc.h.patch
new file mode 100644
index 0000000000..23bfb9a5e2
--- /dev/null
+++ 
b/meta-oe/recipes-test/syzkaller/syzkaller/0001-executor-Include-missing-linux-falloc.h.patch
@@ -0,0 +1,37 @@
+From 9db789b4498d4130450e988757914c03e42b40f5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+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 <[email protected]>
+---
+ 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
+
diff --git 
a/meta-oe/recipes-test/syzkaller/syzkaller/0001-sys-targets-targets.go-allow-users-to-override-hardc.patch
 
b/meta-oe/recipes-test/syzkaller/syzkaller/0001-sys-targets-targets.go-allow-users-to-override-hardc.patch
index d647b8d4a0..61f4351651 100644
--- 
a/meta-oe/recipes-test/syzkaller/syzkaller/0001-sys-targets-targets.go-allow-users-to-override-hardc.patch
+++ 
b/meta-oe/recipes-test/syzkaller/syzkaller/0001-sys-targets-targets.go-allow-users-to-override-hardc.patch
@@ -18,11 +18,9 @@ Signed-off-by: Ovidiu Panait <[email protected]>
  sys/targets/targets.go | 19 +++++++++++--------
  1 file changed, 11 insertions(+), 8 deletions(-)
 
-diff --git a/sys/targets/targets.go b/sys/targets/targets.go
-index f3be708f3..19a8bb681 100644
 --- a/sys/targets/targets.go
 +++ b/sys/targets/targets.go
-@@ -258,7 +258,6 @@ var List = map[string]map[string]*Target{
+@@ -262,7 +262,6 @@ var List = map[string]map[string]*Target
                        PtrSize:          4,
                        PageSize:         4 << 10,
                        LittleEndian:     true,
@@ -30,7 +28,7 @@ index f3be708f3..19a8bb681 100644
                        Triple:           "arm-linux-gnueabi",
                        KernelArch:       "arm",
                        KernelHeaderArch: "arm",
-@@ -670,12 +669,16 @@ func initTarget(target *Target, OS, arch string) {
+@@ -700,12 +699,16 @@ func initTarget(target *Target, OS, arch
        for i := range target.CFlags {
                target.replaceSourceDir(&target.CFlags[i], sourceDir)
        }
@@ -53,15 +51,12 @@ index f3be708f3..19a8bb681 100644
        }
        if target.CCompiler == "" {
                target.setCompiler(useClang)
-@@ -803,7 +806,7 @@ func (target *Target) lazyInit() {
+@@ -839,7 +842,7 @@ func (target *Target) lazyInit() {
        // On CI we want to fail loudly if cross-compilation breaks.
        // Also fail if SOURCEDIR_GOOS is set b/c in that case user probably 
assumes it will work.
-       if (target.OS != runtime.GOOS || !runningOnCI) && 
os.Getenv("SOURCEDIR_"+strings.ToUpper(target.OS)) == "" {
+       if (target.OS != runtime.GOOS || !runningOnCI) && getSourceDir(target) 
== "" {
 -              if _, err := exec.LookPath(target.CCompiler); err != nil {
 +              if _, err := 
exec.LookPath(strings.Fields(target.CCompiler)[0]); err != nil {
                        target.BrokenCompiler = fmt.Sprintf("%v is missing 
(%v)", target.CCompiler, err)
                        return
                }
--- 
-2.25.1
-
diff --git a/meta-oe/recipes-test/syzkaller/syzkaller_git.bb 
b/meta-oe/recipes-test/syzkaller/syzkaller_git.bb
index f7c751f806..2adc06a2bc 100644
--- a/meta-oe/recipes-test/syzkaller/syzkaller_git.bb
+++ b/meta-oe/recipes-test/syzkaller/syzkaller_git.bb
@@ -8,8 +8,9 @@ GO_IMPORT = "github.com/google/syzkaller"
 
 SRC_URI = 
"git://${GO_IMPORT};protocol=https;destsuffix=${BPN}-${PV}/src/${GO_IMPORT};branch=master
 \
            
file://0001-sys-targets-targets.go-allow-users-to-override-hardc.patch;patchdir=src/${GO_IMPORT}
 \
+           
file://0001-executor-Include-missing-linux-falloc.h.patch;patchdir=src/${GO_IMPORT}
 \
            "
-SRCREV = "67cb024cd1a3c95e311263a5c95e957f9abfd8ca"
+SRCREV = "6d01f20890edf11b99bb54573025b11c1acd2d52"
 
 COMPATIBLE_HOST = "(x86_64|i.86|arm|aarch64).*-linux"
 
@@ -23,7 +24,7 @@ export TARGETOS = '${GOOS}'
 export TARGETARCH = '${GOARCH}'
 export TARGETVMARCH = '${GOARCH}'
 
-CGO_ENABLED = "0"
+CGO_ENABLED = "1"
 
 DEPENDS:class-native += "qemu-system-native"
 
-- 
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#103448): 
https://lists.openembedded.org/g/openembedded-devel/message/103448
Mute This Topic: https://lists.openembedded.org/mt/99637749/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to