From 6083db9d13eaaceec7d43a66e2baeb6902c3f36e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 10 Apr 2025 16:10:29 +0200 Subject: pkg/csource: enforce the bit size of -1 syscall() is a variadic function, so we need to be careful when passing const values in there without specifying their type. For -1, we did not specify it, and on 64 bit architectures the de facto passed value was 0xFFFFFFFF instead of 0xFFFFFFFFFFFFFFFF. Fix it and add a test. Closes #5921. --- pkg/csource/csource_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg/csource/csource_test.go') diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 472e82225..16aef1b14 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -238,6 +238,17 @@ syscall(SYS_csource7, /*flag=BIT_1*/2ul); syscall(SYS_csource7, /*flag=BIT_0_AND_1*/3ul); syscall(SYS_csource7, /*flag=*/4ul); syscall(SYS_csource7, /*flag=BIT_0|0x4*/5ul); +`, + }, + + { + input: ` +csource0(0xffffffff) +csource8(0xffffffffffffffff) +`, + output: ` +syscall(SYS_csource0, /*num=*/(intptr_t)-1); +syscall(SYS_csource8, /*num=*/(intptr_t)-1); `, }, } -- cgit mrf-deployment