[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU poke 2.90.0 on Linux/x86_64 with UBsan
From: |
Bruno Haible |
Subject: |
Re: GNU poke 2.90.0 on Linux/x86_64 with UBsan |
Date: |
Mon, 23 Jan 2023 02:46:26 +0100 |
"gcc -ftrapv" checks only for one single case of undefined behaviour,
namely specific cases of integer overflow.
More generically, one can use clang's UB sanitizer. I installed clang 14.0.0
then set
CC="clang
-fsanitize=undefined,signed-integer-overflow,shift,integer-divide-by-zero
-fno-sanitize=pointer-overflow"
CFLAGS="-O1 -fno-omit-frame-pointer -ggdb"
(per recommendations from
https://blogs.oracle.com/linux/post/improving-application-security-with-undefinedbehaviorsanitizer-ubsan-and-gcc)
then built poke and did "make check". Find attached the poke.log. It has
several occurrences of
runtime error: left shift of negative value
but also several occurrences of
runtime error: left shift of <X> by <Y> places cannot be represented in type
'int32_t'
runtime error: left shift of <X> by <Y> places cannot be represented in type
'int64_t'
where <X> and <Y> are positive integers.
Bruno
poke.log.gz
Description: application/gzip
- Re: GNU poke 2.90.0 on Linux/x86_64 with UBsan,
Bruno Haible <=