From a2360d0742f01e40bf4fb1714de4503f8a82aa3f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 15 Sep 2020 08:26:45 +0200 Subject: executor: fix definition of __NR_io_uring_setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sone syzbot instances broke with: : In function ‘syz_io_uring_setup’: :476:33: error: ‘__NR_io_uring_setup’ undeclared (first use in this function) :476:33: note: each undeclared identifier is reported only once for each function it appears in pkg/csource resolves #ifdef's at generation time. --- executor/style_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'executor/style_test.go') diff --git a/executor/style_test.go b/executor/style_test.go index 488752626..f6f5856f3 100644 --- a/executor/style_test.go +++ b/executor/style_test.go @@ -43,6 +43,24 @@ if (foo) `/* C++ comment */`, }, }, + { + pattern: `#define __NR_`, + message: "Don't define syscall __NR_foo constants.\n" + + "These should be guarded by #ifndef __NR_foo, but this is dependent on the host " + + "and may break on other machines (after pkg/csource processing).\n" + + "Define sys_foo constants instead.", + tests: []string{ + ` +#ifndef __NR_io_uring_setup +#ifdef __alpha__ +#define __NR_io_uring_setup 535 +#else // !__alpha__ +#define __NR_io_uring_setup 425 +#endif +#endif // __NR_io_uring_setup +`, + }, + }, { pattern: `//[^\s]`, suppression: `https?://`, -- cgit mrf-deployment