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

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Aug 1 00:14:12 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 742576dc3b332d0f67e883b445f482a51ea1feec
      https://github.com/llvm/llvm-project/commit/742576dc3b332d0f67e883b445f482a51ea1feec
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-08-01 (Thu, 01 Aug 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.

(cherry picked from commit 155b7a12820ec45095988b6aa6e057afaf2bc892)



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