On 22/05/2024 12.48, Akihiko Odaki wrote:
-fsanitize=function enforces the consistency of function types, but
include/qemu/lockable.h contains function pointer casts, which violate
the rule. We already disables exact type checks for CFI with
-fsanitize-cfi-icall-generalize-pointers so disable -fsanitize=function
as well.

Ah, I was already wondering why we didn't see this in the CFI builds yet, but now I understand :-)

Anyway, just FYI, I've also opened some bug tickets for this some days ago:

https://gitlab.com/qemu-project/qemu/-/issues/2346
https://gitlab.com/qemu-project/qemu/-/issues/2345

(I assume we still should fix the underlying issues at one point in time and remove the compiler flag here again later? Otherwise you could close these with the "Resolves:" keyword in your patch description)

  qemu_common_flags = [
    '-D_GNU_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE',
-  '-fno-strict-aliasing', '-fno-common', '-fwrapv' ]
+  '-fno-sanitize=function', '-fno-strict-aliasing', '-fno-common', '-fwrapv' ]
  qemu_cflags = []
  qemu_ldflags = []

With GCC, I get:

cc: error: unrecognized argument to ‘-fno-sanitize=’ option: ‘function’

I think you need to add this via cc.get_supported_arguments() to make sure that we only add it for compilers that support this option.

 Thomas


Reply via email to