[all-commits] [llvm/llvm-project] 84de4f: GetMacosAlignedVersion() fails if sysctl is not setup

Julian Lettner via All-commits all-commits at lists.llvm.org
Fri Jan 15 11:44:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84de4faf4cae2885056c608db8256e9f039050b3
      https://github.com/llvm/llvm-project/commit/84de4faf4cae2885056c608db8256e9f039050b3
  Author: Julian Lettner <julian.lettner at apple.com>
  Date:   2021-01-15 (Fri, 15 Jan 2021)

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

  Log Message:
  -----------
  GetMacosAlignedVersion() fails if sysctl is not setup

`GetMacosAlignedVersion()` fails for ASan-ified launchd because the
sanitizer initialization code runs before `sysctl` has been setup by
launchd.  In this situation, `sysctl kern.osproductversion` returns a
non-empty string that does not match our expectations of a
well-formatted version string.

Retrieving the kernel version (via `sysctl kern.osrelease`) still works,
so we can use it to add a fallback for this corner case.

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




More information about the All-commits mailing list