From aea82c003a1826ebd9bf53194bb40fe911f9c23e Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Tue, 2 Jun 2020 09:18:07 +0200 Subject: sys/linux: first 64bit big-endian architecture s390x * mmap syscall is special on Linux s390x because the parameters for this syscall are passed as a struct on user stack instead of registers. * Introduce the SyscallTrampolines table into targets.Target to address the above problem. * There is a bug in Linux kernel s390x which causes QEMU TCG to hang when KASAN is enabled. The bug has been fixed in the forthcoming Linux 5.8 version. Until then do not enable KASAN when using QEMU TCG, QEMU KVM shall have no problems with KASAN. Signed-off-by: Alexander Egorenkov --- pkg/csource/csource.go | 5 ++++- pkg/csource/generated.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg/csource') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index d2ab513cc..8818e4f1c 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -209,7 +209,8 @@ func (ctx *context) generateCalls(p prog.ExecProg, trace bool) ([]string, []uint func (ctx *context) emitCall(w *bytes.Buffer, call prog.ExecCall, ci int, haveCopyout, trace bool) { callName := call.Meta.CallName - native := ctx.sysTarget.SyscallNumbers && !strings.HasPrefix(callName, "syz_") + _, trampoline := ctx.sysTarget.SyscallTrampolines[callName] + native := ctx.sysTarget.SyscallNumbers && !strings.HasPrefix(callName, "syz_") && !trampoline fmt.Fprintf(w, "\t") if haveCopyout || trace { fmt.Fprintf(w, "res = ") @@ -269,6 +270,8 @@ func (ctx *context) emitCallName(w *bytes.Buffer, call prog.ExecCall, native boo fmt.Fprintf(w, "syscall(%v%v", ctx.sysTarget.SyscallPrefix, callName) } else if strings.HasPrefix(callName, "syz_") { fmt.Fprintf(w, "%v(", callName) + } else if trampolineName, ok := ctx.sysTarget.SyscallTrampolines[callName]; ok { + fmt.Fprintf(w, "%v(", trampolineName) } else { args := strings.Repeat(",intptr_t", len(call.Args)) if args != "" { diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 6c1f343be..e374b593f 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -5197,6 +5197,8 @@ struct fs_image_segment { #define sys_memfd_create 360 #elif GOARCH_mips64le #define sys_memfd_create 314 +#elif GOARCH_s390x +#define sys_memfd_create 350 #endif static unsigned long fs_image_segment_check(unsigned long size, unsigned long nsegs, long segments) -- cgit mrf-deployment