lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 02:41:55 -0800
From: Kees Cook <keescook@...omium.org>
To: Marco Elver <elver@...gle.com>
Cc: kernel test robot <lkp@...el.com>, linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ubsan: Silence W=1 warnings in self-test

On Fri, Feb 02, 2024 at 10:57:11AM +0100, Marco Elver wrote:
> On Fri, 2 Feb 2024 at 10:46, Kees Cook <keescook@...omium.org> wrote:
> >
> > Silence a handful of W=1 warnings in the UBSan selftest, which set
> > variables without using them. For example:
> >
> >    lib/test_ubsan.c:101:6: warning: variable 'val1' set but not used [-Wunused-but-set-variable]
> >      101 |         int val1 = 10;
> >          |             ^
> 
> This is the shift_out_of_bounds test? It looks like the neg and wrap
> variables are volatile but the written-to variables aren't.
> Technically the compiler just has to emit the reads to neg and wrap,
> and can entirely omit the writes to val1 and val2.
> 
> Does making it volatile fix the warning?

It does for some, but not all:

../lib/test_ubsan.c: In function 'test_ubsan_out_of_bounds':
../lib/test_ubsan.c:115:22: warning: variable 'arr' set but not used [-Wunused-but-set-variable]
  115 |         volatile int arr[4];
      |                      ^~~
../lib/test_ubsan.c:114:23: warning: variable 'above' set but not used [-Wunused-but-set-variable]
  114 |         volatile char above[4] = { }; /* Protect surrounding memory. */
      |                       ^~~~~
../lib/test_ubsan.c: In function 'test_ubsan_load_invalid_value':
../lib/test_ubsan.c:137:44: warning: variable 'eptr' set but not used [-Wunused-but-set-variable]
  137 |         enum ubsan_test_enum eval, eval2, *eptr;
      |                                            ^~~~
../lib/test_ubsan.c:136:26: warning: variable 'ptr' set but not used [-Wunused-but-set-variable]
  136 |         bool val, val2, *ptr;
      |                          ^~~


-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ