[all-commits] [llvm/llvm-project] 155b7a: [Sanitizers] Avoid overload ambiguity for intercep...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jul 30 00:25:24 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 155b7a12820ec45095988b6aa6e057afaf2bc892
      https://github.com/llvm/llvm-project/commit/155b7a12820ec45095988b6aa6e057afaf2bc892
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-07-30 (Tue, 30 Jul 2024)

  Changed paths:
    M compiler-rt/lib/interception/interception_linux.h

  Log Message:
  -----------
  [Sanitizers] Avoid overload ambiguity for interceptors (#100986)

Since glibc 2.40 some functions like openat make use of overloads when
built with `-D_FORTIFY_SOURCE=2`, see:
https://github.com/bminor/glibc/blob/master/io/bits/fcntl2.h

This means that doing something like `(uintptr_t) openat` or `(void *)
openat` is now ambiguous, breaking the compiler-rt build on new glibc
versions.

Fix this by explicitly casting the symbol to the expected function type
before casting it to an intptr. The expected type is obtained as
`decltype(REAL(func))` so we don't have to repeat the signature from
INTERCEPTOR in the INTERCEPT_FUNTION macro.

Fixes https://github.com/llvm/llvm-project/issues/100754.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list