On 1/24/22 17:57, Jeffrey Walton wrote:
> On Mon, Jan 24, 2022 at 9:21 AM Dumitru Ceara <[email protected]> wrote:
>>
>> Note: There still is an UB instance when using SSE4.2 as reported here:
>> https://mail.openvswitch.org/pipermail/ovs-dev/2022-January/390904.html
>>
>> Acked-by: Aaron Conole <[email protected]>
>> Signed-off-by: Dumitru Ceara <[email protected]>
>> ---
>> v3:
>> - Fix typo in variable name.
>> - Added SSE4.2 UB note to commit log.
>> ---
>>  .ci/linux-build.sh                   |    6 ++++++
>>  .github/workflows/build-and-test.yml |    5 +++++
>>  configure.ac                         |    1 +
>>  tests/atlocal.in                     |   16 ++++++++++++++++
>>  tests/automake.mk                    |    1 +
>>  tests/daemon.at                      |    8 ++++++++
>>  tests/ovs-macros.at                  |    5 +++++
>>  tests/ovsdb-server.at                |   16 ++++++++++++++++
>>  8 files changed, 58 insertions(+)
>>
>> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
>> index 6cd38ff3efb5..afd4379e6923 100755
>> --- a/.ci/linux-build.sh
>> +++ b/.ci/linux-build.sh
>> @@ -250,6 +250,12 @@ if [ "$ASAN" ]; then
>>      CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_ASAN}"
>>  fi
>>
>> +if [ "$UBSAN" ]; then
>> +    # Use the default options configured in tests/atlocal.in, in 
>> UBSAN_OPTIONS.
>> +    CFLAGS_UBSAN="-O1 -fno-omit-frame-pointer -fno-common 
>> -fsanitize=undefined"
>> +    CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_UBSAN}"
>> +fi
>> +
>>  save_OPTS="${OPTS} $*"
>>  OPTS="${EXTRA_OPTS} ${save_OPTS}"
> 
> Sanitizer flags usually placed for compile and link. So they usually
> go in CFLAGS and LDFLAGS. You will be Ok with putting them in CFLAGS
> only if you use GNU Make's default:
> 
> $ make -p | grep '^LINK\.c'
> LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
> 
> But you will need to add them to LDFLAGS if you invoke LD directly.
> 

This script is only used for building OVS in CI, it looks to me like
it's going to pass the flags fine both at compile and link time:

https://github.com/dceara/ovs/runs/4922391120?check_suite_focus=true#step:12:5116

> You might also want to add -fno-sanitize=integer-divide-by-zero
> -fno-sanitize=float-divide-by-zero. Divide-by-0's are usually not
> needed due to IEEE-754, and if left in usually cause more trouble then
> they are worth.
> 

Interesting, I see float-divide-by-zero is not even included in
-fsanitize=undefined in more recent releases (e.g., clang 12).  In
GitHub actions we run on Ubuntu 18.04.  I'll check to see what actually
happens there.

Thanks for pointing this out!

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to