[all-commits] [llvm/llvm-project] b40f07: [msan] Add stat-family interceptors on Linux

Vitaly Buka via All-commits all-commits at lists.llvm.org
Tue Dec 21 10:19:22 PST 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: b40f07b048c40b340e4bf87e53dc134847b78205
      https://github.com/llvm/llvm-project/commit/b40f07b048c40b340e4bf87e53dc134847b78205
  Author: Nikita Malyavin <nikitamalyavin at gmail.com>
  Date:   2021-12-21 (Tue, 21 Dec 2021)

  Changed paths:
    M compiler-rt/lib/msan/msan_interceptors.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

  Log Message:
  -----------
  [msan] Add stat-family interceptors on Linux

Add following interceptors on Linux: stat, lstat, fstat, fstatat.

This fixes use-of-uninitialized value on platforms with GLIBC 2.33+.
In particular: Arch Linux, Ubuntu hirsute/impish.

The tests should have also been failing during the release on the mentioned platforms, but I cannot find any related discussion.

Most likely, the regression was introduced by glibc commit [[ https://github.com/bminor/glibc/commit/8ed005daf0ab03e142500324a34087ce179ae78e | 8ed005daf0ab03e14250032 ]]:
all stat-family functions are now exported as shared functions.

Before, some of them (namely stat, lstat, fstat, fstatat) were provided as a part of libc_noshared.a and called their __xstat dopplegangers. This is still true for Debian Sid and earlier Ubuntu's. stat interceptors may be safely provided for them, no problem with that.

Closes https://github.com/google/sanitizers/issues/1452.
See also https://jira.mariadb.org/browse/MDEV-24841

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D111984

(cherry picked from commit 4e1a6c07052b466a2a1cd0c3ff150e4e89a6d87a)


  Commit: abc0cf92bb14e1cf5a7f682dc5d3179e168ac145
      https://github.com/llvm/llvm-project/commit/abc0cf92bb14e1cf5a7f682dc5d3179e168ac145
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2021-12-21 (Tue, 21 Dec 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

  Log Message:
  -----------
  [sanitizer] Intercept lstat on Linux

It's availible from GLIBC 2.33
Fixes use-of-uninitialized-value llvm/lib/Support/Unix/Path.inc:467:29 in llvm::sys::fs::remove(llvm::Twine const&, bool)

(cherry picked from commit 39ead64e3f73045c7e0c72aed08c14b277828fb4)


Compare: https://github.com/llvm/llvm-project/compare/59289a837b00...abc0cf92bb14


More information about the All-commits mailing list