qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/docker: only enable ubsan for test-clang
@ 2019-10-01 14:14 Paolo Bonzini
  2019-10-01 17:59 ` John Snow
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2019-10-01 14:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, jsnow

-fsanitize=undefined is not the same thing as --enable-sanitizers.  After
commit 47c823e ("tests/docker: add sanitizers back to clang build", 2019-09-11)
test-clang is almost duplicating the asan (test-debug) test, so
partly revert commit 47c823e5b while leaving ubsan enabled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/test-clang | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/docker/test-clang b/tests/docker/test-clang
index db9e697..8c51ead 100755
--- a/tests/docker/test-clang
+++ b/tests/docker/test-clang
@@ -17,7 +17,9 @@ requires clang
 
 cd "$BUILD_DIR"
 
-OPTS="--cxx=clang++ --cc=clang --host-cc=clang --enable-sanitizers"
+OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
+OPTS="$OPTS --extra-cflags=-fsanitize=undefined \
+    --extra-cflags=-fno-sanitize=float-divide-by-zero"
 build_qemu $OPTS
 check_qemu
 install_qemu
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/docker: only enable ubsan for test-clang
  2019-10-01 14:14 [PATCH] tests/docker: only enable ubsan for test-clang Paolo Bonzini
@ 2019-10-01 17:59 ` John Snow
  2019-10-06 16:06   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: John Snow @ 2019-10-01 17:59 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: alex.bennee



On 10/1/19 10:14 AM, Paolo Bonzini wrote:
> -fsanitize=undefined is not the same thing as --enable-sanitizers.  After
> commit 47c823e ("tests/docker: add sanitizers back to clang build", 2019-09-11)
> test-clang is almost duplicating the asan (test-debug) test, so
> partly revert commit 47c823e5b while leaving ubsan enabled.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

I got confused by this:

```
  if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
      have_ubsan=yes
  fi

```

it looked quite like --enable-sanitizers was indeed the same as
-fsanitize=undefined; or at least was a superset of such.

I suppose the argument you're making here is that we *only* want ubsan
for test-clang?

(I guess so, since test-debug also stipulates that clang be used; but
enables debug.)

In this case, is there a use for test-clang at all, actually?

--js


> ---
>  tests/docker/test-clang | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/docker/test-clang b/tests/docker/test-clang
> index db9e697..8c51ead 100755
> --- a/tests/docker/test-clang
> +++ b/tests/docker/test-clang
> @@ -17,7 +17,9 @@ requires clang
>  
>  cd "$BUILD_DIR"
>  
> -OPTS="--cxx=clang++ --cc=clang --host-cc=clang --enable-sanitizers"
> +OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
> +OPTS="$OPTS --extra-cflags=-fsanitize=undefined \
> +    --extra-cflags=-fno-sanitize=float-divide-by-zero"
>  build_qemu $OPTS
>  check_qemu
>  install_qemu
> 

-- 
—js


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/docker: only enable ubsan for test-clang
  2019-10-01 17:59 ` John Snow
@ 2019-10-06 16:06   ` Paolo Bonzini
  2019-10-06 20:28     ` John Snow
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2019-10-06 16:06 UTC (permalink / raw)
  To: John Snow, qemu-devel; +Cc: alex.bennee

On 01/10/19 19:59, John Snow wrote:
> 
> it looked quite like --enable-sanitizers was indeed the same as
> -fsanitize=undefined; or at least was a superset of such.
> 
> I suppose the argument you're making here is that we *only* want ubsan
> for test-clang?
> 
> (I guess so, since test-debug also stipulates that clang be used; but
> enables debug.)
> 
> In this case, is there a use for test-clang at all, actually?

Yes, test-clang checks that clang-specific warnings do not fire.
Enabling ubsan isn't particularly useful in this respect, but it's okay
for me to keep it.

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/docker: only enable ubsan for test-clang
  2019-10-06 16:06   ` Paolo Bonzini
@ 2019-10-06 20:28     ` John Snow
  0 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2019-10-06 20:28 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: alex.bennee



On 10/6/19 12:06 PM, Paolo Bonzini wrote:
> On 01/10/19 19:59, John Snow wrote:
>>
>> it looked quite like --enable-sanitizers was indeed the same as
>> -fsanitize=undefined; or at least was a superset of such.
>>
>> I suppose the argument you're making here is that we *only* want ubsan
>> for test-clang?
>>
>> (I guess so, since test-debug also stipulates that clang be used; but
>> enables debug.)
>>
>> In this case, is there a use for test-clang at all, actually?
> 
> Yes, test-clang checks that clang-specific warnings do not fire.
> Enabling ubsan isn't particularly useful in this respect, but it's okay
> for me to keep it.
> 
> Paolo
> 

If it's a proper subset of test-debug, let's just drop it entirely and
leave it to be a "normal" clang invocation.

(Oh, it was already pulled. well, whatever.)

--js


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-06 20:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01 14:14 [PATCH] tests/docker: only enable ubsan for test-clang Paolo Bonzini
2019-10-01 17:59 ` John Snow
2019-10-06 16:06   ` Paolo Bonzini
2019-10-06 20:28     ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).