aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-09-29 13:28:03 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-09-29 13:30:08 +0200
commit3ca39dfc4dd8a2dda5b3a9b8c29e295839490af3 (patch)
treed3f4161d07c22e4a08eb0d3edfd61b485ef10579 /prog
parentbf21057e7c36c72c1b46aa71bea8dc48509d4c40 (diff)
sys: add padding to structs again
Struct padding was accidentially lost after: 852e3d2eae98a913b7ec91822ba4dc61059a6955 Restore it. Now with tests. Fixes #78
Diffstat (limited to 'prog')
-rw-r--r--prog/encodingexec_test.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/prog/encodingexec_test.go b/prog/encodingexec_test.go
index 651352fd6..eddda5199 100644
--- a/prog/encodingexec_test.go
+++ b/prog/encodingexec_test.go
@@ -67,15 +67,26 @@ func TestSerializeForExec(t *testing.T) {
},
},
{
- // TODO: the offsets are currently caclulated incorrectly.
"syz_test$align0(&(0x7f0000000000)={0x1, 0x2, 0x3, 0x4, 0x5})",
[]uint64{
instrCopyin, dataOffset + 0, argConst, 2, 1,
+ instrCopyin, dataOffset + 4, argConst, 4, 2,
+ instrCopyin, dataOffset + 8, argConst, 1, 3,
+ instrCopyin, dataOffset + 10, argConst, 2, 4,
+ instrCopyin, dataOffset + 16, argConst, 8, 5,
+ callID("syz_test$align0"), 1, argConst, ptrSize, dataOffset,
+ instrEOF,
+ },
+ },
+ {
+ "syz_test$align1(&(0x7f0000000000)={0x1, 0x2, 0x3, 0x4, 0x5})",
+ []uint64{
+ instrCopyin, dataOffset + 0, argConst, 2, 1,
instrCopyin, dataOffset + 2, argConst, 4, 2,
instrCopyin, dataOffset + 6, argConst, 1, 3,
instrCopyin, dataOffset + 7, argConst, 2, 4,
instrCopyin, dataOffset + 9, argConst, 8, 5,
- callID("syz_test$align0"), 1, argConst, ptrSize, dataOffset,
+ callID("syz_test$align1"), 1, argConst, ptrSize, dataOffset,
instrEOF,
},
},
@@ -88,6 +99,17 @@ func TestSerializeForExec(t *testing.T) {
instrEOF,
},
},
+ {
+ "syz_test$array0(&(0x7f0000000000)={0x1, [@f0=0x2, @f1=0x3], 0x4})",
+ []uint64{
+ instrCopyin, dataOffset + 0, argConst, 1, 1,
+ instrCopyin, dataOffset + 1, argConst, 2, 2,
+ instrCopyin, dataOffset + 3, argConst, 8, 3,
+ instrCopyin, dataOffset + 11, argConst, 8, 4,
+ callID("syz_test$array0"), 1, argConst, ptrSize, dataOffset,
+ instrEOF,
+ },
+ },
}
for i, test := range tests {