From 44270612b458144e4c3e881bac376d32bb395ee8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 21 Mar 2019 13:17:23 +0100 Subject: executor: prevent non-null expected warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The added test triggers warnings like these: : In function ‘syz_mount_image.constprop’: :298:3: error: argument 1 null where non-null expected [-Werror=nonnull] In file included from :26:0: /usr/include/x86_64-linux-gnu/sys/stat.h:320:12: note: in a call to function ‘mkdir’ declared here extern int mkdir (const char *__path, __mode_t __mode) ^~~~~ cc1: all warnings being treated as errors : In function ‘syz_open_procfs.constprop’: :530:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] :85:110: note: in definition of macro ‘NONFAILING’ :532:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] :85:110: note: in definition of macro ‘NONFAILING’ :534:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] :85:110: note: in definition of macro ‘NONFAILING’ Use volatile for all arguments of syz_ functions to prevent compiler from treating the arguments as constants in reproducers. Popped up during bisection that used a repro that previously worked. Update #501 --- executor/common_bsd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'executor/common_bsd.h') diff --git a/executor/common_bsd.h b/executor/common_bsd.h index 40c9d14fb..be9481563 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -161,7 +161,7 @@ static void initialize_tun(int tun_id) #include #include -static long syz_emit_ethernet(long a0, long a1) +static long syz_emit_ethernet(volatile long a0, volatile long a1) { // syz_emit_ethernet(len len[packet], packet ptr[in, array[int8]]) if (tunfd < 0) @@ -216,7 +216,7 @@ struct tcp_resources { // pkg/csource hoistIncludes. #include -static long syz_extract_tcp_res(long a0, long a1, long a2) +static long syz_extract_tcp_res(volatile long a0, volatile long a1, volatile long a2) { // syz_extract_tcp_res(res ptr[out, tcp_resources], seq_inc int32, ack_inc int32) -- cgit mrf-deployment