[all-commits] [llvm/llvm-project] 8afb39: [sanitizer] Fix running sanitizer_bad_report_path_...

Ilya Leoshkevich via All-commits all-commits at lists.llvm.org
Thu Jul 18 00:28:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8afb395aeef5335554c623f92f48cbdc9ffe927d
      https://github.com/llvm/llvm-project/commit/8afb395aeef5335554c623f92f48cbdc9ffe927d
  Author: Ilya Leoshkevich <iii at linux.ibm.com>
  Date:   2024-07-18 (Thu, 18 Jul 2024)

  Changed paths:
    R compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_bad_report_path_test.cpp
    M compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp

  Log Message:
  -----------
  [sanitizer] Fix running sanitizer_bad_report_path_test on Linux as root (#97732)

Running tests as root is not the greatest idea, however, there is one
valid use case - running them in a container in order to verify LLVM on
different distros. There is no reason to configure unprivileged users
in a container, so one works as root.
    
sanitizer_bad_report_path_test assumes that creating a file in a
non-writable directory would fail, which is not the always case. For
example, when we are on Linux and CAP_DAC_OVERRIDE, which root has, is
in effect. Therefore, one solution is to drop it. However, that would
be Linux-specific.
    
Instead, use argv[0] as if it were a directory. mkdir() on top of a
file should be prohibited by all supported Posix operating systems.
Combine this with a partial revert of commit f4214e1469ad ("[sanitizer]
Skip test on Android where chmod is not working"), since we shouldn't
need to exclude Android anymore.



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