From 2145057cb8a50aba1a27a67be19953bee9b164fd Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 25 Feb 2018 14:44:29 +0100 Subject: pkg/compiler: fix alignment corner case Fix alignemnt calculation for packed structs with alignment and bitfields. Amusingly this affected only a single real struct -- ipv6_fragment_ext_header. --- prog/encodingexec_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'prog/encodingexec_test.go') diff --git a/prog/encodingexec_test.go b/prog/encodingexec_test.go index 92c36cad4..2ad19598e 100644 --- a/prog/encodingexec_test.go +++ b/prog/encodingexec_test.go @@ -390,6 +390,21 @@ func TestSerializeForExec(t *testing.T) { }, nil, }, + { + "syz_test$align7(&(0x7f0000000000)={{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}, 0x42})", + []uint64{ + execInstrCopyin, dataOffset + 0, execArgConst, 1 | 0<<16 | 1<<24, 0x1, + execInstrCopyin, dataOffset + 0, execArgConst, 1 | 1<<16 | 1<<24, 0x2, + execInstrCopyin, dataOffset + 0, execArgConst, 1 | 2<<16 | 1<<24, 0x3, + execInstrCopyin, dataOffset + 1, execArgConst, 2 | 0<<16 | 1<<24, 0x4, + execInstrCopyin, dataOffset + 1, execArgConst, 2 | 1<<16 | 1<<24, 0x5, + execInstrCopyin, dataOffset + 1, execArgConst, 2 | 2<<16 | 1<<24, 0x6, + execInstrCopyin, dataOffset + 8, execArgConst, 1, 0x42, + callID("syz_test$align7"), ExecNoCopyout, 1, execArgConst, ptrSize, dataOffset, + execInstrEOF, + }, + nil, + }, } buf := make([]byte, ExecBufferSize) -- cgit mrf-deployment