From 4b042b7d6708cae4cb29fa41b89deea14b2eea32 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 23 Dec 2019 08:46:10 +0100 Subject: sys/linux: fix int64 alignment on 386 Turns out int64 alignment is 4 on 386... But on arm it's still 8. Another amusing finding thanks to syz-check. Update #590 --- sys/targets/targets.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'sys/targets') diff --git a/sys/targets/targets.go b/sys/targets/targets.go index e1d5731d8..c4deb3fc6 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -22,6 +22,7 @@ type Target struct { PageSize uint64 NumPages uint64 DataOffset uint64 + Int64Alignment uint64 CFlags []string CrossCFlags []string CCompilerPrefix string @@ -105,10 +106,11 @@ var List = map[string]map[string]*Target{ }, }, "32_shmem": { - PtrSize: 4, - PageSize: 8 << 10, - CFlags: []string{"-m32"}, - CrossCFlags: []string{"-m32", "-static"}, + PtrSize: 4, + PageSize: 8 << 10, + Int64Alignment: 4, + CFlags: []string{"-m32"}, + CrossCFlags: []string{"-m32", "-static"}, osCommon: osCommon{ SyscallNumbers: true, SyscallPrefix: "SYS_", @@ -150,6 +152,7 @@ var List = map[string]map[string]*Target{ VMArch: "amd64", PtrSize: 4, PageSize: 4 << 10, + Int64Alignment: 4, CFlags: []string{"-m32"}, CrossCFlags: []string{"-m32", "-static"}, CCompilerPrefix: "x86_64-linux-gnu-", @@ -207,10 +210,11 @@ var List = map[string]map[string]*Target{ NeedSyscallDefine: dontNeedSyscallDefine, }, "386": { - VMArch: "amd64", - PtrSize: 4, - PageSize: 4 << 10, - CFlags: []string{"-m32"}, + VMArch: "amd64", + PtrSize: 4, + PageSize: 4 << 10, + Int64Alignment: 4, + CFlags: []string{"-m32"}, // The story behind -B/usr/lib32 is not completely clear, but it helps in some cases. // For context see discussion in https://github.com/google/syzkaller/pull/1202 CrossCFlags: []string{"-m32", "-static", "-B/usr/lib32"}, -- cgit mrf-deployment