[all-commits] [llvm/llvm-project] d2ce7e: Revert "[sanitizer] Remove #include <linux/fs.h> t...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jul 11 12:53:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d2ce7e824df4d5fe78725770b264a22ac8f0677d
      https://github.com/llvm/llvm-project/commit/d2ce7e824df4d5fe78725770b264a22ac8f0677d
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

  Log Message:
  -----------
  Revert "[sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36"

This reverts commit b379129c4beb3f26223288627a1291739f33af02.

Breaks Android build. Android sys/mount.h doesn't define macros like BLKBSZGET.


  Commit: 9cf13067cb5088626ba7ee1ec4c42ec59c7995a0
      https://github.com/llvm/llvm-project/commit/9cf13067cb5088626ba7ee1ec4c42ec59c7995a0
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

  Log Message:
  -----------
  [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36

It is generally not a good idea to mix usage of glibc headers and Linux UAPI
headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
defines `fsconfig_command` which conflicts with linux/mount.h:

    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’

Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
Android sys/mount.h doesn't define BLKBSZGET and it still needs linux/fs.h.
In the long term we should move Linux specific definitions to sanitizer_platform_limits_linux.cpp
but this commit is easy to cherry pick into older compiler-rt releases.

Fix https://github.com/llvm/llvm-project/issues/56421

Reviewed By: #sanitizers, vitalybuka, zatrazz

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


Compare: https://github.com/llvm/llvm-project/compare/ce091eb3b91f...9cf13067cb50


More information about the All-commits mailing list