From 924f7606047a430a9b313c135b782e1e8f852bec Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 15 Mar 2020 21:16:13 +0100 Subject: pkg/compiler: ensure consistency of syscall argument types Ensure that we don't have conflicting sizes for the same argument of the same syscall, e.g.: foo$1(a int16) foo$2(a int32) This is useful for several reasons: - we will be able avoid morphing syscalls into other syscalls - we will be able to figure out more precise sizes for args (lots of them are implicitly intptr, which is the largest type on most important arches) - found few bugs in linux descriptions Update #477 Update #502 --- prog/encoding_test.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'prog/encoding_test.go') diff --git a/prog/encoding_test.go b/prog/encoding_test.go index c62e6647f..fda0f855f 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -162,19 +162,19 @@ func TestDeserialize(t *testing.T) { input: `test$regression2(&(0x7f0000000000)=[0x1, 0x2, 0x3, 0x4, 0x5, 0x6])`, }, { - input: `test$excessive_args1(0x0, 0x1, {0x1, &(0x7f0000000000)=[0x1, 0x2]})`, + input: `test_excessive_args1(0x0, 0x1, {0x1, &(0x7f0000000000)=[0x1, 0x2]})`, strictErr: "excessive syscall arguments", }, { - input: `test$excessive_args2(0x0, 0x1, {0x1, &(0x7f0000000000)={0x1, 0x2}})`, + input: `test_excessive_args2(0x0, 0x1, {0x1, &(0x7f0000000000)={0x1, 0x2}})`, strictErr: "excessive syscall arguments", }, { - input: `test$excessive_args2(0x0, 0x1, {0x1, &(0x7f0000000000)=nil})`, + input: `test_excessive_args2(0x0, 0x1, {0x1, &(0x7f0000000000)=nil})`, strictErr: "excessive syscall arguments", }, { - input: `test$excessive_args2(0x0, &(0x7f0000000000), 0x0)`, + input: `test_excessive_args2(0x0, &(0x7f0000000000), 0x0)`, strictErr: "excessive syscall arguments", }, { @@ -191,38 +191,38 @@ func TestDeserialize(t *testing.T) { strictErr: "undeclared variable r0", }, { - input: `test$excessive_args2(r1)`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2(r1)`, + output: `test_excessive_args2(0x0)`, strictErr: "undeclared variable r1", }, { - input: `test$excessive_args2({0x0, 0x1})`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2({0x0, 0x1})`, + output: `test_excessive_args2(0x0)`, strictErr: "wrong struct arg", }, { - input: `test$excessive_args2([0x0], 0x0)`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2([0x0], 0x0)`, + output: `test_excessive_args2(0x0)`, strictErr: "wrong array arg", }, { - input: `test$excessive_args2(@foo)`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2(@foo)`, + output: `test_excessive_args2(0x0)`, strictErr: "wrong union arg", }, { - input: `test$excessive_args2('foo')`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2('foo')`, + output: `test_excessive_args2(0x0)`, strictErr: "wrong string arg", }, { - input: `test$excessive_args2(&(0x7f0000000000)={0x0, 0x1})`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2(&(0x7f0000000000)={0x0, 0x1})`, + output: `test_excessive_args2(0x0)`, strictErr: "wrong addr arg", }, { - input: `test$excessive_args2(nil)`, - output: `test$excessive_args2(0x0)`, + input: `test_excessive_args2(nil)`, + output: `test_excessive_args2(0x0)`, }, { input: `test$type_confusion1(&(0x7f0000000000)=@unknown)`, -- cgit mrf-deployment