aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sanitizer_common
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:22 +0000
commit3a1720af1d7f43edc5b214cde0be11bfb94d077e (patch)
tree029e0ff2d5e3c0eaf2405fd8e669555fdf5e1297 /lib/sanitizer_common
parent8f3cadc28cb2bb9e8f9d69eeaaea1f57f2f7b2ab (diff)
downloadsrc-vendor/compiler-rt.tar.gz
src-vendor/compiler-rt.zip
Vendor import of stripped compiler-rt trunk r375505, the last commitvendor/compiler-rt/compiler-rt-trunk-r375505vendor/compiler-rt
before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/compiler-rt/trunk@375505
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=353944 svn path=/vendor/compiler-rt/compiler-rt-r375505/; revision=353945; tag=vendor/compiler-rt/compiler-rt-trunk-r375505
Diffstat (limited to 'lib/sanitizer_common')
-rw-r--r--lib/sanitizer_common/sancov_flags.cpp (renamed from lib/sanitizer_common/sancov_flags.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_allocator.cpp (renamed from lib/sanitizer_common/sanitizer_allocator.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_allocator_checks.cpp (renamed from lib/sanitizer_common/sanitizer_allocator_checks.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_allocator_checks.h2
-rw-r--r--lib/sanitizer_common/sanitizer_allocator_report.cpp (renamed from lib/sanitizer_common/sanitizer_allocator_report.cc)11
-rw-r--r--lib/sanitizer_common/sanitizer_asm.h4
-rw-r--r--lib/sanitizer_common/sanitizer_atomic_msvc.h63
-rw-r--r--lib/sanitizer_common/sanitizer_common.cpp (renamed from lib/sanitizer_common/sanitizer_common.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_common.h29
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc144
-rw-r--r--lib/sanitizer_common/sanitizer_common_interface.inc1
-rw-r--r--lib/sanitizer_common/sanitizer_common_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_common_libcdep.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_common_nolibc.cpp (renamed from lib/sanitizer_common/sanitizer_common_nolibc.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_common_syscalls.inc12
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_fuchsia.cc)8
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc)6
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_win_sections.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_win_sections.cc)14
-rw-r--r--lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cpp (renamed from lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_deadlock_detector1.cpp (renamed from lib/sanitizer_common/sanitizer_deadlock_detector1.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_deadlock_detector2.cpp (renamed from lib/sanitizer_common/sanitizer_deadlock_detector2.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_errno.cpp (renamed from lib/sanitizer_common/sanitizer_errno.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_file.cpp (renamed from lib/sanitizer_common/sanitizer_file.cc)6
-rw-r--r--lib/sanitizer_common/sanitizer_flag_parser.cpp (renamed from lib/sanitizer_common/sanitizer_flag_parser.cc)5
-rw-r--r--lib/sanitizer_common/sanitizer_flag_parser.h4
-rw-r--r--lib/sanitizer_common/sanitizer_flags.cpp (renamed from lib/sanitizer_common/sanitizer_flags.cc)6
-rw-r--r--lib/sanitizer_common/sanitizer_fuchsia.cpp (renamed from lib/sanitizer_common/sanitizer_fuchsia.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_getauxval.h30
-rw-r--r--lib/sanitizer_common/sanitizer_glibc_version.h26
-rw-r--r--lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc31
-rw-r--r--lib/sanitizer_common/sanitizer_internal_defs.h75
-rw-r--r--lib/sanitizer_common/sanitizer_libc.cpp (renamed from lib/sanitizer_common/sanitizer_libc.cc)13
-rw-r--r--lib/sanitizer_common/sanitizer_libignore.cpp (renamed from lib/sanitizer_common/sanitizer_libignore.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_linux.cpp (renamed from lib/sanitizer_common/sanitizer_linux.cc)47
-rw-r--r--lib/sanitizer_common/sanitizer_linux_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_linux_libcdep.cc)9
-rw-r--r--lib/sanitizer_common/sanitizer_linux_s390.cpp (renamed from lib/sanitizer_common/sanitizer_linux_s390.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_mac.cpp (renamed from lib/sanitizer_common/sanitizer_mac.cc)126
-rw-r--r--lib/sanitizer_common/sanitizer_mac_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_mac_libcdep.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_malloc_mac.inc11
-rw-r--r--lib/sanitizer_common/sanitizer_netbsd.cpp (renamed from lib/sanitizer_common/sanitizer_netbsd.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_openbsd.cpp (renamed from lib/sanitizer_common/sanitizer_openbsd.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_persistent_allocator.cpp (renamed from lib/sanitizer_common/sanitizer_persistent_allocator.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_platform_interceptors.h24
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_freebsd.h1090
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_linux.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_linux.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc)60
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_netbsd.h47
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_openbsd.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_openbsd.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_posix.cc)17
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.h2168
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp (renamed from lib/sanitizer_common/sanitizer_platform_limits_solaris.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_solaris.h7
-rw-r--r--lib/sanitizer_common/sanitizer_posix.cpp (renamed from lib/sanitizer_common/sanitizer_posix.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_posix.h2
-rw-r--r--lib/sanitizer_common/sanitizer_posix_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_posix_libcdep.cc)37
-rw-r--r--lib/sanitizer_common/sanitizer_printf.cpp (renamed from lib/sanitizer_common/sanitizer_printf.cc)8
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps.h2
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_bsd.cpp (renamed from lib/sanitizer_common/sanitizer_procmaps_bsd.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_common.cpp (renamed from lib/sanitizer_common/sanitizer_procmaps_common.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_linux.cpp (renamed from lib/sanitizer_common/sanitizer_procmaps_linux.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_mac.cpp (renamed from lib/sanitizer_common/sanitizer_procmaps_mac.cc)27
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_solaris.cpp (renamed from lib/sanitizer_common/sanitizer_procmaps_solaris.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_rtems.cpp (renamed from lib/sanitizer_common/sanitizer_rtems.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_solaris.cpp (renamed from lib/sanitizer_common/sanitizer_solaris.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_stackdepot.cpp (renamed from lib/sanitizer_common/sanitizer_stackdepot.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace.cpp (renamed from lib/sanitizer_common/sanitizer_stacktrace.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc)7
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace_printer.cpp (renamed from lib/sanitizer_common/sanitizer_stacktrace_printer.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp (renamed from lib/sanitizer_common/sanitizer_stacktrace_sparc.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc)7
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp (renamed from lib/sanitizer_common/sanitizer_stoptheworld_mac.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_suppressions.cpp (renamed from lib/sanitizer_common/sanitizer_suppressions.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_suppressions.h2
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_internal.h19
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc)11
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_mac.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_mac.cc)9
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_markup.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_markup.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc)84
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_report.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_report.cc)22
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_win.cpp (renamed from lib/sanitizer_common/sanitizer_symbolizer_win.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_termination.cpp (renamed from lib/sanitizer_common/sanitizer_termination.cc)4
-rw-r--r--lib/sanitizer_common/sanitizer_thread_registry.cpp (renamed from lib/sanitizer_common/sanitizer_thread_registry.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_tls_get_addr.cpp (renamed from lib/sanitizer_common/sanitizer_tls_get_addr.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_tls_get_addr.h2
-rw-r--r--lib/sanitizer_common/sanitizer_type_traits.cpp (renamed from lib/sanitizer_common/sanitizer_type_traits.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp (renamed from lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc)70
-rw-r--r--lib/sanitizer_common/sanitizer_unwind_win.cpp (renamed from lib/sanitizer_common/sanitizer_unwind_win.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_vector.h6
-rw-r--r--lib/sanitizer_common/sanitizer_win.cpp (renamed from lib/sanitizer_common/sanitizer_win.cc)19
-rw-r--r--lib/sanitizer_common/sanitizer_win_defs.h12
-rw-r--r--lib/sanitizer_common/sanitizer_win_dll_thunk.cpp (renamed from lib/sanitizer_common/sanitizer_win_dll_thunk.cc)10
-rw-r--r--lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cpp (renamed from lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc)2
-rw-r--r--lib/sanitizer_common/sanitizer_win_weak_interception.cpp (renamed from lib/sanitizer_common/sanitizer_win_weak_interception.cc)11
-rw-r--r--lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp (renamed from lib/sanitizer_common/symbolizer/sanitizer_symbolize.cc)4
-rw-r--r--lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp (renamed from lib/sanitizer_common/symbolizer/sanitizer_wrappers.cc)2
-rwxr-xr-xlib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh34
-rw-r--r--lib/sanitizer_common/symbolizer/scripts/global_symbols.txt7
102 files changed, 2539 insertions, 2079 deletions
diff --git a/lib/sanitizer_common/sancov_flags.cc b/lib/sanitizer_common/sancov_flags.cpp
index ec6c14b1e2e4..ed46e88acdfc 100644
--- a/lib/sanitizer_common/sancov_flags.cc
+++ b/lib/sanitizer_common/sancov_flags.cpp
@@ -1,4 +1,4 @@
-//===-- sancov_flags.cc -----------------------------------------*- C++ -*-===//
+//===-- sancov_flags.cpp ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cpp
index 1739bb66b657..8d07906cca03 100644
--- a/lib/sanitizer_common/sanitizer_allocator.cc
+++ b/lib/sanitizer_common/sanitizer_allocator.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_allocator.cc --------------------------------------------===//
+//===-- sanitizer_allocator.cpp -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_allocator_checks.cc b/lib/sanitizer_common/sanitizer_allocator_checks.cpp
index bb56010f1074..9d67f679b56c 100644
--- a/lib/sanitizer_common/sanitizer_allocator_checks.cc
+++ b/lib/sanitizer_common/sanitizer_allocator_checks.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_allocator_checks.cc ---------------------------*- C++ -*-===//
+//===-- sanitizer_allocator_checks.cpp --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_allocator_checks.h b/lib/sanitizer_common/sanitizer_allocator_checks.h
index f436ce9ecdea..fc426f0e74f4 100644
--- a/lib/sanitizer_common/sanitizer_allocator_checks.h
+++ b/lib/sanitizer_common/sanitizer_allocator_checks.h
@@ -54,7 +54,7 @@ INLINE bool CheckAlignedAllocAlignmentAndSize(uptr alignment, uptr size) {
// and a multiple of sizeof(void *).
INLINE bool CheckPosixMemalignAlignment(uptr alignment) {
return alignment != 0 && IsPowerOfTwo(alignment) &&
- (alignment % sizeof(void *)) == 0; // NOLINT
+ (alignment % sizeof(void *)) == 0;
}
// Returns true if calloc(size, n) call overflows on size*n calculation.
diff --git a/lib/sanitizer_common/sanitizer_allocator_report.cc b/lib/sanitizer_common/sanitizer_allocator_report.cpp
index dfc418166556..d74e08010d5d 100644
--- a/lib/sanitizer_common/sanitizer_allocator_report.cc
+++ b/lib/sanitizer_common/sanitizer_allocator_report.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_allocator_report.cc ---------------------------*- C++ -*-===//
+//===-- sanitizer_allocator_report.cpp --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -106,10 +106,11 @@ void NORETURN ReportInvalidPosixMemalignAlignment(uptr alignment,
{
ScopedAllocatorErrorReport report("invalid-posix-memalign-alignment",
stack);
- Report("ERROR: %s: invalid alignment requested in "
- "posix_memalign: %zd, alignment must be a power of two and a "
- "multiple of sizeof(void*) == %zd\n", SanitizerToolName, alignment,
- sizeof(void*)); // NOLINT
+ Report(
+ "ERROR: %s: invalid alignment requested in "
+ "posix_memalign: %zd, alignment must be a power of two and a "
+ "multiple of sizeof(void*) == %zd\n",
+ SanitizerToolName, alignment, sizeof(void *));
}
Die();
}
diff --git a/lib/sanitizer_common/sanitizer_asm.h b/lib/sanitizer_common/sanitizer_asm.h
index 184d118d97d8..803af3285e18 100644
--- a/lib/sanitizer_common/sanitizer_asm.h
+++ b/lib/sanitizer_common/sanitizer_asm.h
@@ -60,7 +60,9 @@
#if defined(__ELF__) && (defined(__GNU__) || defined(__FreeBSD__) || \
defined(__Fuchsia__) || defined(__linux__))
-#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits // NOLINT
+// clang-format off
+#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits // NOLINT
+// clang-format on
#else
#define NO_EXEC_STACK_DIRECTIVE
#endif
diff --git a/lib/sanitizer_common/sanitizer_atomic_msvc.h b/lib/sanitizer_common/sanitizer_atomic_msvc.h
index a249657d6617..6a7c5465dcbb 100644
--- a/lib/sanitizer_common/sanitizer_atomic_msvc.h
+++ b/lib/sanitizer_common/sanitizer_atomic_msvc.h
@@ -20,44 +20,35 @@ extern "C" void _mm_mfence();
#pragma intrinsic(_mm_mfence)
extern "C" void _mm_pause();
#pragma intrinsic(_mm_pause)
-extern "C" char _InterlockedExchange8( // NOLINT
- char volatile *Addend, char Value); // NOLINT
+extern "C" char _InterlockedExchange8(char volatile *Addend, char Value);
#pragma intrinsic(_InterlockedExchange8)
-extern "C" short _InterlockedExchange16( // NOLINT
- short volatile *Addend, short Value); // NOLINT
+extern "C" short _InterlockedExchange16(short volatile *Addend, short Value);
#pragma intrinsic(_InterlockedExchange16)
-extern "C" long _InterlockedExchange( // NOLINT
- long volatile *Addend, long Value); // NOLINT
+extern "C" long _InterlockedExchange(long volatile *Addend, long Value);
#pragma intrinsic(_InterlockedExchange)
-extern "C" long _InterlockedExchangeAdd( // NOLINT
- long volatile * Addend, long Value); // NOLINT
+extern "C" long _InterlockedExchangeAdd(long volatile *Addend, long Value);
#pragma intrinsic(_InterlockedExchangeAdd)
-extern "C" char _InterlockedCompareExchange8( // NOLINT
- char volatile *Destination, // NOLINT
- char Exchange, char Comparand); // NOLINT
+extern "C" char _InterlockedCompareExchange8(char volatile *Destination,
+ char Exchange, char Comparand);
#pragma intrinsic(_InterlockedCompareExchange8)
-extern "C" short _InterlockedCompareExchange16( // NOLINT
- short volatile *Destination, // NOLINT
- short Exchange, short Comparand); // NOLINT
+extern "C" short _InterlockedCompareExchange16(short volatile *Destination,
+ short Exchange, short Comparand);
#pragma intrinsic(_InterlockedCompareExchange16)
-extern "C"
-long long _InterlockedCompareExchange64( // NOLINT
- long long volatile *Destination, // NOLINT
- long long Exchange, long long Comparand); // NOLINT
+extern "C" long long _InterlockedCompareExchange64(
+ long long volatile *Destination, long long Exchange, long long Comparand);
#pragma intrinsic(_InterlockedCompareExchange64)
extern "C" void *_InterlockedCompareExchangePointer(
void *volatile *Destination,
void *Exchange, void *Comparand);
#pragma intrinsic(_InterlockedCompareExchangePointer)
-extern "C"
-long __cdecl _InterlockedCompareExchange( // NOLINT
- long volatile *Destination, // NOLINT
- long Exchange, long Comparand); // NOLINT
+extern "C" long __cdecl _InterlockedCompareExchange(long volatile *Destination,
+ long Exchange,
+ long Comparand);
#pragma intrinsic(_InterlockedCompareExchange)
#ifdef _WIN64
-extern "C" long long _InterlockedExchangeAdd64( // NOLINT
- long long volatile * Addend, long long Value); // NOLINT
+extern "C" long long _InterlockedExchangeAdd64(long long volatile *Addend,
+ long long Value);
#pragma intrinsic(_InterlockedExchangeAdd64)
#endif
@@ -115,8 +106,8 @@ INLINE u32 atomic_fetch_add(volatile atomic_uint32_t *a,
u32 v, memory_order mo) {
(void)mo;
DCHECK(!((uptr)a % sizeof(*a)));
- return (u32)_InterlockedExchangeAdd(
- (volatile long*)&a->val_dont_use, (long)v); // NOLINT
+ return (u32)_InterlockedExchangeAdd((volatile long *)&a->val_dont_use,
+ (long)v);
}
INLINE uptr atomic_fetch_add(volatile atomic_uintptr_t *a,
@@ -124,11 +115,11 @@ INLINE uptr atomic_fetch_add(volatile atomic_uintptr_t *a,
(void)mo;
DCHECK(!((uptr)a % sizeof(*a)));
#ifdef _WIN64
- return (uptr)_InterlockedExchangeAdd64(
- (volatile long long*)&a->val_dont_use, (long long)v); // NOLINT
+ return (uptr)_InterlockedExchangeAdd64((volatile long long *)&a->val_dont_use,
+ (long long)v);
#else
- return (uptr)_InterlockedExchangeAdd(
- (volatile long*)&a->val_dont_use, (long)v); // NOLINT
+ return (uptr)_InterlockedExchangeAdd((volatile long *)&a->val_dont_use,
+ (long)v);
#endif
}
@@ -136,8 +127,8 @@ INLINE u32 atomic_fetch_sub(volatile atomic_uint32_t *a,
u32 v, memory_order mo) {
(void)mo;
DCHECK(!((uptr)a % sizeof(*a)));
- return (u32)_InterlockedExchangeAdd(
- (volatile long*)&a->val_dont_use, -(long)v); // NOLINT
+ return (u32)_InterlockedExchangeAdd((volatile long *)&a->val_dont_use,
+ -(long)v);
}
INLINE uptr atomic_fetch_sub(volatile atomic_uintptr_t *a,
@@ -145,11 +136,11 @@ INLINE uptr atomic_fetch_sub(volatile atomic_uintptr_t *a,
(void)mo;
DCHECK(!((uptr)a % sizeof(*a)));
#ifdef _WIN64
- return (uptr)_InterlockedExchangeAdd64(
- (volatile long long*)&a->val_dont_use, -(long long)v); // NOLINT
+ return (uptr)_InterlockedExchangeAdd64((volatile long long *)&a->val_dont_use,
+ -(long long)v);
#else
- return (uptr)_InterlockedExchangeAdd(
- (volatile long*)&a->val_dont_use, -(long)v); // NOLINT
+ return (uptr)_InterlockedExchangeAdd((volatile long *)&a->val_dont_use,
+ -(long)v);
#endif
}
diff --git a/lib/sanitizer_common/sanitizer_common.cc b/lib/sanitizer_common/sanitizer_common.cpp
index 80fb8f60fc0b..f5f9f49d8cff 100644
--- a/lib/sanitizer_common/sanitizer_common.cc
+++ b/lib/sanitizer_common/sanitizer_common.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_common.cc -----------------------------------------------===//
+//===-- sanitizer_common.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -323,7 +323,7 @@ static int InstallMallocFreeHooks(void (*malloc_hook)(const void *, uptr),
} // namespace __sanitizer
-using namespace __sanitizer; // NOLINT
+using namespace __sanitizer;
extern "C" {
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_report_error_summary,
diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h
index 1703899e32b5..87b8f02b5b73 100644
--- a/lib/sanitizer_common/sanitizer_common.h
+++ b/lib/sanitizer_common/sanitizer_common.h
@@ -100,6 +100,8 @@ void UnmapOrDie(void *addr, uptr size);
void *MmapOrDieOnFatalError(uptr size, const char *mem_type);
bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name = nullptr)
WARN_UNUSED_RESULT;
+bool MmapFixedSuperNoReserve(uptr fixed_addr, uptr size,
+ const char *name = nullptr) WARN_UNUSED_RESULT;
void *MmapNoReserveOrDie(uptr size, const char *mem_type);
void *MmapFixedOrDie(uptr fixed_addr, uptr size, const char *name = nullptr);
// Behaves just like MmapFixedOrDie, but tolerates out of memory condition, in
@@ -131,7 +133,7 @@ void ReleaseMemoryPagesToOS(uptr beg, uptr end);
void IncreaseTotalMmap(uptr size);
void DecreaseTotalMmap(uptr size);
uptr GetRSS();
-bool NoHugePagesInRegion(uptr addr, uptr length);
+void SetShadowRegionHugePageMode(uptr addr, uptr length);
bool DontDumpShadowMemory(uptr addr, uptr length);
// Check if the built VMA size matches the runtime one.
void CheckVMASize();
@@ -337,18 +339,18 @@ void ReportMmapWriteExec(int prot);
// Math
#if SANITIZER_WINDOWS && !defined(__clang__) && !defined(__GNUC__)
extern "C" {
-unsigned char _BitScanForward(unsigned long *index, unsigned long mask); // NOLINT
-unsigned char _BitScanReverse(unsigned long *index, unsigned long mask); // NOLINT
+unsigned char _BitScanForward(unsigned long *index, unsigned long mask);
+unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
#if defined(_WIN64)
-unsigned char _BitScanForward64(unsigned long *index, unsigned __int64 mask); // NOLINT
-unsigned char _BitScanReverse64(unsigned long *index, unsigned __int64 mask); // NOLINT
+unsigned char _BitScanForward64(unsigned long *index, unsigned __int64 mask);
+unsigned char _BitScanReverse64(unsigned long *index, unsigned __int64 mask);
#endif
}
#endif
INLINE uptr MostSignificantSetBitIndex(uptr x) {
CHECK_NE(x, 0U);
- unsigned long up; // NOLINT
+ unsigned long up;
#if !SANITIZER_WINDOWS || defined(__clang__) || defined(__GNUC__)
# ifdef _WIN64
up = SANITIZER_WORDSIZE - 1 - __builtin_clzll(x);
@@ -365,7 +367,7 @@ INLINE uptr MostSignificantSetBitIndex(uptr x) {
INLINE uptr LeastSignificantSetBitIndex(uptr x) {
CHECK_NE(x, 0U);
- unsigned long up; // NOLINT
+ unsigned long up;
#if !SANITIZER_WINDOWS || defined(__clang__) || defined(__GNUC__)
# ifdef _WIN64
up = __builtin_ctzll(x);
@@ -669,7 +671,7 @@ bool ReadFileToBuffer(const char *file_name, char **buff, uptr *buff_size,
error_t *errno_p = nullptr);
// When adding a new architecture, don't forget to also update
-// script/asan_symbolize.py and sanitizer_symbolizer_libcdep.cc.
+// script/asan_symbolize.py and sanitizer_symbolizer_libcdep.cpp.
inline const char *ModuleArchToString(ModuleArch arch) {
switch (arch) {
case kModuleArchUnknown:
@@ -879,6 +881,11 @@ struct SignalContext {
bool is_memory_access;
enum WriteFlag { UNKNOWN, READ, WRITE } write_flag;
+ // In some cases the kernel cannot provide the true faulting address; `addr`
+ // will be zero then. This field allows to distinguish between these cases
+ // and dereferences of null.
+ bool is_true_faulting_addr;
+
// VS2013 doesn't implement unrestricted unions, so we need a trivial default
// constructor
SignalContext() = default;
@@ -891,7 +898,8 @@ struct SignalContext {
context(context),
addr(GetAddress()),
is_memory_access(IsMemoryAccess()),
- write_flag(GetWriteFlag()) {
+ write_flag(GetWriteFlag()),
+ is_true_faulting_addr(IsTrueFaultingAddress()) {
InitPcSpBp();
}
@@ -912,6 +920,7 @@ struct SignalContext {
uptr GetAddress() const;
WriteFlag GetWriteFlag() const;
bool IsMemoryAccess() const;
+ bool IsTrueFaultingAddress() const;
};
void InitializePlatformEarly();
@@ -971,7 +980,7 @@ INLINE u32 GetNumberOfCPUsCached() {
} // namespace __sanitizer
inline void *operator new(__sanitizer::operator_new_size_type size,
- __sanitizer::LowLevelAllocator &alloc) {
+ __sanitizer::LowLevelAllocator &alloc) { // NOLINT
return alloc.Allocate(size);
}
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 9f5a91ac99dc..50e3558b52e8 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -36,6 +36,7 @@
// COMMON_INTERCEPTOR_MMAP_IMPL
// COMMON_INTERCEPTOR_COPY_STRING
// COMMON_INTERCEPTOR_STRNDUP_IMPL
+// COMMON_INTERCEPTOR_STRERROR
//===----------------------------------------------------------------------===//
#include "interception/interception.h"
@@ -301,6 +302,10 @@ bool PlatformHasDifferentMemcpyAndMemmove();
return new_mem;
#endif
+#ifndef COMMON_INTERCEPTOR_STRERROR
+#define COMMON_INTERCEPTOR_STRERROR() {}
+#endif
+
struct FileMetadata {
// For open_memstream().
char **addr;
@@ -317,11 +322,11 @@ struct CommonInterceptorMetadata {
};
};
+#if SI_POSIX
typedef AddrHashMap<CommonInterceptorMetadata, 31051> MetadataHashMap;
static MetadataHashMap *interceptor_metadata_map;
-#if SI_POSIX
UNUSED static void SetInterceptorMetadata(__sanitizer_FILE *addr,
const FileMetadata &file) {
MetadataHashMap::Handle h(interceptor_metadata_map, (uptr)addr);
@@ -1241,8 +1246,9 @@ INTERCEPTOR_WITH_SUFFIX(int, fputs, char *s, void *file) {
// libc file streams can call user-supplied functions, see fopencookie.
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, fputs, s, file);
- if (!SANITIZER_MAC || s)
+ if (!SANITIZER_MAC || s) { // `fputs(NULL, file)` is supported on Darwin.
COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
+ }
return REAL(fputs)(s, file);
}
#define INIT_FPUTS COMMON_INTERCEPT_FUNCTION(fputs)
@@ -1255,8 +1261,9 @@ INTERCEPTOR(int, puts, char *s) {
// libc file streams can call user-supplied functions, see fopencookie.
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, puts, s);
- if (!SANITIZER_MAC || s)
+ if (!SANITIZER_MAC || s) { // `puts(NULL)` is supported on Darwin.
COMMON_INTERCEPTOR_READ_RANGE(ctx, s, REAL(strlen)(s) + 1);
+ }
return REAL(puts)(s);
}
#define INIT_PUTS COMMON_INTERCEPT_FUNCTION(puts)
@@ -1265,9 +1272,8 @@ INTERCEPTOR(int, puts, char *s) {
#endif
#if SANITIZER_INTERCEPT_PRCTL
-INTERCEPTOR(int, prctl, int option, unsigned long arg2,
- unsigned long arg3, // NOLINT
- unsigned long arg4, unsigned long arg5) { // NOLINT
+INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
+ unsigned long arg4, unsigned long arg5) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, prctl, option, arg2, arg3, arg4, arg5);
static const int PR_SET_NAME = 15;
@@ -1699,13 +1705,13 @@ INTERCEPTOR(int, __fprintf_chk, __sanitizer_FILE *stream, SIZE_T size,
FORMAT_INTERCEPTOR_IMPL(__fprintf_chk, vfprintf, stream, format)
#endif
-INTERCEPTOR(int, sprintf, char *str, const char *format, ...) // NOLINT
-FORMAT_INTERCEPTOR_IMPL(sprintf, vsprintf, str, format) // NOLINT
+INTERCEPTOR(int, sprintf, char *str, const char *format, ...)
+FORMAT_INTERCEPTOR_IMPL(sprintf, vsprintf, str, format)
#if SANITIZER_INTERCEPT___PRINTF_CHK
INTERCEPTOR(int, __sprintf_chk, char *str, int flag, SIZE_T size_to,
- const char *format, ...) // NOLINT
-FORMAT_INTERCEPTOR_IMPL(__sprintf_chk, vsprintf, str, format) // NOLINT
+ const char *format, ...)
+FORMAT_INTERCEPTOR_IMPL(__sprintf_chk, vsprintf, str, format)
#endif
INTERCEPTOR(int, snprintf, char *str, SIZE_T size, const char *format, ...)
@@ -1713,8 +1719,8 @@ FORMAT_INTERCEPTOR_IMPL(snprintf, vsnprintf, str, size, format)
#if SANITIZER_INTERCEPT___PRINTF_CHK
INTERCEPTOR(int, __snprintf_chk, char *str, SIZE_T size, int flag,
- SIZE_T size_to, const char *format, ...) // NOLINT
-FORMAT_INTERCEPTOR_IMPL(__snprintf_chk, vsnprintf, str, size, format) // NOLINT
+ SIZE_T size_to, const char *format, ...)
+FORMAT_INTERCEPTOR_IMPL(__snprintf_chk, vsnprintf, str, size, format)
#endif
INTERCEPTOR(int, asprintf, char **strp, const char *format, ...)
@@ -3069,13 +3075,14 @@ INTERCEPTOR(int, sendmmsg, int fd, struct __sanitizer_mmsghdr *msgvec,
COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd);
}
int res = REAL(sendmmsg)(fd, msgvec, vlen, flags);
- if (res >= 0 && msgvec)
+ if (res >= 0 && msgvec) {
for (int i = 0; i < res; ++i) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, &msgvec[i].msg_len,
sizeof(msgvec[i].msg_len));
if (common_flags()->intercept_send)
read_msghdr(ctx, &msgvec[i].msg_hdr, msgvec[i].msg_len);
}
+ }
return res;
}
#define INIT_SENDMMSG COMMON_INTERCEPT_FUNCTION(sendmmsg);
@@ -3206,20 +3213,21 @@ INTERCEPTOR(uptr, ptrace, int request, int pid, void *addr, void *data) {
__sanitizer_iovec local_iovec;
if (data) {
- if (request == ptrace_setregs)
+ if (request == ptrace_setregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_regs_struct_sz);
- else if (request == ptrace_setfpregs)
+ } else if (request == ptrace_setfpregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_fpregs_struct_sz);
- else if (request == ptrace_setfpxregs)
+ } else if (request == ptrace_setfpxregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_fpxregs_struct_sz);
- else if (request == ptrace_setvfpregs)
+ } else if (request == ptrace_setvfpregs) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_vfpregs_struct_sz);
- else if (request == ptrace_setsiginfo)
+ } else if (request == ptrace_setsiginfo) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, data, siginfo_t_sz);
+
// Some kernel might zero the iovec::iov_base in case of invalid
// write access. In this case copy the invalid address for further
// inspection.
- else if (request == ptrace_setregset || request == ptrace_getregset) {
+ } else if (request == ptrace_setregset || request == ptrace_getregset) {
__sanitizer_iovec *iovec = (__sanitizer_iovec*)data;
COMMON_INTERCEPTOR_READ_RANGE(ctx, iovec, sizeof(*iovec));
local_iovec = *iovec;
@@ -3236,19 +3244,19 @@ INTERCEPTOR(uptr, ptrace, int request, int pid, void *addr, void *data) {
if (!res && data) {
// Note that PEEK* requests assign different meaning to the return value.
// This function does not handle them (nor does it need to).
- if (request == ptrace_getregs)
+ if (request == ptrace_getregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_regs_struct_sz);
- else if (request == ptrace_getfpregs)
+ } else if (request == ptrace_getfpregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_fpregs_struct_sz);
- else if (request == ptrace_getfpxregs)
+ } else if (request == ptrace_getfpxregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_fpxregs_struct_sz);
- else if (request == ptrace_getvfpregs)
+ } else if (request == ptrace_getvfpregs) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_vfpregs_struct_sz);
- else if (request == ptrace_getsiginfo)
+ } else if (request == ptrace_getsiginfo) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, siginfo_t_sz);
- else if (request == ptrace_geteventmsg)
+ } else if (request == ptrace_geteventmsg) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, sizeof(unsigned long));
- else if (request == ptrace_getregset) {
+ } else if (request == ptrace_getregset) {
__sanitizer_iovec *iovec = (__sanitizer_iovec*)data;
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, iovec, sizeof(*iovec));
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, local_iovec.iov_base,
@@ -3674,6 +3682,7 @@ INTERCEPTOR(int, sched_getparam, int pid, void *param) {
INTERCEPTOR(char *, strerror, int errnum) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, strerror, errnum);
+ COMMON_INTERCEPTOR_STRERROR();
char *res = REAL(strerror)(errnum);
if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
return res;
@@ -6714,7 +6723,7 @@ INTERCEPTOR(wchar_t *, wcscat, wchar_t *dst, const wchar_t *src) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, dst, (dst_size + 1) * sizeof(wchar_t));
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst + dst_size,
(src_size + 1) * sizeof(wchar_t));
- return REAL(wcscat)(dst, src); // NOLINT
+ return REAL(wcscat)(dst, src);
}
INTERCEPTOR(wchar_t *, wcsncat, wchar_t *dst, const wchar_t *src, SIZE_T n) {
@@ -6727,7 +6736,7 @@ INTERCEPTOR(wchar_t *, wcsncat, wchar_t *dst, const wchar_t *src, SIZE_T n) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, dst, (dst_size + 1) * sizeof(wchar_t));
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst + dst_size,
(src_size + 1) * sizeof(wchar_t));
- return REAL(wcsncat)(dst, src, n); // NOLINT
+ return REAL(wcsncat)(dst, src, n);
}
#define INIT_WCSCAT \
COMMON_INTERCEPT_FUNCTION(wcscat); \
@@ -7841,10 +7850,11 @@ INTERCEPTOR(int, modctl, int operation, void *argp) {
if (iov)
COMMON_INTERCEPTOR_WRITE_RANGE(
ctx, iov->iov_base, Min(iov_len, iov->iov_len));
- } else if (operation == modctl_exists)
+ } else if (operation == modctl_exists) {
ret = REAL(modctl)(operation, argp);
- else
+ } else {
ret = REAL(modctl)(operation, argp);
+ }
return ret;
}
@@ -9548,10 +9558,76 @@ INTERCEPTOR(void, sl_free, void *sl, int freeall) {
#define INIT_SL_INIT
#endif
+#if SANITIZER_INTERCEPT_GETRANDOM
+INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, getrandom, buf, buflen, flags);
+ SSIZE_T n = REAL(getrandom)(buf, buflen, flags);
+ if (n > 0) {
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, n);
+ }
+ return n;
+}
+#define INIT_GETRANDOM COMMON_INTERCEPT_FUNCTION(getrandom)
+#else
+#define INIT_GETRANDOM
+#endif
+
+#if SANITIZER_INTERCEPT_CRYPT
+INTERCEPTOR(char *, crypt, char *key, char *salt) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt);
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
+ char *res = REAL(crypt)(key, salt);
+ if (res != nullptr)
+ COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
+ return res;
+}
+#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt);
+#else
+#define INIT_CRYPT
+#endif
+
+#if SANITIZER_INTERCEPT_CRYPT_R
+INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data);
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
+ char *res = REAL(crypt_r)(key, salt, data);
+ if (res != nullptr) {
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data,
+ __sanitizer::struct_crypt_data_sz);
+ COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
+ }
+ return res;
+}
+#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r);
+#else
+#define INIT_CRYPT_R
+#endif
+
+#if SANITIZER_INTERCEPT_GETENTROPY
+INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, getentropy, buf, buflen);
+ int r = REAL(getentropy)(buf, buflen);
+ if (r == 0) {
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, buflen);
+ }
+ return r;
+}
+#define INIT_GETENTROPY COMMON_INTERCEPT_FUNCTION(getentropy)
+#else
+#define INIT_GETENTROPY
+#endif
+
static void InitializeCommonInterceptors() {
+#if SI_POSIX
static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
- interceptor_metadata_map =
- new ((void *)&metadata_mem) MetadataHashMap(); // NOLINT
+ interceptor_metadata_map = new ((void *)&metadata_mem) MetadataHashMap();
+#endif
INIT_MMAP;
INIT_MMAP64;
@@ -9844,6 +9920,10 @@ static void InitializeCommonInterceptors() {
INIT_FDEVNAME;
INIT_GETUSERSHELL;
INIT_SL_INIT;
+ INIT_GETRANDOM;
+ INIT_CRYPT;
+ INIT_CRYPT_R;
+ INIT_GETENTROPY;
INIT___PRINTF_CHK;
}
diff --git a/lib/sanitizer_common/sanitizer_common_interface.inc b/lib/sanitizer_common/sanitizer_common_interface.inc
index c72554973b05..c78b6e10b689 100644
--- a/lib/sanitizer_common/sanitizer_common_interface.inc
+++ b/lib/sanitizer_common/sanitizer_common_interface.inc
@@ -14,6 +14,7 @@ INTERFACE_FUNCTION(__sanitizer_set_death_callback)
INTERFACE_FUNCTION(__sanitizer_set_report_path)
INTERFACE_FUNCTION(__sanitizer_set_report_fd)
INTERFACE_FUNCTION(__sanitizer_verify_contiguous_container)
+INTERFACE_WEAK_FUNCTION(__sanitizer_on_print)
INTERFACE_WEAK_FUNCTION(__sanitizer_report_error_summary)
INTERFACE_WEAK_FUNCTION(__sanitizer_sandbox_on_notify)
// Sanitizer weak hooks
diff --git a/lib/sanitizer_common/sanitizer_common_libcdep.cc b/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index 363eb4c146ce..27d6a177760e 100644
--- a/lib/sanitizer_common/sanitizer_common_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_common_libcdep.cc ---------------------------------------===//
+//===-- sanitizer_common_libcdep.cpp --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_common_nolibc.cc b/lib/sanitizer_common/sanitizer_common_nolibc.cpp
index fdd858781216..3b278e017eb7 100644
--- a/lib/sanitizer_common/sanitizer_common_nolibc.cc
+++ b/lib/sanitizer_common/sanitizer_common_nolibc.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_common_nolibc.cc ----------------------------------------===//
+//===-- sanitizer_common_nolibc.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 00bb2aeef111..31ff48cfd2cf 100644
--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -2873,6 +2873,18 @@ POST_SYSCALL(rt_sigaction)(long res, long signum,
POST_WRITE(oldact, oldact_sz);
}
}
+
+PRE_SYSCALL(getrandom)(void *buf, uptr count, long flags) {
+ if (buf) {
+ PRE_WRITE(buf, count);
+ }
+}
+
+POST_SYSCALL(getrandom)(long res, void *buf, uptr count, long flags) {
+ if (res > 0 && buf) {
+ POST_WRITE(buf, res);
+ }
+}
} // extern "C"
#undef PRE_SYSCALL
diff --git a/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc b/lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp
index 2c7180122148..f18cee66b843 100644
--- a/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_fuchsia.cc -------------------------------------===//
+//===-- sanitizer_coverage_fuchsia.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -36,7 +36,7 @@
#include <zircon/sanitizer.h>
#include <zircon/syscalls.h>
-using namespace __sanitizer; // NOLINT
+using namespace __sanitizer;
namespace __sancov {
namespace {
@@ -198,8 +198,8 @@ void InitializeCoverage(bool enabled, const char *dir) {
} // namespace __sanitizer
extern "C" {
-SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage( // NOLINT
- const uptr *pcs, uptr len) {
+SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage(const uptr *pcs,
+ uptr len) {
UNIMPLEMENTED();
}
diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc b/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
index 9dbf2eb52978..6a75792f9262 100644
--- a/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_libcdep_new.cc ---------------------------------===//
+//===-- sanitizer_coverage_libcdep_new.cpp --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -166,8 +166,8 @@ void InitializeCoverage(bool enabled, const char *dir) {
} // namespace __sanitizer
extern "C" {
-SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage( // NOLINT
- const uptr* pcs, uptr len) {
+SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage(const uptr* pcs,
+ uptr len) {
return __sancov::SanitizerDumpCoverage(pcs, len);
}
diff --git a/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cc b/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cpp
index 1f0f69dc43eb..d0bf8a455643 100644
--- a/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_win_dll_thunk.cc -------------------------------===//
+//===-- sanitizer_coverage_win_dll_thunk.cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc b/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cpp
index 2a4199756f3b..0bdf0c5aed41 100644
--- a/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_win_dynamic_runtime_thunk.cc -------------------===//
+//===-- sanitizer_coverage_win_dynamic_runtime_thunk.cpp ------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_coverage_win_sections.cc b/lib/sanitizer_common/sanitizer_coverage_win_sections.cpp
index 403d46c8c4f1..e7d6563393cf 100644
--- a/lib/sanitizer_common/sanitizer_coverage_win_sections.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_win_sections.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_win_sections.cc --------------------------------===//
+//===-- sanitizer_coverage_win_sections.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -31,7 +31,7 @@ extern "C" {
// Use uint64_t so the linker won't need to add any padding if it tries to word
// align the start of the 8-bit counters array. The array will always start 8
// bytes after __start_sancov_cntrs.
-#pragma section(".SCOV$CA", read, write) // NOLINT
+#pragma section(".SCOV$CA", read, write)
__declspec(allocate(".SCOV$CA")) uint64_t __start___sancov_cntrs = 0;
// Even though we said not to align __stop__sancov_cntrs (using the "align"
@@ -41,13 +41,13 @@ __declspec(allocate(".SCOV$CA")) uint64_t __start___sancov_cntrs = 0;
// padding would be added to align .SCOVP$Z, However, if .SCOV$CZ section is 1
// byte, the linker won't try to align it on an 8-byte boundary, so use a
// uint8_t for __stop_sancov_cntrs.
-#pragma section(".SCOV$CZ", read, write) // NOLINT
+#pragma section(".SCOV$CZ", read, write)
__declspec(allocate(".SCOV$CZ")) __declspec(align(1)) uint8_t
__stop___sancov_cntrs = 0;
-#pragma section(".SCOV$GA", read, write) // NOLINT
+#pragma section(".SCOV$GA", read, write)
__declspec(allocate(".SCOV$GA")) uint64_t __start___sancov_guards = 0;
-#pragma section(".SCOV$GZ", read, write) // NOLINT
+#pragma section(".SCOV$GZ", read, write)
__declspec(allocate(".SCOV$GZ")) __declspec(align(1)) uint8_t
__stop___sancov_guards = 0;
@@ -56,9 +56,9 @@ __declspec(allocate(".SCOV$GZ")) __declspec(align(1)) uint8_t
// constant it should be merged with the .rdata section.
#pragma comment(linker, "/MERGE:.SCOV=.data")
-#pragma section(".SCOVP$A", read) // NOLINT
+#pragma section(".SCOVP$A", read)
__declspec(allocate(".SCOVP$A")) uint64_t __start___sancov_pcs = 0;
-#pragma section(".SCOVP$Z", read) // NOLINT
+#pragma section(".SCOVP$Z", read)
__declspec(allocate(".SCOVP$Z")) __declspec(align(1)) uint8_t
__stop___sancov_pcs = 0;
diff --git a/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cc b/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cpp
index 1fd10d5b83a1..55263981705f 100644
--- a/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cc
+++ b/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_coverage_win_weak_interception.cc -----------------------===//
+//===-- sanitizer_coverage_win_weak_interception.cpp ----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector1.cc b/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp
index a151a190c180..d4a325bea4b2 100644
--- a/lib/sanitizer_common/sanitizer_deadlock_detector1.cc
+++ b/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_deadlock_detector1.cc -----------------------------------===//
+//===-- sanitizer_deadlock_detector1.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector2.cc b/lib/sanitizer_common/sanitizer_deadlock_detector2.cpp
index ed9ea26d3902..4026739d4e51 100644
--- a/lib/sanitizer_common/sanitizer_deadlock_detector2.cc
+++ b/lib/sanitizer_common/sanitizer_deadlock_detector2.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_deadlock_detector2.cc -----------------------------------===//
+//===-- sanitizer_deadlock_detector2.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_errno.cc b/lib/sanitizer_common/sanitizer_errno.cpp
index 1600de566393..cbadf4d924a7 100644
--- a/lib/sanitizer_common/sanitizer_errno.cc
+++ b/lib/sanitizer_common/sanitizer_errno.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_errno.cc --------------------------------------*- C++ -*-===//
+//===-- sanitizer_errno.cpp -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_file.cc b/lib/sanitizer_common/sanitizer_file.cpp
index 3cb4974bdab2..79930d794250 100644
--- a/lib/sanitizer_common/sanitizer_file.cc
+++ b/lib/sanitizer_common/sanitizer_file.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_file.cc ------------------------------------------------===//
+//===-- sanitizer_file.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,7 +8,7 @@
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries. It defines filesystem-related interfaces. This
-// is separate from sanitizer_common.cc so that it's simpler to disable
+// is separate from sanitizer_common.cpp so that it's simpler to disable
// all the filesystem support code for a port that doesn't use it.
//
//===---------------------------------------------------------------------===//
@@ -199,7 +199,7 @@ char *FindPathToBinary(const char *name) {
} // namespace __sanitizer
-using namespace __sanitizer; // NOLINT
+using namespace __sanitizer;
extern "C" {
void __sanitizer_set_report_path(const char *path) {
diff --git a/lib/sanitizer_common/sanitizer_flag_parser.cc b/lib/sanitizer_common/sanitizer_flag_parser.cpp
index e380d3b55e36..1e2bc6652617 100644
--- a/lib/sanitizer_common/sanitizer_flag_parser.cc
+++ b/lib/sanitizer_common/sanitizer_flag_parser.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_flag_parser.cc ------------------------------------------===//
+//===-- sanitizer_flag_parser.cpp -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -83,8 +83,9 @@ void FlagParser::parse_flag(const char *env_option_name) {
Printf("%s: ERROR: expected '=' in %s\n", SanitizerToolName,
env_option_name);
Die();
- } else
+ } else {
fatal_error("expected '='");
+ }
}
char *name = ll_strndup(buf_ + name_start, pos_ - name_start);
diff --git a/lib/sanitizer_common/sanitizer_flag_parser.h b/lib/sanitizer_common/sanitizer_flag_parser.h
index 8e12700bbe8c..c24ad25626ba 100644
--- a/lib/sanitizer_common/sanitizer_flag_parser.h
+++ b/lib/sanitizer_common/sanitizer_flag_parser.h
@@ -24,7 +24,7 @@ class FlagHandlerBase {
virtual bool Parse(const char *value) { return false; }
protected:
- ~FlagHandlerBase() {};
+ ~FlagHandlerBase() {}
};
template <typename T>
@@ -144,7 +144,7 @@ class FlagParser {
template <typename T>
static void RegisterFlag(FlagParser *parser, const char *name, const char *desc,
T *var) {
- FlagHandler<T> *fh = new (FlagParser::Alloc) FlagHandler<T>(var); // NOLINT
+ FlagHandler<T> *fh = new (FlagParser::Alloc) FlagHandler<T>(var);
parser->RegisterHandler(name, fh, desc);
}
diff --git a/lib/sanitizer_common/sanitizer_flags.cc b/lib/sanitizer_common/sanitizer_flags.cpp
index c587b1884935..66a0a5579ed3 100644
--- a/lib/sanitizer_common/sanitizer_flags.cc
+++ b/lib/sanitizer_common/sanitizer_flags.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_flags.cc ------------------------------------------------===//
+//===-- sanitizer_flags.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -92,11 +92,11 @@ class FlagHandlerInclude : public FlagHandlerBase {
};
void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf) {
- FlagHandlerInclude *fh_include = new (FlagParser::Alloc) // NOLINT
+ FlagHandlerInclude *fh_include = new (FlagParser::Alloc)
FlagHandlerInclude(parser, /*ignore_missing*/ false);
parser->RegisterHandler("include", fh_include,
"read more options from the given file");
- FlagHandlerInclude *fh_include_if_exists = new (FlagParser::Alloc) // NOLINT
+ FlagHandlerInclude *fh_include_if_exists = new (FlagParser::Alloc)
FlagHandlerInclude(parser, /*ignore_missing*/ true);
parser->RegisterHandler(
"include_if_exists", fh_include_if_exists,
diff --git a/lib/sanitizer_common/sanitizer_fuchsia.cc b/lib/sanitizer_common/sanitizer_fuchsia.cpp
index 9c032fa8995c..6e2c6137f0ce 100644
--- a/lib/sanitizer_common/sanitizer_fuchsia.cc
+++ b/lib/sanitizer_common/sanitizer_fuchsia.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_fuchsia.cc ----------------------------------------------===//
+//===-- sanitizer_fuchsia.cpp ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -502,7 +502,7 @@ uptr GetRSS() { UNIMPLEMENTED(); }
} // namespace __sanitizer
-using namespace __sanitizer; // NOLINT
+using namespace __sanitizer;
extern "C" {
void __sanitizer_startup_hook(int argc, char **argv, char **envp,
diff --git a/lib/sanitizer_common/sanitizer_getauxval.h b/lib/sanitizer_common/sanitizer_getauxval.h
index cbd1af12c04f..86ad3a5e2c2a 100644
--- a/lib/sanitizer_common/sanitizer_getauxval.h
+++ b/lib/sanitizer_common/sanitizer_getauxval.h
@@ -9,6 +9,7 @@
// Common getauxval() guards and definitions.
// getauxval() is not defined until glibc version 2.16, or until API level 21
// for Android.
+// Implement the getauxval() compat function for NetBSD.
//
//===----------------------------------------------------------------------===//
@@ -16,15 +17,10 @@
#define SANITIZER_GETAUXVAL_H
#include "sanitizer_platform.h"
+#include "sanitizer_glibc_version.h"
#if SANITIZER_LINUX || SANITIZER_FUCHSIA
-# include <features.h>
-
-# ifndef __GLIBC_PREREQ
-# define __GLIBC_PREREQ(x, y) 0
-# endif
-
# if __GLIBC_PREREQ(2, 16) || (SANITIZER_ANDROID && __ANDROID_API__ >= 21) || \
SANITIZER_FUCHSIA
# define SANITIZER_USE_GETAUXVAL 1
@@ -38,10 +34,26 @@
// The weak getauxval definition allows to check for the function at runtime.
// This is useful for Android, when compiled at a lower API level yet running
// on a more recent platform that offers the function.
-extern "C" SANITIZER_WEAK_ATTRIBUTE
-unsigned long getauxval(unsigned long type); // NOLINT
+extern "C" SANITIZER_WEAK_ATTRIBUTE unsigned long getauxval(unsigned long type);
# endif
-#endif // SANITIZER_LINUX || SANITIZER_FUCHSIA
+#elif SANITIZER_NETBSD
+
+#define SANITIZER_USE_GETAUXVAL 1
+
+#include <dlfcn.h>
+#include <elf.h>
+
+static inline decltype(AuxInfo::a_v) getauxval(decltype(AuxInfo::a_type) type) {
+ for (const AuxInfo *aux = (const AuxInfo *)_dlauxinfo();
+ aux->a_type != AT_NULL; ++aux) {
+ if (type == aux->a_type)
+ return aux->a_v;
+ }
+
+ return 0;
+}
+
+#endif
#endif // SANITIZER_GETAUXVAL_H
diff --git a/lib/sanitizer_common/sanitizer_glibc_version.h b/lib/sanitizer_common/sanitizer_glibc_version.h
new file mode 100644
index 000000000000..47175f20aa01
--- /dev/null
+++ b/lib/sanitizer_common/sanitizer_glibc_version.h
@@ -0,0 +1,26 @@
+//===-- sanitizer_glibc_version.h -----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of Sanitizer common code.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_GLIBC_VERSION_H
+#define SANITIZER_GLIBC_VERSION_H
+
+#include "sanitizer_platform.h"
+
+#if SANITIZER_LINUX || SANITIZER_FUCHSIA
+#include <features.h>
+#endif
+
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
+#endif
diff --git a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
index f29226b3ee3a..03ef7c1788cd 100644
--- a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
+++ b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
@@ -24,7 +24,7 @@ struct ioctl_desc {
const char *name;
};
-const unsigned ioctl_table_max = 1200;
+const unsigned ioctl_table_max = 1236;
static ioctl_desc ioctl_table[ioctl_table_max];
static unsigned ioctl_table_size = 0;
@@ -645,7 +645,7 @@ static void ioctl_table_fill() {
_(SPKRTUNE, NONE, 0);
_(SPKRGETVOL, WRITE, sizeof(unsigned int));
_(SPKRSETVOL, READ, sizeof(unsigned int));
-#if 0 /* WIP */
+#if defined(__x86_64__)
/* Entries from file: dev/nvmm/nvmm_ioctl.h */
_(NVMM_IOC_CAPABILITY, WRITE, struct_nvmm_ioc_capability_sz);
_(NVMM_IOC_MACHINE_CREATE, READWRITE, struct_nvmm_ioc_machine_create_sz);
@@ -661,7 +661,11 @@ static void ioctl_table_fill() {
_(NVMM_IOC_GPA_UNMAP, READ, struct_nvmm_ioc_gpa_unmap_sz);
_(NVMM_IOC_HVA_MAP, READ, struct_nvmm_ioc_hva_map_sz);
_(NVMM_IOC_HVA_UNMAP, READ, struct_nvmm_ioc_hva_unmap_sz);
+ _(NVMM_IOC_CTL, READ, struct_nvmm_ioc_ctl_sz);
#endif
+ /* Entries from file: dev/spi/spi_io.h */
+ _(SPI_IOCTL_CONFIGURE, READ, struct_spi_ioctl_configure_sz);
+ _(SPI_IOCTL_TRANSFER, READ, struct_spi_ioctl_transfer_sz);
/* Entries from file: fs/autofs/autofs_ioctl.h */
_(AUTOFSREQUEST, WRITE, struct_autofs_daemon_request_sz);
_(AUTOFSDONE, READ, struct_autofs_daemon_done_sz);
@@ -895,6 +899,9 @@ static void ioctl_table_fill() {
_(AUDIO_GETBUFINFO, WRITE, struct_audio_info_sz);
_(AUDIO_SETCHAN, READ, sizeof(int));
_(AUDIO_GETCHAN, WRITE, sizeof(int));
+ _(AUDIO_QUERYFORMAT, READWRITE, struct_audio_format_query_sz);
+ _(AUDIO_GETFORMAT, WRITE, struct_audio_info_sz);
+ _(AUDIO_SETFORMAT, READ, struct_audio_info_sz);
_(AUDIO_MIXER_READ, READWRITE, struct_mixer_ctrl_sz);
_(AUDIO_MIXER_WRITE, READWRITE, struct_mixer_ctrl_sz);
_(AUDIO_MIXER_DEVINFO, READWRITE, struct_mixer_devinfo_sz);
@@ -985,6 +992,7 @@ static void ioctl_table_fill() {
_(DIOCMWEDGES, WRITE, sizeof(int));
_(DIOCGSECTORSIZE, WRITE, sizeof(unsigned int));
_(DIOCGMEDIASIZE, WRITE, sizeof(uptr));
+ _(DIOCRMWEDGES, WRITE, sizeof(int));
/* Entries from file: sys/drvctlio.h */
_(DRVDETACHDEV, READ, struct_devdetachargs_sz);
_(DRVRESCANBUS, READ, struct_devrescanargs_sz);
@@ -1206,6 +1214,8 @@ static void ioctl_table_fill() {
_(SIOCGETHERCAP, READWRITE, struct_eccapreq_sz);
_(SIOCGIFINDEX, READWRITE, struct_ifreq_sz);
_(SIOCSETHERCAP, READ, struct_eccapreq_sz);
+ _(SIOCSIFDESCR, READ, struct_ifreq_sz);
+ _(SIOCGIFDESCR, READWRITE, struct_ifreq_sz);
_(SIOCGUMBINFO, READWRITE, struct_ifreq_sz);
_(SIOCSUMBPARAM, READ, struct_ifreq_sz);
_(SIOCGUMBPARAM, READWRITE, struct_ifreq_sz);
@@ -1335,6 +1345,21 @@ static void ioctl_table_fill() {
_(WDOGIOC_TICKLE, NONE, 0);
_(WDOGIOC_GTICKLER, WRITE, sizeof(int));
_(WDOGIOC_GWDOGS, READWRITE, struct_wdog_conf_sz);
+ /* Entries from file: sys/kcov.h */
+ _(KCOV_IOC_SETBUFSIZE, READ, sizeof(u64));
+ _(KCOV_IOC_ENABLE, READ, sizeof(int));
+ _(KCOV_IOC_DISABLE, NONE, 0);
+ /* Entries from file: sys/ipmi.h */
+ _(IPMICTL_RECEIVE_MSG_TRUNC, READWRITE, struct_ipmi_recv_sz);
+ _(IPMICTL_RECEIVE_MSG, READWRITE, struct_ipmi_recv_sz);
+ _(IPMICTL_SEND_COMMAND, READ, struct_ipmi_req_sz);
+ _(IPMICTL_REGISTER_FOR_CMD, READ, struct_ipmi_cmdspec_sz);
+ _(IPMICTL_UNREGISTER_FOR_CMD, READ, struct_ipmi_cmdspec_sz);
+ _(IPMICTL_SET_GETS_EVENTS_CMD, READ, sizeof(int));
+ _(IPMICTL_SET_MY_ADDRESS_CMD, READ, sizeof(unsigned int));
+ _(IPMICTL_GET_MY_ADDRESS_CMD, WRITE, sizeof(unsigned int));
+ _(IPMICTL_SET_MY_LUN_CMD, READ, sizeof(unsigned int));
+ _(IPMICTL_GET_MY_LUN_CMD, WRITE, sizeof(unsigned int));
/* Entries from file: soundcard.h */
_(SNDCTL_DSP_RESET, NONE, 0);
_(SNDCTL_DSP_SYNC, NONE, 0);
@@ -1379,7 +1404,7 @@ static void ioctl_table_fill() {
_(SNDCTL_DSP_SKIP, NONE, 0);
_(SNDCTL_DSP_SILENCE, NONE, 0);
#undef _
-}
+} // NOLINT
static bool ioctl_initialized = false;
diff --git a/lib/sanitizer_common/sanitizer_internal_defs.h b/lib/sanitizer_common/sanitizer_internal_defs.h
index e0c6506bed51..00226305e07c 100644
--- a/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -133,27 +133,27 @@ namespace __sanitizer {
#if defined(_WIN64)
// 64-bit Windows uses LLP64 data model.
-typedef unsigned long long uptr; // NOLINT
-typedef signed long long sptr; // NOLINT
+typedef unsigned long long uptr;
+typedef signed long long sptr;
#else
-typedef unsigned long uptr; // NOLINT
-typedef signed long sptr; // NOLINT
+typedef unsigned long uptr;
+typedef signed long sptr;
#endif // defined(_WIN64)
#if defined(__x86_64__)
// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use
// 64-bit pointer to unwind stack frame.
-typedef unsigned long long uhwptr; // NOLINT
+typedef unsigned long long uhwptr;
#else
-typedef uptr uhwptr; // NOLINT
+typedef uptr uhwptr;
#endif
typedef unsigned char u8;
-typedef unsigned short u16; // NOLINT
+typedef unsigned short u16;
typedef unsigned int u32;
-typedef unsigned long long u64; // NOLINT
-typedef signed char s8;
-typedef signed short s16; // NOLINT
-typedef signed int s32;
-typedef signed long long s64; // NOLINT
+typedef unsigned long long u64;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+typedef signed long long s64;
#if SANITIZER_WINDOWS
// On Windows, files are HANDLE, which is a synonim of void*.
// Use void* to avoid including <windows.h> everywhere.
@@ -264,7 +264,7 @@ typedef ALIGNED(1) s64 us64;
#if SANITIZER_WINDOWS
} // namespace __sanitizer
-typedef unsigned long DWORD; // NOLINT
+typedef unsigned long DWORD;
namespace __sanitizer {
typedef DWORD thread_return_t;
# define THREAD_CALLING_CONV __stdcall
@@ -419,18 +419,41 @@ inline void Trap() {
} // namespace __sanitizer
-namespace __asan { using namespace __sanitizer; } // NOLINT
-namespace __dsan { using namespace __sanitizer; } // NOLINT
-namespace __dfsan { using namespace __sanitizer; } // NOLINT
-namespace __lsan { using namespace __sanitizer; } // NOLINT
-namespace __msan { using namespace __sanitizer; } // NOLINT
-namespace __hwasan { using namespace __sanitizer; } // NOLINT
-namespace __tsan { using namespace __sanitizer; } // NOLINT
-namespace __scudo { using namespace __sanitizer; } // NOLINT
-namespace __ubsan { using namespace __sanitizer; } // NOLINT
-namespace __xray { using namespace __sanitizer; } // NOLINT
-namespace __interception { using namespace __sanitizer; } // NOLINT
-namespace __hwasan { using namespace __sanitizer; } // NOLINT
-
+namespace __asan {
+using namespace __sanitizer;
+}
+namespace __dsan {
+using namespace __sanitizer;
+}
+namespace __dfsan {
+using namespace __sanitizer;
+}
+namespace __lsan {
+using namespace __sanitizer;
+}
+namespace __msan {
+using namespace __sanitizer;
+}
+namespace __hwasan {
+using namespace __sanitizer;
+}
+namespace __tsan {
+using namespace __sanitizer;
+}
+namespace __scudo {
+using namespace __sanitizer;
+}
+namespace __ubsan {
+using namespace __sanitizer;
+}
+namespace __xray {
+using namespace __sanitizer;
+}
+namespace __interception {
+using namespace __sanitizer;
+}
+namespace __hwasan {
+using namespace __sanitizer;
+}
#endif // SANITIZER_DEFS_H
diff --git a/lib/sanitizer_common/sanitizer_libc.cc b/lib/sanitizer_common/sanitizer_libc.cpp
index 95c74441fd21..4bc04b486870 100644
--- a/lib/sanitizer_common/sanitizer_libc.cc
+++ b/lib/sanitizer_common/sanitizer_libc.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_libc.cc -------------------------------------------------===//
+//===-- sanitizer_libc.cpp ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -63,10 +63,11 @@ void *internal_memmove(void *dest, const void *src, uptr n) {
for (i = 0; i < signed_n; ++i)
d[i] = s[i];
} else {
- if (d > s && signed_n > 0)
- for (i = signed_n - 1; i >= 0 ; --i) {
+ if (d > s && signed_n > 0) {
+ for (i = signed_n - 1; i >= 0; --i) {
d[i] = s[i];
}
+ }
}
return dest;
}
@@ -270,9 +271,9 @@ bool mem_is_zero(const char *beg, uptr size) {
for (; aligned_beg < aligned_end; aligned_beg++)
all |= *aligned_beg;
// Epilogue.
- if ((char*)aligned_end >= beg)
- for (const char *mem = (char*)aligned_end; mem < end; mem++)
- all |= *mem;
+ if ((char *)aligned_end >= beg) {
+ for (const char *mem = (char *)aligned_end; mem < end; mem++) all |= *mem;
+ }
return all == 0;
}
diff --git a/lib/sanitizer_common/sanitizer_libignore.cc b/lib/sanitizer_common/sanitizer_libignore.cpp
index 6c7c132e99eb..eb9bb765013d 100644
--- a/lib/sanitizer_common/sanitizer_libignore.cc
+++ b/lib/sanitizer_common/sanitizer_libignore.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_libignore.cc --------------------------------------------===//
+//===-- sanitizer_libignore.cpp -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cpp
index 88ab0979bb05..0b53da6c349f 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_linux.cc ------------------------------------------------===//
+//===-- sanitizer_linux.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -779,7 +779,11 @@ int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
#if SANITIZER_FREEBSD
int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp,
const void *newp, uptr newlen) {
- return sysctlbyname(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen);
+ static decltype(sysctlbyname) *real = nullptr;
+ if (!real)
+ real = (decltype(sysctlbyname) *)dlsym(RTLD_NEXT, "sysctlbyname");
+ CHECK(real);
+ return real(sname, oldp, (size_t *)oldlenp, newp, (size_t)newlen);
}
#endif
#endif
@@ -1058,8 +1062,6 @@ uptr GetMaxUserVirtualAddress() {
uptr GetPageSize() {
#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
return EXEC_PAGESIZE;
-#elif SANITIZER_USE_GETAUXVAL
- return getauxval(AT_PAGESZ);
#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
// Use sysctl as sysconf can trigger interceptors internally.
int pz = 0;
@@ -1068,6 +1070,8 @@ uptr GetPageSize() {
int rv = internal_sysctl(mib, 2, &pz, &pzl, nullptr, 0);
CHECK_EQ(rv, 0);
return (uptr)pz;
+#elif SANITIZER_USE_GETAUXVAL
+ return getauxval(AT_PAGESZ);
#else
return sysconf(_SC_PAGESIZE); // EXEC_PAGESIZE may not be trustworthy.
#endif
@@ -1845,6 +1849,12 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
#endif
}
+bool SignalContext::IsTrueFaultingAddress() const {
+ auto si = static_cast<const siginfo_t *>(siginfo);
+ // SIGSEGV signals without a true fault address have si_code set to 128.
+ return si->si_signo == SIGSEGV && si->si_code != 128;
+}
+
void SignalContext::DumpAllRegisters(void *context) {
// FIXME: Implement this.
}
@@ -2007,6 +2017,35 @@ void CheckASLR() {
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
ReExec();
}
+#elif SANITIZER_FREEBSD
+ int aslr_pie;
+ uptr len = sizeof(aslr_pie);
+#if SANITIZER_WORDSIZE == 64
+ if (UNLIKELY(internal_sysctlbyname("kern.elf64.aslr.pie_enable",
+ &aslr_pie, &len, NULL, 0) == -1)) {
+ // We're making things less 'dramatic' here since
+ // the OID is not necessarily guaranteed to be here
+ // just yet regarding FreeBSD release
+ return;
+ }
+
+ if (aslr_pie > 0) {
+ Printf("This sanitizer is not compatible with enabled ASLR "
+ "and binaries compiled with PIE\n");
+ Die();
+ }
+#endif
+ // there might be 32 bits compat for 64 bits
+ if (UNLIKELY(internal_sysctlbyname("kern.elf32.aslr.pie_enable",
+ &aslr_pie, &len, NULL, 0) == -1)) {
+ return;
+ }
+
+ if (aslr_pie > 0) {
+ Printf("This sanitizer is not compatible with enabled ASLR "
+ "and binaries compiled with PIE\n");
+ Die();
+ }
#else
// Do nothing
#endif
diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index 0608898a1464..cd503718205a 100644
--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_linux_libcdep.cc ----------------------------------------===//
+//===-- sanitizer_linux_libcdep.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -23,6 +23,7 @@
#include "sanitizer_flags.h"
#include "sanitizer_freebsd.h"
#include "sanitizer_getauxval.h"
+#include "sanitizer_glibc_version.h"
#include "sanitizer_linux.h"
#include "sanitizer_placement_new.h"
#include "sanitizer_procmaps.h"
@@ -188,11 +189,7 @@ __attribute__((unused)) static bool GetLibcVersion(int *major, int *minor,
static uptr g_tls_size;
#ifdef __i386__
-# ifndef __GLIBC_PREREQ
-# define CHECK_GET_TLS_STATIC_INFO_VERSION 1
-# else
-# define CHECK_GET_TLS_STATIC_INFO_VERSION (!__GLIBC_PREREQ(2, 27))
-# endif
+# define CHECK_GET_TLS_STATIC_INFO_VERSION (!__GLIBC_PREREQ(2, 27))
#else
# define CHECK_GET_TLS_STATIC_INFO_VERSION 0
#endif
diff --git a/lib/sanitizer_common/sanitizer_linux_s390.cc b/lib/sanitizer_common/sanitizer_linux_s390.cpp
index b681bef35b76..41e187eaf8da 100644
--- a/lib/sanitizer_common/sanitizer_linux_s390.cc
+++ b/lib/sanitizer_common/sanitizer_linux_s390.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_linux_s390.cc -------------------------------------------===//
+//===-- sanitizer_linux_s390.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cpp
index d9b7c4b12926..ea4bd02aa92e 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_mac.cc --------------------------------------------------===//
+//===-- sanitizer_mac.cpp -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -13,6 +13,7 @@
#include "sanitizer_platform.h"
#if SANITIZER_MAC
#include "sanitizer_mac.h"
+#include "interception/interception.h"
// Use 64-bit inodes in file operations. ASan does not support OS X 10.5, so
// the clients will most certainly use 64-bit ones as well.
@@ -64,7 +65,9 @@ extern "C" {
#include <pthread.h>
#include <sched.h>
#include <signal.h>
+#include <spawn.h>
#include <stdlib.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
@@ -239,27 +242,102 @@ int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp,
(size_t)newlen);
}
-int internal_forkpty(int *aparent) {
- int parent, worker;
- if (openpty(&parent, &worker, nullptr, nullptr, nullptr) == -1) return -1;
- int pid = internal_fork();
- if (pid == -1) {
- close(parent);
- close(worker);
- return -1;
+static fd_t internal_spawn_impl(const char *argv[], pid_t *pid) {
+ fd_t master_fd = kInvalidFd;
+ fd_t slave_fd = kInvalidFd;
+
+ auto fd_closer = at_scope_exit([&] {
+ internal_close(master_fd);
+ internal_close(slave_fd);
+ });
+
+ // We need a new pseudoterminal to avoid buffering problems. The 'atos' tool
+ // in particular detects when it's talking to a pipe and forgets to flush the
+ // output stream after sending a response.
+ master_fd = posix_openpt(O_RDWR);
+ if (master_fd == kInvalidFd) return kInvalidFd;
+
+ int res = grantpt(master_fd) || unlockpt(master_fd);
+ if (res != 0) return kInvalidFd;
+
+ // Use TIOCPTYGNAME instead of ptsname() to avoid threading problems.
+ char slave_pty_name[128];
+ res = ioctl(master_fd, TIOCPTYGNAME, slave_pty_name);
+ if (res == -1) return kInvalidFd;
+
+ slave_fd = internal_open(slave_pty_name, O_RDWR);
+ if (slave_fd == kInvalidFd) return kInvalidFd;
+
+ // File descriptor actions
+ posix_spawn_file_actions_t acts;
+ res = posix_spawn_file_actions_init(&acts);
+ if (res != 0) return kInvalidFd;
+
+ auto acts_cleanup = at_scope_exit([&] {
+ posix_spawn_file_actions_destroy(&acts);
+ });
+
+ res = posix_spawn_file_actions_adddup2(&acts, slave_fd, STDIN_FILENO) ||
+ posix_spawn_file_actions_adddup2(&acts, slave_fd, STDOUT_FILENO) ||
+ posix_spawn_file_actions_addclose(&acts, slave_fd);
+ if (res != 0) return kInvalidFd;
+
+ // Spawn attributes
+ posix_spawnattr_t attrs;
+ res = posix_spawnattr_init(&attrs);
+ if (res != 0) return kInvalidFd;
+
+ auto attrs_cleanup = at_scope_exit([&] {
+ posix_spawnattr_destroy(&attrs);
+ });
+
+ // In the spawned process, close all file descriptors that are not explicitly
+ // described by the file actions object. This is Darwin-specific extension.
+ res = posix_spawnattr_setflags(&attrs, POSIX_SPAWN_CLOEXEC_DEFAULT);
+ if (res != 0) return kInvalidFd;
+
+ // posix_spawn
+ char **argv_casted = const_cast<char **>(argv);
+ char **env = GetEnviron();
+ res = posix_spawn(pid, argv[0], &acts, &attrs, argv_casted, env);
+ if (res != 0) return kInvalidFd;
+
+ // Disable echo in the new terminal, disable CR.
+ struct termios termflags;
+ tcgetattr(master_fd, &termflags);
+ termflags.c_oflag &= ~ONLCR;
+ termflags.c_lflag &= ~ECHO;
+ tcsetattr(master_fd, TCSANOW, &termflags);
+
+ // On success, do not close master_fd on scope exit.
+ fd_t fd = master_fd;
+ master_fd = kInvalidFd;
+
+ return fd;
+}
+
+fd_t internal_spawn(const char *argv[], pid_t *pid) {
+ // The client program may close its stdin and/or stdout and/or stderr thus
+ // allowing open/posix_openpt to reuse file descriptors 0, 1 or 2. In this
+ // case the communication is broken if either the parent or the child tries to
+ // close or duplicate these descriptors. We temporarily reserve these
+ // descriptors here to prevent this.
+ fd_t low_fds[3];
+ size_t count = 0;
+
+ for (; count < 3; count++) {
+ low_fds[count] = posix_openpt(O_RDWR);
+ if (low_fds[count] >= STDERR_FILENO)
+ break;
}
- if (pid == 0) {
- close(parent);
- if (login_tty(worker) != 0) {
- // We already forked, there's not much we can do. Let's quit.
- Report("login_tty failed (errno %d)\n", errno);
- internal__exit(1);
- }
- } else {
- *aparent = parent;
- close(worker);
+
+ fd_t fd = internal_spawn_impl(argv, pid);
+
+ for (; count > 0; count--) {
+ internal_close(low_fds[count]);
}
- return pid;
+
+ return fd;
}
uptr internal_rename(const char *oldpath, const char *newpath) {
@@ -676,6 +754,12 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
#endif
}
+bool SignalContext::IsTrueFaultingAddress() const {
+ auto si = static_cast<const siginfo_t *>(siginfo);
+ // "Real" SIGSEGV codes (e.g., SEGV_MAPERR, SEGV_MAPERR) are non-zero.
+ return si->si_signo == SIGSEGV && si->si_code != 0;
+}
+
static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
ucontext_t *ucontext = (ucontext_t*)context;
# if defined(__aarch64__)
@@ -1122,7 +1206,7 @@ bool GetRandom(void *buffer, uptr length, bool blocking) {
if (!buffer || !length || length > 256)
return false;
// arc4random never fails.
- arc4random_buf(buffer, length);
+ REAL(arc4random_buf)(buffer, length);
return true;
}
diff --git a/lib/sanitizer_common/sanitizer_mac_libcdep.cc b/lib/sanitizer_common/sanitizer_mac_libcdep.cpp
index 93fb5b2f96c6..ac7e328946bf 100644
--- a/lib/sanitizer_common/sanitizer_mac_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_mac_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_mac_libcdep.cc ------------------------------------------===//
+//===-- sanitizer_mac_libcdep.cpp -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_malloc_mac.inc b/lib/sanitizer_common/sanitizer_malloc_mac.inc
index 3f3581eeb484..11adbe5c25b4 100644
--- a/lib/sanitizer_common/sanitizer_malloc_mac.inc
+++ b/lib/sanitizer_common/sanitizer_malloc_mac.inc
@@ -91,6 +91,15 @@ INTERCEPTOR(malloc_zone_t *, malloc_default_zone, void) {
return &sanitizer_zone;
}
+INTERCEPTOR(malloc_zone_t *, malloc_zone_from_ptr, const void *ptr) {
+ COMMON_MALLOC_ENTER();
+ size_t size = sanitizer_zone.size(&sanitizer_zone, ptr);
+ if (size) { // Claimed by sanitizer zone?
+ return &sanitizer_zone;
+ }
+ return REAL(malloc_zone_from_ptr)(ptr);
+}
+
INTERCEPTOR(malloc_zone_t *, malloc_default_purgeable_zone, void) {
// FIXME: ASan should support purgeable allocations.
// https://github.com/google/sanitizers/issues/139
@@ -226,7 +235,7 @@ void __sanitizer_mz_free(malloc_zone_t *zone, void *ptr) {
}
#define GET_ZONE_FOR_PTR(ptr) \
- malloc_zone_t *zone_ptr = malloc_zone_from_ptr(ptr); \
+ malloc_zone_t *zone_ptr = WRAP(malloc_zone_from_ptr)(ptr); \
const char *zone_name = (zone_ptr == 0) ? 0 : zone_ptr->zone_name
extern "C"
diff --git a/lib/sanitizer_common/sanitizer_netbsd.cc b/lib/sanitizer_common/sanitizer_netbsd.cpp
index 385008e4c95a..4e74f6a3b516 100644
--- a/lib/sanitizer_common/sanitizer_netbsd.cc
+++ b/lib/sanitizer_common/sanitizer_netbsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_netbsd.cc -----------------------------------------------===//
+//===-- sanitizer_netbsd.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_openbsd.cc b/lib/sanitizer_common/sanitizer_openbsd.cpp
index b6e9bdfa87e5..ed2d8edeb7a2 100644
--- a/lib/sanitizer_common/sanitizer_openbsd.cc
+++ b/lib/sanitizer_common/sanitizer_openbsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_openbsd.cc ----------------------------------------------===//
+//===-- sanitizer_openbsd.cpp ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_persistent_allocator.cc b/lib/sanitizer_common/sanitizer_persistent_allocator.cpp
index ddd9ae9ec64d..1ca0375b8a54 100644
--- a/lib/sanitizer_common/sanitizer_persistent_allocator.cc
+++ b/lib/sanitizer_common/sanitizer_persistent_allocator.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_persistent_allocator.cc -----------------------*- C++ -*-===//
+//===-- sanitizer_persistent_allocator.cpp ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h
index 817d24b3492f..61a6b82ef818 100644
--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -13,6 +13,7 @@
#ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
#define SANITIZER_PLATFORM_INTERCEPTORS_H
+#include "sanitizer_glibc_version.h"
#include "sanitizer_internal_defs.h"
#if SANITIZER_POSIX
@@ -331,10 +332,9 @@
#define SANITIZER_INTERCEPT_ETHER_HOST \
(SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
#define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
-#define SANITIZER_INTERCEPT_SHMCTL \
- (SI_NETBSD || SI_OPENBSD || SI_SOLARIS || \
- ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \
- SANITIZER_WORDSIZE == 64)) // NOLINT
+#define SANITIZER_INTERCEPT_SHMCTL \
+ (((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) || \
+ SI_NETBSD || SI_OPENBSD || SI_SOLARIS) // NOLINT
#define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
@@ -489,7 +489,8 @@
SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
-#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_OPENBSD)
+#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE \
+ (!SI_MAC && !SI_OPENBSD && !SI_NETBSD)
#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_WCSCAT SI_POSIX
#define SANITIZER_INTERCEPT_WCSDUP SI_POSIX
@@ -561,9 +562,18 @@
#define SANITIZER_INTERCEPT_FUNOPEN (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_FUNOPEN2 SI_NETBSD
#define SANITIZER_INTERCEPT_GETFSENT (SI_FREEBSD || SI_NETBSD || SI_MAC)
-#define SANITIZER_INTERCEPT_ARC4RANDOM (SI_FREEBSD || SI_NETBSD)
+#define SANITIZER_INTERCEPT_ARC4RANDOM (SI_FREEBSD || SI_NETBSD || SI_MAC)
#define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD
-#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_POSIX)
+#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
+#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID)
+#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID)
+
+#define SANITIZER_INTERCEPT_GETRANDOM \
+ ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
+#define SANITIZER_INTERCEPT___CXA_ATEXIT SI_NETBSD
+#define SANITIZER_INTERCEPT_ATEXIT SI_NETBSD
+#define SANITIZER_INTERCEPT_PTHREAD_ATFORK SI_NETBSD
+#define SANITIZER_INTERCEPT_GETENTROPY SI_FREEBSD
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc b/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
index 034848742697..2d1bb1a12da6 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_freebsd.cc ------------------------------===//
+//===-- sanitizer_platform_limits_freebsd.cpp -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h b/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
index 7e162a5e49d7..71cf5b9c3571 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
@@ -30,373 +30,373 @@
#include <sys/_types.h>
namespace __sanitizer {
- extern unsigned struct_utsname_sz;
- extern unsigned struct_stat_sz;
+extern unsigned struct_utsname_sz;
+extern unsigned struct_stat_sz;
#if defined(__powerpc64__)
- const unsigned struct___old_kernel_stat_sz = 0;
+const unsigned struct___old_kernel_stat_sz = 0;
#else
- const unsigned struct___old_kernel_stat_sz = 32;
+const unsigned struct___old_kernel_stat_sz = 32;
#endif
- extern unsigned struct_rusage_sz;
- extern unsigned siginfo_t_sz;
- extern unsigned struct_itimerval_sz;
- extern unsigned pthread_t_sz;
- extern unsigned pthread_mutex_t_sz;
- extern unsigned pthread_cond_t_sz;
- extern unsigned pid_t_sz;
- extern unsigned timeval_sz;
- extern unsigned uid_t_sz;
- extern unsigned gid_t_sz;
- extern unsigned fpos_t_sz;
- extern unsigned mbstate_t_sz;
- extern unsigned struct_timezone_sz;
- extern unsigned struct_tms_sz;
- extern unsigned struct_itimerspec_sz;
- extern unsigned struct_sigevent_sz;
- extern unsigned struct_sched_param_sz;
- extern unsigned struct_statfs64_sz;
- extern unsigned struct_statfs_sz;
- extern unsigned struct_sockaddr_sz;
- extern unsigned ucontext_t_sz;
- extern unsigned struct_rlimit_sz;
- extern unsigned struct_utimbuf_sz;
- extern unsigned struct_timespec_sz;
- extern unsigned struct_regmatch_sz;
- extern unsigned struct_regex_sz;
- extern unsigned struct_FTS_sz;
- extern unsigned struct_FTSENT_sz;
- extern const int unvis_valid;
- extern const int unvis_validpush;
-
- struct __sanitizer_iocb {
- u64 aio_data;
- u32 aio_key_or_aio_reserved1; // Simply crazy.
- u32 aio_reserved1_or_aio_key; // Luckily, we don't need these.
- u16 aio_lio_opcode;
- s16 aio_reqprio;
- u32 aio_fildes;
- u64 aio_buf;
- u64 aio_nbytes;
- s64 aio_offset;
- u64 aio_reserved2;
- u64 aio_reserved3;
- };
-
- struct __sanitizer_io_event {
- u64 data;
- u64 obj;
- u64 res;
- u64 res2;
- };
-
- const unsigned iocb_cmd_pread = 0;
- const unsigned iocb_cmd_pwrite = 1;
- const unsigned iocb_cmd_preadv = 7;
- const unsigned iocb_cmd_pwritev = 8;
-
- struct __sanitizer___sysctl_args {
- int *name;
- int nlen;
- void *oldval;
- uptr *oldlenp;
- void *newval;
- uptr newlen;
- unsigned long ___unused[4];
- };
-
- struct __sanitizer_ipc_perm {
- unsigned int cuid;
- unsigned int cgid;
- unsigned int uid;
- unsigned int gid;
- unsigned short mode;
- unsigned short seq;
- long key;
- };
-
- struct __sanitizer_shmid_ds {
- __sanitizer_ipc_perm shm_perm;
- unsigned long shm_segsz;
- unsigned int shm_lpid;
- unsigned int shm_cpid;
- int shm_nattch;
- unsigned long shm_atime;
- unsigned long shm_dtime;
- unsigned long shm_ctime;
- };
-
- extern unsigned struct_msqid_ds_sz;
- extern unsigned struct_mq_attr_sz;
- extern unsigned struct_timeb_sz;
- extern unsigned struct_statvfs_sz;
-
- struct __sanitizer_iovec {
- void *iov_base;
- uptr iov_len;
- };
-
- struct __sanitizer_ifaddrs {
- struct __sanitizer_ifaddrs *ifa_next;
- char *ifa_name;
- unsigned int ifa_flags;
- void *ifa_addr; // (struct sockaddr *)
- void *ifa_netmask; // (struct sockaddr *)
-# undef ifa_dstaddr
- void *ifa_dstaddr; // (struct sockaddr *)
- void *ifa_data;
- };
-
- typedef unsigned __sanitizer_pthread_key_t;
-
- struct __sanitizer_passwd {
- char *pw_name;
- char *pw_passwd;
- int pw_uid;
- int pw_gid;
- long pw_change;
- char *pw_class;
- char *pw_gecos;
- char *pw_dir;
- char *pw_shell;
- long pw_expire;
- int pw_fields;
- };
-
- struct __sanitizer_group {
- char *gr_name;
- char *gr_passwd;
- int gr_gid;
- char **gr_mem;
- };
-
-#if defined(__LP64___)
- typedef long long __sanitizer_time_t;
+extern unsigned struct_rusage_sz;
+extern unsigned siginfo_t_sz;
+extern unsigned struct_itimerval_sz;
+extern unsigned pthread_t_sz;
+extern unsigned pthread_mutex_t_sz;
+extern unsigned pthread_cond_t_sz;
+extern unsigned pid_t_sz;
+extern unsigned timeval_sz;
+extern unsigned uid_t_sz;
+extern unsigned gid_t_sz;
+extern unsigned fpos_t_sz;
+extern unsigned mbstate_t_sz;
+extern unsigned struct_timezone_sz;
+extern unsigned struct_tms_sz;
+extern unsigned struct_itimerspec_sz;
+extern unsigned struct_sigevent_sz;
+extern unsigned struct_sched_param_sz;
+extern unsigned struct_statfs64_sz;
+extern unsigned struct_statfs_sz;
+extern unsigned struct_sockaddr_sz;
+extern unsigned ucontext_t_sz;
+extern unsigned struct_rlimit_sz;
+extern unsigned struct_utimbuf_sz;
+extern unsigned struct_timespec_sz;
+extern unsigned struct_regmatch_sz;
+extern unsigned struct_regex_sz;
+extern unsigned struct_FTS_sz;
+extern unsigned struct_FTSENT_sz;
+extern const int unvis_valid;
+extern const int unvis_validpush;
+
+struct __sanitizer_iocb {
+ u64 aio_data;
+ u32 aio_key_or_aio_reserved1; // Simply crazy.
+ u32 aio_reserved1_or_aio_key; // Luckily, we don't need these.
+ u16 aio_lio_opcode;
+ s16 aio_reqprio;
+ u32 aio_fildes;
+ u64 aio_buf;
+ u64 aio_nbytes;
+ s64 aio_offset;
+ u64 aio_reserved2;
+ u64 aio_reserved3;
+};
+
+struct __sanitizer_io_event {
+ u64 data;
+ u64 obj;
+ u64 res;
+ u64 res2;
+};
+
+const unsigned iocb_cmd_pread = 0;
+const unsigned iocb_cmd_pwrite = 1;
+const unsigned iocb_cmd_preadv = 7;
+const unsigned iocb_cmd_pwritev = 8;
+
+struct __sanitizer___sysctl_args {
+ int *name;
+ int nlen;
+ void *oldval;
+ uptr *oldlenp;
+ void *newval;
+ uptr newlen;
+ unsigned long ___unused[4];
+};
+
+struct __sanitizer_ipc_perm {
+ unsigned int cuid;
+ unsigned int cgid;
+ unsigned int uid;
+ unsigned int gid;
+ unsigned short mode;
+ unsigned short seq;
+ long key;
+};
+
+#if !defined(__i386__)
+typedef long long __sanitizer_time_t;
#else
- typedef long __sanitizer_time_t;
+typedef long __sanitizer_time_t;
#endif
- typedef long __sanitizer_suseconds_t;
-
- struct __sanitizer_timeval {
- __sanitizer_time_t tv_sec;
- __sanitizer_suseconds_t tv_usec;
- };
-
- struct __sanitizer_itimerval {
- struct __sanitizer_timeval it_interval;
- struct __sanitizer_timeval it_value;
- };
-
- struct __sanitizer_timeb {
- __sanitizer_time_t time;
- unsigned short millitm;
- short timezone;
- short dstflag;
- };
-
- struct __sanitizer_ether_addr {
- u8 octet[6];
- };
-
- struct __sanitizer_tm {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- long int tm_gmtoff;
- const char *tm_zone;
- };
-
- struct __sanitizer_msghdr {
- void *msg_name;
- unsigned msg_namelen;
- struct __sanitizer_iovec *msg_iov;
- unsigned msg_iovlen;
- void *msg_control;
- unsigned msg_controllen;
- int msg_flags;
- };
-
- struct __sanitizer_cmsghdr {
- unsigned cmsg_len;
- int cmsg_level;
- int cmsg_type;
- };
-
- struct __sanitizer_dirent {
+struct __sanitizer_shmid_ds {
+ __sanitizer_ipc_perm shm_perm;
+ unsigned long shm_segsz;
+ unsigned int shm_lpid;
+ unsigned int shm_cpid;
+ int shm_nattch;
+ __sanitizer_time_t shm_atime;
+ __sanitizer_time_t shm_dtime;
+ __sanitizer_time_t shm_ctime;
+};
+
+extern unsigned struct_msqid_ds_sz;
+extern unsigned struct_mq_attr_sz;
+extern unsigned struct_timeb_sz;
+extern unsigned struct_statvfs_sz;
+
+struct __sanitizer_iovec {
+ void *iov_base;
+ uptr iov_len;
+};
+
+struct __sanitizer_ifaddrs {
+ struct __sanitizer_ifaddrs *ifa_next;
+ char *ifa_name;
+ unsigned int ifa_flags;
+ void *ifa_addr; // (struct sockaddr *)
+ void *ifa_netmask; // (struct sockaddr *)
+# undef ifa_dstaddr
+ void *ifa_dstaddr; // (struct sockaddr *)
+ void *ifa_data;
+};
+
+typedef unsigned __sanitizer_pthread_key_t;
+
+struct __sanitizer_passwd {
+ char *pw_name;
+ char *pw_passwd;
+ int pw_uid;
+ int pw_gid;
+ __sanitizer_time_t pw_change;
+ char *pw_class;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+ __sanitizer_time_t pw_expire;
+ int pw_fields;
+};
+
+struct __sanitizer_group {
+ char *gr_name;
+ char *gr_passwd;
+ int gr_gid;
+ char **gr_mem;
+};
+
+typedef long __sanitizer_suseconds_t;
+
+struct __sanitizer_timeval {
+ __sanitizer_time_t tv_sec;
+ __sanitizer_suseconds_t tv_usec;
+};
+
+struct __sanitizer_itimerval {
+ struct __sanitizer_timeval it_interval;
+ struct __sanitizer_timeval it_value;
+};
+
+struct __sanitizer_timeb {
+ __sanitizer_time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+};
+
+struct __sanitizer_ether_addr {
+ u8 octet[6];
+};
+
+struct __sanitizer_tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+ long int tm_gmtoff;
+ const char *tm_zone;
+};
+
+struct __sanitizer_msghdr {
+ void *msg_name;
+ unsigned msg_namelen;
+ struct __sanitizer_iovec *msg_iov;
+ unsigned msg_iovlen;
+ void *msg_control;
+ unsigned msg_controllen;
+ int msg_flags;
+};
+
+struct __sanitizer_cmsghdr {
+ unsigned cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+};
+
+struct __sanitizer_dirent {
#if defined(__INO64)
- unsigned long long d_fileno;
- unsigned long long d_off;
+ unsigned long long d_fileno;
+ unsigned long long d_off;
#else
- unsigned int d_fileno;
+ unsigned int d_fileno;
#endif
- unsigned short d_reclen;
- // more fields that we don't care about
- };
+ unsigned short d_reclen;
+ // more fields that we don't care about
+};
// 'clock_t' is 32 bits wide on x64 FreeBSD
- typedef int __sanitizer_clock_t;
- typedef int __sanitizer_clockid_t;
+typedef int __sanitizer_clock_t;
+typedef int __sanitizer_clockid_t;
-#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)\
- || defined(__mips__)
- typedef unsigned __sanitizer___kernel_uid_t;
- typedef unsigned __sanitizer___kernel_gid_t;
+#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__) || \
+ defined(__mips__)
+typedef unsigned __sanitizer___kernel_uid_t;
+typedef unsigned __sanitizer___kernel_gid_t;
#else
- typedef unsigned short __sanitizer___kernel_uid_t;
- typedef unsigned short __sanitizer___kernel_gid_t;
+typedef unsigned short __sanitizer___kernel_uid_t;
+typedef unsigned short __sanitizer___kernel_gid_t;
#endif
- typedef long long __sanitizer___kernel_off_t;
+typedef long long __sanitizer___kernel_off_t;
#if defined(__powerpc__) || defined(__mips__)
- typedef unsigned int __sanitizer___kernel_old_uid_t;
- typedef unsigned int __sanitizer___kernel_old_gid_t;
+typedef unsigned int __sanitizer___kernel_old_uid_t;
+typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
- typedef unsigned short __sanitizer___kernel_old_uid_t;
- typedef unsigned short __sanitizer___kernel_old_gid_t;
+typedef unsigned short __sanitizer___kernel_old_uid_t;
+typedef unsigned short __sanitizer___kernel_old_gid_t;
#endif
- typedef long long __sanitizer___kernel_loff_t;
- typedef struct {
- unsigned long fds_bits[1024 / (8 * sizeof(long))];
- } __sanitizer___kernel_fd_set;
-
- // This thing depends on the platform. We are only interested in the upper
- // limit. Verified with a compiler assert in .cc.
- const int pthread_attr_t_max_sz = 128;
- union __sanitizer_pthread_attr_t {
- char size[pthread_attr_t_max_sz]; // NOLINT
- void *align;
- };
-
- const unsigned old_sigset_t_sz = sizeof(unsigned long);
-
- struct __sanitizer_sigset_t {
- // uint32_t * 4
- unsigned int __bits[4];
- };
-
- typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t;
-
- struct __sanitizer_siginfo {
- // The size is determined by looking at sizeof of real siginfo_t on linux.
- u64 opaque[128 / sizeof(u64)];
- };
-
- using __sanitizer_sighandler_ptr = void (*)(int sig);
- using __sanitizer_sigactionhandler_ptr =
- void (*)(int sig, __sanitizer_siginfo *siginfo, void *uctx);
-
- struct __sanitizer_sigaction {
- union {
- __sanitizer_sigactionhandler_ptr sigaction;
- __sanitizer_sighandler_ptr handler;
- };
- int sa_flags;
- __sanitizer_sigset_t sa_mask;
- };
-
- struct __sanitizer_sem_t {
- u32 data[4];
- };
-
- extern const uptr sig_ign;
- extern const uptr sig_dfl;
- extern const uptr sig_err;
- extern const uptr sa_siginfo;
-
- extern int af_inet;
- extern int af_inet6;
- uptr __sanitizer_in_addr_sz(int af);
-
- struct __sanitizer_dl_phdr_info {
- uptr dlpi_addr;
- const char *dlpi_name;
- const void *dlpi_phdr;
- short dlpi_phnum;
- };
-
- extern unsigned struct_ElfW_Phdr_sz;
-
- struct __sanitizer_addrinfo {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- unsigned ai_addrlen;
- char *ai_canonname;
- void *ai_addr;
- struct __sanitizer_addrinfo *ai_next;
- };
-
- struct __sanitizer_hostent {
- char *h_name;
- char **h_aliases;
- int h_addrtype;
- int h_length;
- char **h_addr_list;
- };
-
- struct __sanitizer_pollfd {
- int fd;
- short events;
- short revents;
- };
-
- typedef unsigned __sanitizer_nfds_t;
-
- struct __sanitizer_glob_t {
- uptr gl_pathc;
- uptr gl_matchc;
- uptr gl_offs;
- int gl_flags;
- char **gl_pathv;
- int (*gl_errfunc)(const char*, int);
- void (*gl_closedir)(void *dirp);
- struct dirent *(*gl_readdir)(void *dirp);
- void *(*gl_opendir)(const char*);
- int (*gl_lstat)(const char*, void* /* struct stat* */);
- int (*gl_stat)(const char*, void* /* struct stat* */);
- };
-
- extern int glob_nomatch;
- extern int glob_altdirfunc;
-
- extern unsigned path_max;
-
- struct __sanitizer_wordexp_t {
- uptr we_wordc;
- char **we_wordv;
- uptr we_offs;
- char *we_strings;
- uptr we_nbytes;
- };
-
- typedef void __sanitizer_FILE;
-
- extern unsigned struct_shminfo_sz;
- extern unsigned struct_shm_info_sz;
- extern int shmctl_ipc_stat;
- extern int shmctl_ipc_info;
- extern int shmctl_shm_info;
- extern int shmctl_shm_stat;
-
- extern unsigned struct_utmpx_sz;
-
- extern int map_fixed;
-
- // ioctl arguments
- struct __sanitizer_ifconf {
- int ifc_len;
- union {
- void *ifcu_req;
- } ifc_ifcu;
+typedef long long __sanitizer___kernel_loff_t;
+typedef struct {
+ unsigned long fds_bits[1024 / (8 * sizeof(long))];
+} __sanitizer___kernel_fd_set;
+
+// This thing depends on the platform. We are only interested in the upper
+// limit. Verified with a compiler assert in .cpp.
+union __sanitizer_pthread_attr_t {
+ char size[128];
+ void *align;
+};
+
+const unsigned old_sigset_t_sz = sizeof(unsigned long);
+
+struct __sanitizer_sigset_t {
+ // uint32_t * 4
+ unsigned int __bits[4];
+};
+
+typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t;
+
+struct __sanitizer_siginfo {
+ // The size is determined by looking at sizeof of real siginfo_t on linux.
+ u64 opaque[128 / sizeof(u64)];
+};
+
+using __sanitizer_sighandler_ptr = void (*)(int sig);
+using __sanitizer_sigactionhandler_ptr = void (*)(int sig,
+ __sanitizer_siginfo *siginfo,
+ void *uctx);
+
+struct __sanitizer_sigaction {
+ union {
+ __sanitizer_sigactionhandler_ptr sigaction;
+ __sanitizer_sighandler_ptr handler;
};
+ int sa_flags;
+ __sanitizer_sigset_t sa_mask;
+};
+
+struct __sanitizer_sem_t {
+ u32 data[4];
+};
+
+extern const uptr sig_ign;
+extern const uptr sig_dfl;
+extern const uptr sig_err;
+extern const uptr sa_siginfo;
+
+extern int af_inet;
+extern int af_inet6;
+uptr __sanitizer_in_addr_sz(int af);
+
+struct __sanitizer_dl_phdr_info {
+ uptr dlpi_addr;
+ const char *dlpi_name;
+ const void *dlpi_phdr;
+ short dlpi_phnum;
+};
+
+extern unsigned struct_ElfW_Phdr_sz;
+
+struct __sanitizer_addrinfo {
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ unsigned ai_addrlen;
+ char *ai_canonname;
+ void *ai_addr;
+ struct __sanitizer_addrinfo *ai_next;
+};
+
+struct __sanitizer_hostent {
+ char *h_name;
+ char **h_aliases;
+ int h_addrtype;
+ int h_length;
+ char **h_addr_list;
+};
+
+struct __sanitizer_pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+typedef unsigned __sanitizer_nfds_t;
+
+struct __sanitizer_glob_t {
+ uptr gl_pathc;
+ uptr gl_matchc;
+ uptr gl_offs;
+ int gl_flags;
+ char **gl_pathv;
+ int (*gl_errfunc)(const char *, int);
+ void (*gl_closedir)(void *dirp);
+ struct dirent *(*gl_readdir)(void *dirp);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, void * /* struct stat* */);
+ int (*gl_stat)(const char *, void * /* struct stat* */);
+};
+
+extern int glob_nomatch;
+extern int glob_altdirfunc;
+
+extern unsigned path_max;
+
+struct __sanitizer_wordexp_t {
+ uptr we_wordc;
+ char **we_wordv;
+ uptr we_offs;
+ char *we_strings;
+ uptr we_nbytes;
+};
+
+typedef void __sanitizer_FILE;
+
+extern unsigned struct_shminfo_sz;
+extern unsigned struct_shm_info_sz;
+extern int shmctl_ipc_stat;
+extern int shmctl_ipc_info;
+extern int shmctl_shm_info;
+extern int shmctl_shm_stat;
+
+extern unsigned struct_utmpx_sz;
+
+extern int map_fixed;
+
+// ioctl arguments
+struct __sanitizer_ifconf {
+ int ifc_len;
+ union {
+ void *ifcu_req;
+ } ifc_ifcu;
+};
#define IOC_NRBITS 8
#define IOC_TYPEBITS 8
@@ -432,204 +432,204 @@ namespace __sanitizer {
#define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
#define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
- extern unsigned struct_ifreq_sz;
- extern unsigned struct_termios_sz;
- extern unsigned struct_winsize_sz;
-
- extern unsigned struct_copr_buffer_sz;
- extern unsigned struct_copr_debug_buf_sz;
- extern unsigned struct_copr_msg_sz;
- extern unsigned struct_midi_info_sz;
- extern unsigned struct_mtget_sz;
- extern unsigned struct_mtop_sz;
- extern unsigned struct_rtentry_sz;
- extern unsigned struct_sbi_instrument_sz;
- extern unsigned struct_seq_event_rec_sz;
- extern unsigned struct_synth_info_sz;
- extern unsigned struct_vt_mode_sz;
-
- extern const unsigned long __sanitizer_bufsiz;
- extern unsigned struct_audio_buf_info_sz;
- extern unsigned struct_ppp_stats_sz;
- extern unsigned struct_sioc_sg_req_sz;
- extern unsigned struct_sioc_vif_req_sz;
-
- // ioctl request identifiers
-
- // A special value to mark ioctls that are not present on the target platform,
- // when it can not be determined without including any system headers.
- extern const unsigned IOCTL_NOT_PRESENT;
-
- extern unsigned IOCTL_FIOASYNC;
- extern unsigned IOCTL_FIOCLEX;
- extern unsigned IOCTL_FIOGETOWN;
- extern unsigned IOCTL_FIONBIO;
- extern unsigned IOCTL_FIONCLEX;
- extern unsigned IOCTL_FIOSETOWN;
- extern unsigned IOCTL_SIOCADDMULTI;
- extern unsigned IOCTL_SIOCATMARK;
- extern unsigned IOCTL_SIOCDELMULTI;
- extern unsigned IOCTL_SIOCGIFADDR;
- extern unsigned IOCTL_SIOCGIFBRDADDR;
- extern unsigned IOCTL_SIOCGIFCONF;
- extern unsigned IOCTL_SIOCGIFDSTADDR;
- extern unsigned IOCTL_SIOCGIFFLAGS;
- extern unsigned IOCTL_SIOCGIFMETRIC;
- extern unsigned IOCTL_SIOCGIFMTU;
- extern unsigned IOCTL_SIOCGIFNETMASK;
- extern unsigned IOCTL_SIOCGPGRP;
- extern unsigned IOCTL_SIOCSIFADDR;
- extern unsigned IOCTL_SIOCSIFBRDADDR;
- extern unsigned IOCTL_SIOCSIFDSTADDR;
- extern unsigned IOCTL_SIOCSIFFLAGS;
- extern unsigned IOCTL_SIOCSIFMETRIC;
- extern unsigned IOCTL_SIOCSIFMTU;
- extern unsigned IOCTL_SIOCSIFNETMASK;
- extern unsigned IOCTL_SIOCSPGRP;
- extern unsigned IOCTL_TIOCCONS;
- extern unsigned IOCTL_TIOCEXCL;
- extern unsigned IOCTL_TIOCGETD;
- extern unsigned IOCTL_TIOCGPGRP;
- extern unsigned IOCTL_TIOCGWINSZ;
- extern unsigned IOCTL_TIOCMBIC;
- extern unsigned IOCTL_TIOCMBIS;
- extern unsigned IOCTL_TIOCMGET;
- extern unsigned IOCTL_TIOCMSET;
- extern unsigned IOCTL_TIOCNOTTY;
- extern unsigned IOCTL_TIOCNXCL;
- extern unsigned IOCTL_TIOCOUTQ;
- extern unsigned IOCTL_TIOCPKT;
- extern unsigned IOCTL_TIOCSCTTY;
- extern unsigned IOCTL_TIOCSETD;
- extern unsigned IOCTL_TIOCSPGRP;
- extern unsigned IOCTL_TIOCSTI;
- extern unsigned IOCTL_TIOCSWINSZ;
- extern unsigned IOCTL_SIOCGETSGCNT;
- extern unsigned IOCTL_SIOCGETVIFCNT;
- extern unsigned IOCTL_MTIOCGET;
- extern unsigned IOCTL_MTIOCTOP;
- extern unsigned IOCTL_SIOCADDRT;
- extern unsigned IOCTL_SIOCDELRT;
- extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
- extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
- extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
- extern unsigned IOCTL_SNDCTL_DSP_POST;
- extern unsigned IOCTL_SNDCTL_DSP_RESET;
- extern unsigned IOCTL_SNDCTL_DSP_SETFMT;
- extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
- extern unsigned IOCTL_SNDCTL_DSP_SPEED;
- extern unsigned IOCTL_SNDCTL_DSP_STEREO;
- extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
- extern unsigned IOCTL_SNDCTL_DSP_SYNC;
- extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
- extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
- extern unsigned IOCTL_SNDCTL_MIDI_INFO;
- extern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
- extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
- extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
- extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
- extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
- extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
- extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
- extern unsigned IOCTL_SNDCTL_SEQ_PANIC;
- extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
- extern unsigned IOCTL_SNDCTL_SEQ_RESET;
- extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
- extern unsigned IOCTL_SNDCTL_SEQ_SYNC;
- extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
- extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
- extern unsigned IOCTL_SNDCTL_SYNTH_INFO;
- extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
- extern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
- extern unsigned IOCTL_SNDCTL_TMR_METRONOME;
- extern unsigned IOCTL_SNDCTL_TMR_SELECT;
- extern unsigned IOCTL_SNDCTL_TMR_SOURCE;
- extern unsigned IOCTL_SNDCTL_TMR_START;
- extern unsigned IOCTL_SNDCTL_TMR_STOP;
- extern unsigned IOCTL_SNDCTL_TMR_TEMPO;
- extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
- extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
- extern unsigned IOCTL_SOUND_MIXER_READ_BASS;
- extern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
- extern unsigned IOCTL_SOUND_MIXER_READ_CD;
- extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
- extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
- extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
- extern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE;
- extern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
- extern unsigned IOCTL_SOUND_MIXER_READ_MIC;
- extern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
- extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
- extern unsigned IOCTL_SOUND_MIXER_READ_PCM;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
- extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
- extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
- extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
- extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
- extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
- extern unsigned IOCTL_SOUND_PCM_READ_BITS;
- extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
- extern unsigned IOCTL_SOUND_PCM_READ_FILTER;
- extern unsigned IOCTL_SOUND_PCM_READ_RATE;
- extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
- extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
- extern unsigned IOCTL_VT_ACTIVATE;
- extern unsigned IOCTL_VT_GETMODE;
- extern unsigned IOCTL_VT_OPENQRY;
- extern unsigned IOCTL_VT_RELDISP;
- extern unsigned IOCTL_VT_SETMODE;
- extern unsigned IOCTL_VT_WAITACTIVE;
- extern unsigned IOCTL_GIO_SCRNMAP;
- extern unsigned IOCTL_KDDISABIO;
- extern unsigned IOCTL_KDENABIO;
- extern unsigned IOCTL_KDGETLED;
- extern unsigned IOCTL_KDGETMODE;
- extern unsigned IOCTL_KDGKBMODE;
- extern unsigned IOCTL_KDGKBTYPE;
- extern unsigned IOCTL_KDMKTONE;
- extern unsigned IOCTL_KDSETLED;
- extern unsigned IOCTL_KDSETMODE;
- extern unsigned IOCTL_KDSKBMODE;
-
- extern const int si_SEGV_MAPERR;
- extern const int si_SEGV_ACCERR;
-
- struct __sanitizer_cap_rights {
- u64 cr_rights[2];
- };
-
- typedef struct __sanitizer_cap_rights __sanitizer_cap_rights_t;
- extern unsigned struct_cap_rights_sz;
-
- extern unsigned struct_fstab_sz;
- extern unsigned struct_StringList_sz;
+extern unsigned struct_ifreq_sz;
+extern unsigned struct_termios_sz;
+extern unsigned struct_winsize_sz;
+
+extern unsigned struct_copr_buffer_sz;
+extern unsigned struct_copr_debug_buf_sz;
+extern unsigned struct_copr_msg_sz;
+extern unsigned struct_midi_info_sz;
+extern unsigned struct_mtget_sz;
+extern unsigned struct_mtop_sz;
+extern unsigned struct_rtentry_sz;
+extern unsigned struct_sbi_instrument_sz;
+extern unsigned struct_seq_event_rec_sz;
+extern unsigned struct_synth_info_sz;
+extern unsigned struct_vt_mode_sz;
+
+extern const unsigned long __sanitizer_bufsiz;
+extern unsigned struct_audio_buf_info_sz;
+extern unsigned struct_ppp_stats_sz;
+extern unsigned struct_sioc_sg_req_sz;
+extern unsigned struct_sioc_vif_req_sz;
+
+// ioctl request identifiers
+
+// A special value to mark ioctls that are not present on the target platform,
+// when it can not be determined without including any system headers.
+extern const unsigned IOCTL_NOT_PRESENT;
+
+extern unsigned IOCTL_FIOASYNC;
+extern unsigned IOCTL_FIOCLEX;
+extern unsigned IOCTL_FIOGETOWN;
+extern unsigned IOCTL_FIONBIO;
+extern unsigned IOCTL_FIONCLEX;
+extern unsigned IOCTL_FIOSETOWN;
+extern unsigned IOCTL_SIOCADDMULTI;
+extern unsigned IOCTL_SIOCATMARK;
+extern unsigned IOCTL_SIOCDELMULTI;
+extern unsigned IOCTL_SIOCGIFADDR;
+extern unsigned IOCTL_SIOCGIFBRDADDR;
+extern unsigned IOCTL_SIOCGIFCONF;
+extern unsigned IOCTL_SIOCGIFDSTADDR;
+extern unsigned IOCTL_SIOCGIFFLAGS;
+extern unsigned IOCTL_SIOCGIFMETRIC;
+extern unsigned IOCTL_SIOCGIFMTU;
+extern unsigned IOCTL_SIOCGIFNETMASK;
+extern unsigned IOCTL_SIOCGPGRP;
+extern unsigned IOCTL_SIOCSIFADDR;
+extern unsigned IOCTL_SIOCSIFBRDADDR;
+extern unsigned IOCTL_SIOCSIFDSTADDR;
+extern unsigned IOCTL_SIOCSIFFLAGS;
+extern unsigned IOCTL_SIOCSIFMETRIC;
+extern unsigned IOCTL_SIOCSIFMTU;
+extern unsigned IOCTL_SIOCSIFNETMASK;
+extern unsigned IOCTL_SIOCSPGRP;
+extern unsigned IOCTL_TIOCCONS;
+extern unsigned IOCTL_TIOCEXCL;
+extern unsigned IOCTL_TIOCGETD;
+extern unsigned IOCTL_TIOCGPGRP;
+extern unsigned IOCTL_TIOCGWINSZ;
+extern unsigned IOCTL_TIOCMBIC;
+extern unsigned IOCTL_TIOCMBIS;
+extern unsigned IOCTL_TIOCMGET;
+extern unsigned IOCTL_TIOCMSET;
+extern unsigned IOCTL_TIOCNOTTY;
+extern unsigned IOCTL_TIOCNXCL;
+extern unsigned IOCTL_TIOCOUTQ;
+extern unsigned IOCTL_TIOCPKT;
+extern unsigned IOCTL_TIOCSCTTY;
+extern unsigned IOCTL_TIOCSETD;
+extern unsigned IOCTL_TIOCSPGRP;
+extern unsigned IOCTL_TIOCSTI;
+extern unsigned IOCTL_TIOCSWINSZ;
+extern unsigned IOCTL_SIOCGETSGCNT;
+extern unsigned IOCTL_SIOCGETVIFCNT;
+extern unsigned IOCTL_MTIOCGET;
+extern unsigned IOCTL_MTIOCTOP;
+extern unsigned IOCTL_SIOCADDRT;
+extern unsigned IOCTL_SIOCDELRT;
+extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
+extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
+extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
+extern unsigned IOCTL_SNDCTL_DSP_POST;
+extern unsigned IOCTL_SNDCTL_DSP_RESET;
+extern unsigned IOCTL_SNDCTL_DSP_SETFMT;
+extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
+extern unsigned IOCTL_SNDCTL_DSP_SPEED;
+extern unsigned IOCTL_SNDCTL_DSP_STEREO;
+extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
+extern unsigned IOCTL_SNDCTL_DSP_SYNC;
+extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
+extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
+extern unsigned IOCTL_SNDCTL_MIDI_INFO;
+extern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
+extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
+extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
+extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
+extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
+extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
+extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
+extern unsigned IOCTL_SNDCTL_SEQ_PANIC;
+extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
+extern unsigned IOCTL_SNDCTL_SEQ_RESET;
+extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
+extern unsigned IOCTL_SNDCTL_SEQ_SYNC;
+extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
+extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
+extern unsigned IOCTL_SNDCTL_SYNTH_INFO;
+extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
+extern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
+extern unsigned IOCTL_SNDCTL_TMR_METRONOME;
+extern unsigned IOCTL_SNDCTL_TMR_SELECT;
+extern unsigned IOCTL_SNDCTL_TMR_SOURCE;
+extern unsigned IOCTL_SNDCTL_TMR_START;
+extern unsigned IOCTL_SNDCTL_TMR_STOP;
+extern unsigned IOCTL_SNDCTL_TMR_TEMPO;
+extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
+extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
+extern unsigned IOCTL_SOUND_MIXER_READ_BASS;
+extern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
+extern unsigned IOCTL_SOUND_MIXER_READ_CD;
+extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
+extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
+extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
+extern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE;
+extern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
+extern unsigned IOCTL_SOUND_MIXER_READ_MIC;
+extern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
+extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
+extern unsigned IOCTL_SOUND_MIXER_READ_PCM;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
+extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
+extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
+extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
+extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
+extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
+extern unsigned IOCTL_SOUND_PCM_READ_BITS;
+extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
+extern unsigned IOCTL_SOUND_PCM_READ_FILTER;
+extern unsigned IOCTL_SOUND_PCM_READ_RATE;
+extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
+extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
+extern unsigned IOCTL_VT_ACTIVATE;
+extern unsigned IOCTL_VT_GETMODE;
+extern unsigned IOCTL_VT_OPENQRY;
+extern unsigned IOCTL_VT_RELDISP;
+extern unsigned IOCTL_VT_SETMODE;
+extern unsigned IOCTL_VT_WAITACTIVE;
+extern unsigned IOCTL_GIO_SCRNMAP;
+extern unsigned IOCTL_KDDISABIO;
+extern unsigned IOCTL_KDENABIO;
+extern unsigned IOCTL_KDGETLED;
+extern unsigned IOCTL_KDGETMODE;
+extern unsigned IOCTL_KDGKBMODE;
+extern unsigned IOCTL_KDGKBTYPE;
+extern unsigned IOCTL_KDMKTONE;
+extern unsigned IOCTL_KDSETLED;
+extern unsigned IOCTL_KDSETMODE;
+extern unsigned IOCTL_KDSKBMODE;
+
+extern const int si_SEGV_MAPERR;
+extern const int si_SEGV_ACCERR;
+
+struct __sanitizer_cap_rights {
+ u64 cr_rights[2];
+};
+
+typedef struct __sanitizer_cap_rights __sanitizer_cap_rights_t;
+extern unsigned struct_cap_rights_sz;
+
+extern unsigned struct_fstab_sz;
+extern unsigned struct_StringList_sz;
} // namespace __sanitizer
#define CHECK_TYPE_SIZE(TYPE) \
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc b/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp
index 14b0821cb819..842bc789f479 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_linux.cc --------------------------------===//
+//===-- sanitizer_platform_limits_linux.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +13,7 @@
// This is a separate compilation unit for linux headers that conflict with
// userspace headers.
-// Most "normal" includes go in sanitizer_platform_limits_posix.cc
+// Most "normal" includes go in sanitizer_platform_limits_posix.cpp
#include "sanitizer_platform.h"
#if SANITIZER_LINUX
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
index b2fb5cb76463..f01de6c995e6 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_netbsd.cc -------------------------------===//
+//===-- sanitizer_platform_limits_netbsd.cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -62,6 +62,8 @@
#include <sys/event.h>
#include <sys/filio.h>
#include <sys/ipc.h>
+#include <sys/ipmi.h>
+#include <sys/kcov.h>
#include <sys/mman.h>
#include <sys/module.h>
#include <sys/mount.h>
@@ -123,9 +125,6 @@
#include <dev/isa/isvio.h>
#include <dev/isa/wtreg.h>
#include <dev/iscsi/iscsi_ioctl.h>
-#if 0
-#include <dev/nvmm/nvmm_ioctl.h>
-#endif
#include <dev/ofw/openfirmio.h>
#include <dev/pci/amrio.h>
#include <dev/pci/mlyreg.h>
@@ -168,6 +167,7 @@
#include <dev/raidframe/raidframeio.h>
#include <dev/sbus/mbppio.h>
#include <dev/scsipi/ses.h>
+#include <dev/spi/spi_io.h>
#include <dev/spkrio.h>
#include <dev/sun/disklabel.h>
#include <dev/sun/fbio.h>
@@ -221,6 +221,10 @@
#include <regex.h>
#include <fstab.h>
#include <stringlist.h>
+
+#if defined(__x86_64__)
+#include <nvmm.h>
+#endif
// clang-format on
// Include these after system headers to avoid name clashes and ambiguities.
@@ -686,6 +690,26 @@ unsigned struct_usb_config_desc_sz = sizeof(usb_config_desc);
unsigned struct_usb_ctl_report_desc_sz = sizeof(usb_ctl_report_desc);
unsigned struct_usb_ctl_report_sz = sizeof(usb_ctl_report);
unsigned struct_usb_ctl_request_sz = sizeof(usb_ctl_request);
+#if defined(__x86_64__)
+unsigned struct_nvmm_ioc_capability_sz = sizeof(nvmm_ioc_capability);
+unsigned struct_nvmm_ioc_machine_create_sz = sizeof(nvmm_ioc_machine_create);
+unsigned struct_nvmm_ioc_machine_destroy_sz = sizeof(nvmm_ioc_machine_destroy);
+unsigned struct_nvmm_ioc_machine_configure_sz =
+ sizeof(nvmm_ioc_machine_configure);
+unsigned struct_nvmm_ioc_vcpu_create_sz = sizeof(nvmm_ioc_vcpu_create);
+unsigned struct_nvmm_ioc_vcpu_destroy_sz = sizeof(nvmm_ioc_vcpu_destroy);
+unsigned struct_nvmm_ioc_vcpu_setstate_sz = sizeof(nvmm_ioc_vcpu_destroy);
+unsigned struct_nvmm_ioc_vcpu_getstate_sz = sizeof(nvmm_ioc_vcpu_getstate);
+unsigned struct_nvmm_ioc_vcpu_inject_sz = sizeof(nvmm_ioc_vcpu_inject);
+unsigned struct_nvmm_ioc_vcpu_run_sz = sizeof(nvmm_ioc_vcpu_run);
+unsigned struct_nvmm_ioc_gpa_map_sz = sizeof(nvmm_ioc_gpa_map);
+unsigned struct_nvmm_ioc_gpa_unmap_sz = sizeof(nvmm_ioc_gpa_unmap);
+unsigned struct_nvmm_ioc_hva_map_sz = sizeof(nvmm_ioc_hva_map);
+unsigned struct_nvmm_ioc_hva_unmap_sz = sizeof(nvmm_ioc_hva_unmap);
+unsigned struct_nvmm_ioc_ctl_sz = sizeof(nvmm_ioc_ctl);
+#endif
+unsigned struct_spi_ioctl_configure_sz = sizeof(spi_ioctl_configure);
+unsigned struct_spi_ioctl_transfer_sz = sizeof(spi_ioctl_transfer);
unsigned struct_autofs_daemon_request_sz = sizeof(autofs_daemon_request);
unsigned struct_autofs_daemon_done_sz = sizeof(autofs_daemon_done);
unsigned struct_sctp_connectx_addrs_sz = sizeof(sctp_connectx_addrs);
@@ -728,6 +752,9 @@ unsigned struct_vnd_user_sz = sizeof(vnd_user);
unsigned struct_vt_stat_sz = sizeof(vt_stat);
unsigned struct_wdog_conf_sz = sizeof(wdog_conf);
unsigned struct_wdog_mode_sz = sizeof(wdog_mode);
+unsigned struct_ipmi_recv_sz = sizeof(ipmi_recv);
+unsigned struct_ipmi_req_sz = sizeof(ipmi_req);
+unsigned struct_ipmi_cmdspec_sz = sizeof(ipmi_cmdspec);
unsigned struct_wfq_conf_sz = sizeof(wfq_conf);
unsigned struct_wfq_getqid_sz = sizeof(wfq_getqid);
unsigned struct_wfq_getstats_sz = sizeof(wfq_getstats);
@@ -813,6 +840,7 @@ unsigned struct_iscsi_wait_event_parameters_sz =
unsigned struct_isp_stats_sz = sizeof(isp_stats_t);
unsigned struct_lsenable_sz = sizeof(struct lsenable);
unsigned struct_lsdisable_sz = sizeof(struct lsdisable);
+unsigned struct_audio_format_query_sz = sizeof(audio_format_query);
unsigned struct_mixer_ctrl_sz = sizeof(struct mixer_ctrl);
unsigned struct_mixer_devinfo_sz = sizeof(struct mixer_devinfo);
unsigned struct_mpu_command_rec_sz = sizeof(mpu_command_rec);
@@ -1423,7 +1451,7 @@ unsigned IOCTL_SPKRTONE = SPKRTONE;
unsigned IOCTL_SPKRTUNE = SPKRTUNE;
unsigned IOCTL_SPKRGETVOL = SPKRGETVOL;
unsigned IOCTL_SPKRSETVOL = SPKRSETVOL;
-#if 0 /* interfaces are WIP */
+#if defined(__x86_64__)
unsigned IOCTL_NVMM_IOC_CAPABILITY = NVMM_IOC_CAPABILITY;
unsigned IOCTL_NVMM_IOC_MACHINE_CREATE = NVMM_IOC_MACHINE_CREATE;
unsigned IOCTL_NVMM_IOC_MACHINE_DESTROY = NVMM_IOC_MACHINE_DESTROY;
@@ -1438,7 +1466,10 @@ unsigned IOCTL_NVMM_IOC_GPA_MAP = NVMM_IOC_GPA_MAP;
unsigned IOCTL_NVMM_IOC_GPA_UNMAP = NVMM_IOC_GPA_UNMAP;
unsigned IOCTL_NVMM_IOC_HVA_MAP = NVMM_IOC_HVA_MAP;
unsigned IOCTL_NVMM_IOC_HVA_UNMAP = NVMM_IOC_HVA_UNMAP;
+unsigned IOCTL_NVMM_IOC_CTL = NVMM_IOC_CTL;
#endif
+unsigned IOCTL_SPI_IOCTL_CONFIGURE = SPI_IOCTL_CONFIGURE;
+unsigned IOCTL_SPI_IOCTL_TRANSFER = SPI_IOCTL_TRANSFER;
unsigned IOCTL_AUTOFSREQUEST = AUTOFSREQUEST;
unsigned IOCTL_AUTOFSDONE = AUTOFSDONE;
unsigned IOCTL_BIOCGBLEN = BIOCGBLEN;
@@ -1656,6 +1687,9 @@ unsigned IOCTL_AUDIO_GETPROPS = AUDIO_GETPROPS;
unsigned IOCTL_AUDIO_GETBUFINFO = AUDIO_GETBUFINFO;
unsigned IOCTL_AUDIO_SETCHAN = AUDIO_SETCHAN;
unsigned IOCTL_AUDIO_GETCHAN = AUDIO_GETCHAN;
+unsigned IOCTL_AUDIO_QUERYFORMAT = AUDIO_QUERYFORMAT;
+unsigned IOCTL_AUDIO_GETFORMAT = AUDIO_GETFORMAT;
+unsigned IOCTL_AUDIO_SETFORMAT = AUDIO_SETFORMAT;
unsigned IOCTL_AUDIO_MIXER_READ = AUDIO_MIXER_READ;
unsigned IOCTL_AUDIO_MIXER_WRITE = AUDIO_MIXER_WRITE;
unsigned IOCTL_AUDIO_MIXER_DEVINFO = AUDIO_MIXER_DEVINFO;
@@ -1741,6 +1775,7 @@ unsigned IOCTL_DIOCTUR = DIOCTUR;
unsigned IOCTL_DIOCMWEDGES = DIOCMWEDGES;
unsigned IOCTL_DIOCGSECTORSIZE = DIOCGSECTORSIZE;
unsigned IOCTL_DIOCGMEDIASIZE = DIOCGMEDIASIZE;
+unsigned IOCTL_DIOCRMWEDGES = DIOCRMWEDGES;
unsigned IOCTL_DRVDETACHDEV = DRVDETACHDEV;
unsigned IOCTL_DRVRESCANBUS = DRVRESCANBUS;
unsigned IOCTL_DRVCTLCOMMAND = DRVCTLCOMMAND;
@@ -1945,6 +1980,8 @@ unsigned IOCTL_SIOCSLINKSTR = SIOCSLINKSTR;
unsigned IOCTL_SIOCGETHERCAP = SIOCGETHERCAP;
unsigned IOCTL_SIOCGIFINDEX = SIOCGIFINDEX;
unsigned IOCTL_SIOCSETHERCAP = SIOCSETHERCAP;
+unsigned IOCTL_SIOCSIFDESCR = SIOCSIFDESCR;
+unsigned IOCTL_SIOCGIFDESCR = SIOCGIFDESCR;
unsigned IOCTL_SIOCGUMBINFO = SIOCGUMBINFO;
unsigned IOCTL_SIOCSUMBPARAM = SIOCSUMBPARAM;
unsigned IOCTL_SIOCGUMBPARAM = SIOCGUMBPARAM;
@@ -2069,6 +2106,19 @@ unsigned IOCTL_WDOGIOC_WHICH = WDOGIOC_WHICH;
unsigned IOCTL_WDOGIOC_TICKLE = WDOGIOC_TICKLE;
unsigned IOCTL_WDOGIOC_GTICKLER = WDOGIOC_GTICKLER;
unsigned IOCTL_WDOGIOC_GWDOGS = WDOGIOC_GWDOGS;
+unsigned IOCTL_KCOV_IOC_SETBUFSIZE = KCOV_IOC_SETBUFSIZE;
+unsigned IOCTL_KCOV_IOC_ENABLE = KCOV_IOC_ENABLE;
+unsigned IOCTL_KCOV_IOC_DISABLE = KCOV_IOC_DISABLE;
+unsigned IOCTL_IPMICTL_RECEIVE_MSG_TRUNC = IPMICTL_RECEIVE_MSG_TRUNC;
+unsigned IOCTL_IPMICTL_RECEIVE_MSG = IPMICTL_RECEIVE_MSG;
+unsigned IOCTL_IPMICTL_SEND_COMMAND = IPMICTL_SEND_COMMAND;
+unsigned IOCTL_IPMICTL_REGISTER_FOR_CMD = IPMICTL_REGISTER_FOR_CMD;
+unsigned IOCTL_IPMICTL_UNREGISTER_FOR_CMD = IPMICTL_UNREGISTER_FOR_CMD;
+unsigned IOCTL_IPMICTL_SET_GETS_EVENTS_CMD = IPMICTL_SET_GETS_EVENTS_CMD;
+unsigned IOCTL_IPMICTL_SET_MY_ADDRESS_CMD = IPMICTL_SET_MY_ADDRESS_CMD;
+unsigned IOCTL_IPMICTL_GET_MY_ADDRESS_CMD = IPMICTL_GET_MY_ADDRESS_CMD;
+unsigned IOCTL_IPMICTL_SET_MY_LUN_CMD = IPMICTL_SET_MY_LUN_CMD;
+unsigned IOCTL_IPMICTL_GET_MY_LUN_CMD = IPMICTL_GET_MY_LUN_CMD;
unsigned IOCTL_SNDCTL_DSP_RESET = SNDCTL_DSP_RESET;
unsigned IOCTL_SNDCTL_DSP_SYNC = SNDCTL_DSP_SYNC;
unsigned IOCTL_SNDCTL_DSP_SPEED = SNDCTL_DSP_SPEED;
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
index add9852ec6c3..4fb3b8c0e06f 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
@@ -849,6 +849,25 @@ extern unsigned struct_usb_config_desc_sz;
extern unsigned struct_usb_ctl_report_desc_sz;
extern unsigned struct_usb_ctl_report_sz;
extern unsigned struct_usb_ctl_request_sz;
+#if defined(__x86_64__)
+extern unsigned struct_nvmm_ioc_capability_sz;
+extern unsigned struct_nvmm_ioc_machine_create_sz;
+extern unsigned struct_nvmm_ioc_machine_destroy_sz;
+extern unsigned struct_nvmm_ioc_machine_configure_sz;
+extern unsigned struct_nvmm_ioc_vcpu_create_sz;
+extern unsigned struct_nvmm_ioc_vcpu_destroy_sz;
+extern unsigned struct_nvmm_ioc_vcpu_setstate_sz;
+extern unsigned struct_nvmm_ioc_vcpu_getstate_sz;
+extern unsigned struct_nvmm_ioc_vcpu_inject_sz;
+extern unsigned struct_nvmm_ioc_vcpu_run_sz;
+extern unsigned struct_nvmm_ioc_gpa_map_sz;
+extern unsigned struct_nvmm_ioc_gpa_unmap_sz;
+extern unsigned struct_nvmm_ioc_hva_map_sz;
+extern unsigned struct_nvmm_ioc_hva_unmap_sz;
+extern unsigned struct_nvmm_ioc_ctl_sz;
+#endif
+extern unsigned struct_spi_ioctl_configure_sz;
+extern unsigned struct_spi_ioctl_transfer_sz;
extern unsigned struct_autofs_daemon_request_sz;
extern unsigned struct_autofs_daemon_done_sz;
extern unsigned struct_sctp_connectx_addrs_sz;
@@ -891,6 +910,9 @@ extern unsigned struct_vnd_user_sz;
extern unsigned struct_vt_stat_sz;
extern unsigned struct_wdog_conf_sz;
extern unsigned struct_wdog_mode_sz;
+extern unsigned struct_ipmi_recv_sz;
+extern unsigned struct_ipmi_req_sz;
+extern unsigned struct_ipmi_cmdspec_sz;
extern unsigned struct_wfq_conf_sz;
extern unsigned struct_wfq_getqid_sz;
extern unsigned struct_wfq_getstats_sz;
@@ -969,6 +991,7 @@ extern unsigned struct_iscsi_wait_event_parameters_sz;
extern unsigned struct_isp_stats_sz;
extern unsigned struct_lsenable_sz;
extern unsigned struct_lsdisable_sz;
+extern unsigned struct_audio_format_query_sz;
extern unsigned struct_mixer_ctrl_sz;
extern unsigned struct_mixer_devinfo_sz;
extern unsigned struct_mpu_command_rec_sz;
@@ -1575,7 +1598,7 @@ extern unsigned IOCTL_SPKRTONE;
extern unsigned IOCTL_SPKRTUNE;
extern unsigned IOCTL_SPKRGETVOL;
extern unsigned IOCTL_SPKRSETVOL;
-#if 0 /* interfaces are WIP */
+#if defined(__x86_64__)
extern unsigned IOCTL_NVMM_IOC_CAPABILITY;
extern unsigned IOCTL_NVMM_IOC_MACHINE_CREATE;
extern unsigned IOCTL_NVMM_IOC_MACHINE_DESTROY;
@@ -1590,6 +1613,7 @@ extern unsigned IOCTL_NVMM_IOC_GPA_MAP;
extern unsigned IOCTL_NVMM_IOC_GPA_UNMAP;
extern unsigned IOCTL_NVMM_IOC_HVA_MAP;
extern unsigned IOCTL_NVMM_IOC_HVA_UNMAP;
+extern unsigned IOCTL_NVMM_IOC_CTL;
#endif
extern unsigned IOCTL_AUTOFSREQUEST;
extern unsigned IOCTL_AUTOFSDONE;
@@ -1808,6 +1832,9 @@ extern unsigned IOCTL_AUDIO_GETPROPS;
extern unsigned IOCTL_AUDIO_GETBUFINFO;
extern unsigned IOCTL_AUDIO_SETCHAN;
extern unsigned IOCTL_AUDIO_GETCHAN;
+extern unsigned IOCTL_AUDIO_QUERYFORMAT;
+extern unsigned IOCTL_AUDIO_GETFORMAT;
+extern unsigned IOCTL_AUDIO_SETFORMAT;
extern unsigned IOCTL_AUDIO_MIXER_READ;
extern unsigned IOCTL_AUDIO_MIXER_WRITE;
extern unsigned IOCTL_AUDIO_MIXER_DEVINFO;
@@ -1893,6 +1920,7 @@ extern unsigned IOCTL_DIOCTUR;
extern unsigned IOCTL_DIOCMWEDGES;
extern unsigned IOCTL_DIOCGSECTORSIZE;
extern unsigned IOCTL_DIOCGMEDIASIZE;
+extern unsigned IOCTL_DIOCRMWEDGES;
extern unsigned IOCTL_DRVDETACHDEV;
extern unsigned IOCTL_DRVRESCANBUS;
extern unsigned IOCTL_DRVCTLCOMMAND;
@@ -1994,6 +2022,8 @@ extern unsigned IOCTL_SEQUENCER_TMR_TEMPO;
extern unsigned IOCTL_SEQUENCER_TMR_SOURCE;
extern unsigned IOCTL_SEQUENCER_TMR_METRONOME;
extern unsigned IOCTL_SEQUENCER_TMR_SELECT;
+extern unsigned IOCTL_SPI_IOCTL_CONFIGURE;
+extern unsigned IOCTL_SPI_IOCTL_TRANSFER;
extern unsigned IOCTL_MTIOCTOP;
extern unsigned IOCTL_MTIOCGET;
extern unsigned IOCTL_MTIOCIEOT;
@@ -2097,6 +2127,8 @@ extern unsigned IOCTL_SIOCSLINKSTR;
extern unsigned IOCTL_SIOCGETHERCAP;
extern unsigned IOCTL_SIOCGIFINDEX;
extern unsigned IOCTL_SIOCSETHERCAP;
+extern unsigned IOCTL_SIOCSIFDESCR;
+extern unsigned IOCTL_SIOCGIFDESCR;
extern unsigned IOCTL_SIOCGUMBINFO;
extern unsigned IOCTL_SIOCSUMBPARAM;
extern unsigned IOCTL_SIOCGUMBPARAM;
@@ -2221,6 +2253,19 @@ extern unsigned IOCTL_WDOGIOC_WHICH;
extern unsigned IOCTL_WDOGIOC_TICKLE;
extern unsigned IOCTL_WDOGIOC_GTICKLER;
extern unsigned IOCTL_WDOGIOC_GWDOGS;
+extern unsigned IOCTL_KCOV_IOC_SETBUFSIZE;
+extern unsigned IOCTL_KCOV_IOC_ENABLE;
+extern unsigned IOCTL_KCOV_IOC_DISABLE;
+extern unsigned IOCTL_IPMICTL_RECEIVE_MSG_TRUNC;
+extern unsigned IOCTL_IPMICTL_RECEIVE_MSG;
+extern unsigned IOCTL_IPMICTL_SEND_COMMAND;
+extern unsigned IOCTL_IPMICTL_REGISTER_FOR_CMD;
+extern unsigned IOCTL_IPMICTL_UNREGISTER_FOR_CMD;
+extern unsigned IOCTL_IPMICTL_SET_GETS_EVENTS_CMD;
+extern unsigned IOCTL_IPMICTL_SET_MY_ADDRESS_CMD;
+extern unsigned IOCTL_IPMICTL_GET_MY_ADDRESS_CMD;
+extern unsigned IOCTL_IPMICTL_SET_MY_LUN_CMD;
+extern unsigned IOCTL_IPMICTL_GET_MY_LUN_CMD;
extern unsigned IOCTL_SNDCTL_DSP_RESET;
extern unsigned IOCTL_SNDCTL_DSP_SYNC;
extern unsigned IOCTL_SNDCTL_DSP_SPEED;
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cc b/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cpp
index 5a1b07fa9c5e..12515626ce53 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_openbsd.cc ------------------------------===//
+//===-- sanitizer_platform_limits_openbsd.cpp -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index b7fa6e8f7e07..9852e6ba7879 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_posix.cc --------------------------------===//
+//===-- sanitizer_platform_limits_posix.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -22,6 +22,10 @@
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
+
+// Must go after undef _FILE_OFFSET_BITS.
+#include "sanitizer_glibc_version.h"
+
#include <arpa/inet.h>
#include <dirent.h>
#include <grp.h>
@@ -136,6 +140,7 @@ typedef struct user_fpregs elf_fpregset_t;
#include <linux/serial.h>
#include <sys/msg.h>
#include <sys/ipc.h>
+#include <crypt.h>
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
#if SANITIZER_ANDROID
@@ -236,6 +241,7 @@ namespace __sanitizer {
unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ unsigned struct_crypt_data_sz = sizeof(struct crypt_data);
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
#if SANITIZER_LINUX && !SANITIZER_ANDROID
@@ -1005,10 +1011,6 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
-#endif
-
#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
CHECK_TYPE_SIZE(mmsghdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
@@ -1126,8 +1128,11 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+ !defined(__arm__)
/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
+/* On Arm newer glibc provide a different mode field, it's hard to detect
+ so just disable the check. */
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
#endif
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index f1a4fd7d3709..db2c4f07b3ae 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -19,844 +19,846 @@
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform.h"
-# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
-
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
+#if defined(__sparc__)
+// FIXME: This can't be included from tsan which does not support sparc yet.
+#include "sanitizer_glibc_version.h"
#endif
+# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
+
namespace __sanitizer {
- extern unsigned struct_utsname_sz;
- extern unsigned struct_stat_sz;
+extern unsigned struct_utsname_sz;
+extern unsigned struct_stat_sz;
#if !SANITIZER_IOS
- extern unsigned struct_stat64_sz;
-#endif
- extern unsigned struct_rusage_sz;
- extern unsigned siginfo_t_sz;
- extern unsigned struct_itimerval_sz;
- extern unsigned pthread_t_sz;
- extern unsigned pthread_mutex_t_sz;
- extern unsigned pthread_cond_t_sz;
- extern unsigned pid_t_sz;
- extern unsigned timeval_sz;
- extern unsigned uid_t_sz;
- extern unsigned gid_t_sz;
- extern unsigned mbstate_t_sz;
- extern unsigned struct_timezone_sz;
- extern unsigned struct_tms_sz;
- extern unsigned struct_itimerspec_sz;
- extern unsigned struct_sigevent_sz;
- extern unsigned struct_sched_param_sz;
- extern unsigned struct_statfs64_sz;
- extern unsigned struct_regex_sz;
- extern unsigned struct_regmatch_sz;
+extern unsigned struct_stat64_sz;
+#endif
+extern unsigned struct_rusage_sz;
+extern unsigned siginfo_t_sz;
+extern unsigned struct_itimerval_sz;
+extern unsigned pthread_t_sz;
+extern unsigned pthread_mutex_t_sz;
+extern unsigned pthread_cond_t_sz;
+extern unsigned pid_t_sz;
+extern unsigned timeval_sz;
+extern unsigned uid_t_sz;
+extern unsigned gid_t_sz;
+extern unsigned mbstate_t_sz;
+extern unsigned struct_timezone_sz;
+extern unsigned struct_tms_sz;
+extern unsigned struct_itimerspec_sz;
+extern unsigned struct_sigevent_sz;
+extern unsigned struct_sched_param_sz;
+extern unsigned struct_statfs64_sz;
+extern unsigned struct_regex_sz;
+extern unsigned struct_regmatch_sz;
#if !SANITIZER_ANDROID
- extern unsigned struct_fstab_sz;
- extern unsigned struct_statfs_sz;
- extern unsigned struct_sockaddr_sz;
- extern unsigned ucontext_t_sz;
+extern unsigned struct_fstab_sz;
+extern unsigned struct_statfs_sz;
+extern unsigned struct_sockaddr_sz;
+extern unsigned ucontext_t_sz;
#endif // !SANITIZER_ANDROID
#if SANITIZER_LINUX
#if defined(__x86_64__)
- const unsigned struct_kernel_stat_sz = 144;
- const unsigned struct_kernel_stat64_sz = 0;
+const unsigned struct_kernel_stat_sz = 144;
+const unsigned struct_kernel_stat64_sz = 0;
#elif defined(__i386__)
- const unsigned struct_kernel_stat_sz = 64;
- const unsigned struct_kernel_stat64_sz = 96;
+const unsigned struct_kernel_stat_sz = 64;
+const unsigned struct_kernel_stat64_sz = 96;
#elif defined(__arm__)
- const unsigned struct_kernel_stat_sz = 64;
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = 64;
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__aarch64__)
- const unsigned struct_kernel_stat_sz = 128;
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = 128;
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__powerpc__) && !defined(__powerpc64__)
- const unsigned struct_kernel_stat_sz = 72;
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = 72;
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__powerpc64__)
- const unsigned struct_kernel_stat_sz = 144;
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = 144;
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__mips__)
- const unsigned struct_kernel_stat_sz =
- SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) :
- FIRST_32_SECOND_64(160, 216);
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
+ ? FIRST_32_SECOND_64(104, 128)
+ : FIRST_32_SECOND_64(160, 216);
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390__) && !defined(__s390x__)
- const unsigned struct_kernel_stat_sz = 64;
- const unsigned struct_kernel_stat64_sz = 104;
+const unsigned struct_kernel_stat_sz = 64;
+const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390x__)
- const unsigned struct_kernel_stat_sz = 144;
- const unsigned struct_kernel_stat64_sz = 0;
+const unsigned struct_kernel_stat_sz = 144;
+const unsigned struct_kernel_stat64_sz = 0;
#elif defined(__sparc__) && defined(__arch64__)
- const unsigned struct___old_kernel_stat_sz = 0;
- const unsigned struct_kernel_stat_sz = 104;
- const unsigned struct_kernel_stat64_sz = 144;
+const unsigned struct___old_kernel_stat_sz = 0;
+const unsigned struct_kernel_stat_sz = 104;
+const unsigned struct_kernel_stat64_sz = 144;
#elif defined(__sparc__) && !defined(__arch64__)
- const unsigned struct___old_kernel_stat_sz = 0;
- const unsigned struct_kernel_stat_sz = 64;
- const unsigned struct_kernel_stat64_sz = 104;
-#endif
- struct __sanitizer_perf_event_attr {
- unsigned type;
- unsigned size;
- // More fields that vary with the kernel version.
- };
+const unsigned struct___old_kernel_stat_sz = 0;
+const unsigned struct_kernel_stat_sz = 64;
+const unsigned struct_kernel_stat64_sz = 104;
+#endif
+struct __sanitizer_perf_event_attr {
+ unsigned type;
+ unsigned size;
+ // More fields that vary with the kernel version.
+};
- extern unsigned struct_epoll_event_sz;
- extern unsigned struct_sysinfo_sz;
- extern unsigned __user_cap_header_struct_sz;
- extern unsigned __user_cap_data_struct_sz;
- extern unsigned struct_new_utsname_sz;
- extern unsigned struct_old_utsname_sz;
- extern unsigned struct_oldold_utsname_sz;
+extern unsigned struct_epoll_event_sz;
+extern unsigned struct_sysinfo_sz;
+extern unsigned __user_cap_header_struct_sz;
+extern unsigned __user_cap_data_struct_sz;
+extern unsigned struct_new_utsname_sz;
+extern unsigned struct_old_utsname_sz;
+extern unsigned struct_oldold_utsname_sz;
- const unsigned struct_kexec_segment_sz = 4 * sizeof(unsigned long);
+const unsigned struct_kexec_segment_sz = 4 * sizeof(unsigned long);
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX
#if defined(__powerpc64__) || defined(__s390__)
- const unsigned struct___old_kernel_stat_sz = 0;
+const unsigned struct___old_kernel_stat_sz = 0;
#elif !defined(__sparc__)
- const unsigned struct___old_kernel_stat_sz = 32;
-#endif
-
- extern unsigned struct_rlimit_sz;
- extern unsigned struct_utimbuf_sz;
- extern unsigned struct_timespec_sz;
-
- struct __sanitizer_iocb {
- u64 aio_data;
- u32 aio_key_or_aio_reserved1; // Simply crazy.
- u32 aio_reserved1_or_aio_key; // Luckily, we don't need these.
- u16 aio_lio_opcode;
- s16 aio_reqprio;
- u32 aio_fildes;
- u64 aio_buf;
- u64 aio_nbytes;
- s64 aio_offset;
- u64 aio_reserved2;
- u64 aio_reserved3;
- };
+const unsigned struct___old_kernel_stat_sz = 32;
+#endif
- struct __sanitizer_io_event {
- u64 data;
- u64 obj;
- u64 res;
- u64 res2;
- };
+extern unsigned struct_rlimit_sz;
+extern unsigned struct_utimbuf_sz;
+extern unsigned struct_timespec_sz;
+
+struct __sanitizer_iocb {
+ u64 aio_data;
+ u32 aio_key_or_aio_reserved1; // Simply crazy.
+ u32 aio_reserved1_or_aio_key; // Luckily, we don't need these.
+ u16 aio_lio_opcode;
+ s16 aio_reqprio;
+ u32 aio_fildes;
+ u64 aio_buf;
+ u64 aio_nbytes;
+ s64 aio_offset;
+ u64 aio_reserved2;
+ u64 aio_reserved3;
+};
- const unsigned iocb_cmd_pread = 0;
- const unsigned iocb_cmd_pwrite = 1;
- const unsigned iocb_cmd_preadv = 7;
- const unsigned iocb_cmd_pwritev = 8;
-
- struct __sanitizer___sysctl_args {
- int *name;
- int nlen;
- void *oldval;
- uptr *oldlenp;
- void *newval;
- uptr newlen;
- unsigned long ___unused[4];
- };
+struct __sanitizer_io_event {
+ u64 data;
+ u64 obj;
+ u64 res;
+ u64 res2;
+};
- const unsigned old_sigset_t_sz = sizeof(unsigned long);
+const unsigned iocb_cmd_pread = 0;
+const unsigned iocb_cmd_pwrite = 1;
+const unsigned iocb_cmd_preadv = 7;
+const unsigned iocb_cmd_pwritev = 8;
+
+struct __sanitizer___sysctl_args {
+ int *name;
+ int nlen;
+ void *oldval;
+ uptr *oldlenp;
+ void *newval;
+ uptr newlen;
+ unsigned long ___unused[4];
+};
- struct __sanitizer_sem_t {
+const unsigned old_sigset_t_sz = sizeof(unsigned long);
+
+struct __sanitizer_sem_t {
#if SANITIZER_ANDROID && defined(_LP64)
- int data[4];
+ int data[4];
#elif SANITIZER_ANDROID && !defined(_LP64)
- int data;
+ int data;
#elif SANITIZER_LINUX
- uptr data[4];
+ uptr data[4];
#endif
- };
+};
#endif // SANITIZER_LINUX
#if SANITIZER_ANDROID
- struct __sanitizer_struct_mallinfo {
- uptr v[10];
- };
+struct __sanitizer_struct_mallinfo {
+ uptr v[10];
+};
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- struct __sanitizer_struct_mallinfo {
- int v[10];
- };
+struct __sanitizer_struct_mallinfo {
+ int v[10];
+};
- extern unsigned struct_ustat_sz;
- extern unsigned struct_rlimit64_sz;
- extern unsigned struct_statvfs64_sz;
+extern unsigned struct_ustat_sz;
+extern unsigned struct_rlimit64_sz;
+extern unsigned struct_statvfs64_sz;
- struct __sanitizer_ipc_perm {
- int __key;
- int uid;
- int gid;
- int cuid;
- int cgid;
+struct __sanitizer_ipc_perm {
+ int __key;
+ int uid;
+ int gid;
+ int cuid;
+ int cgid;
#ifdef __powerpc__
- unsigned mode;
- unsigned __seq;
- u64 __unused1;
- u64 __unused2;
+ unsigned mode;
+ unsigned __seq;
+ u64 __unused1;
+ u64 __unused2;
#elif defined(__sparc__)
#if defined(__arch64__)
- unsigned mode;
- unsigned short __pad1;
+ unsigned mode;
+ unsigned short __pad1;
#else
- unsigned short __pad1;
- unsigned short mode;
- unsigned short __pad2;
+ unsigned short __pad1;
+ unsigned short mode;
+ unsigned short __pad2;
#endif
- unsigned short __seq;
- unsigned long long __unused1;
- unsigned long long __unused2;
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned long __unused2;
+ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad1;
+ unsigned long __unused1;
+ unsigned long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
- unsigned short __seq;
- unsigned short __pad2;
+ unsigned short mode;
+ unsigned short __pad1;
+ unsigned short __seq;
+ unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
- u64 __unused1;
- u64 __unused2;
+ u64 __unused1;
+ u64 __unused2;
#else
- unsigned long __unused1;
- unsigned long __unused2;
+ unsigned long __unused1;
+ unsigned long __unused2;
#endif
#endif
- };
+};
- struct __sanitizer_shmid_ds {
- __sanitizer_ipc_perm shm_perm;
- #if defined(__sparc__)
- #if !defined(__arch64__)
- u32 __pad1;
- #endif
- long shm_atime;
- #if !defined(__arch64__)
- u32 __pad2;
- #endif
- long shm_dtime;
- #if !defined(__arch64__)
- u32 __pad3;
- #endif
- long shm_ctime;
- uptr shm_segsz;
- int shm_cpid;
- int shm_lpid;
- unsigned long shm_nattch;
- unsigned long __glibc_reserved1;
- unsigned long __glibc_reserved2;
- #else
- #ifndef __powerpc__
- uptr shm_segsz;
- #elif !defined(__powerpc64__)
- uptr __unused0;
- #endif
- #if defined(__x86_64__) && !defined(_LP64)
- u64 shm_atime;
- u64 shm_dtime;
- u64 shm_ctime;
- #else
- uptr shm_atime;
- #if !defined(_LP64) && !defined(__mips__)
- uptr __unused1;
- #endif
- uptr shm_dtime;
- #if !defined(_LP64) && !defined(__mips__)
- uptr __unused2;
- #endif
- uptr shm_ctime;
- #if !defined(_LP64) && !defined(__mips__)
- uptr __unused3;
- #endif
- #endif
- #ifdef __powerpc__
- uptr shm_segsz;
- #endif
- int shm_cpid;
- int shm_lpid;
- #if defined(__x86_64__) && !defined(_LP64)
- u64 shm_nattch;
- u64 __unused4;
- u64 __unused5;
- #else
- uptr shm_nattch;
- uptr __unused4;
- uptr __unused5;
- #endif
+struct __sanitizer_shmid_ds {
+ __sanitizer_ipc_perm shm_perm;
+#if defined(__sparc__)
+#if !defined(__arch64__)
+ u32 __pad1;
#endif
- };
+ long shm_atime;
+#if !defined(__arch64__)
+ u32 __pad2;
+#endif
+ long shm_dtime;
+#if !defined(__arch64__)
+ u32 __pad3;
+#endif
+ long shm_ctime;
+ uptr shm_segsz;
+ int shm_cpid;
+ int shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __glibc_reserved1;
+ unsigned long __glibc_reserved2;
+#else
+#ifndef __powerpc__
+ uptr shm_segsz;
+#elif !defined(__powerpc64__)
+ uptr __unused0;
+#endif
+#if defined(__x86_64__) && !defined(_LP64)
+ u64 shm_atime;
+ u64 shm_dtime;
+ u64 shm_ctime;
+#else
+ uptr shm_atime;
+#if !defined(_LP64) && !defined(__mips__)
+ uptr __unused1;
+#endif
+ uptr shm_dtime;
+#if !defined(_LP64) && !defined(__mips__)
+ uptr __unused2;
+#endif
+ uptr shm_ctime;
+#if !defined(_LP64) && !defined(__mips__)
+ uptr __unused3;
+#endif
+#endif
+#ifdef __powerpc__
+ uptr shm_segsz;
+#endif
+ int shm_cpid;
+ int shm_lpid;
+#if defined(__x86_64__) && !defined(_LP64)
+ u64 shm_nattch;
+ u64 __unused4;
+ u64 __unused5;
+#else
+ uptr shm_nattch;
+ uptr __unused4;
+ uptr __unused5;
+#endif
+#endif
+};
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_msqid_ds_sz;
- extern unsigned struct_mq_attr_sz;
- extern unsigned struct_timex_sz;
- extern unsigned struct_statvfs_sz;
+extern unsigned struct_msqid_ds_sz;
+extern unsigned struct_mq_attr_sz;
+extern unsigned struct_timex_sz;
+extern unsigned struct_statvfs_sz;
+extern unsigned struct_crypt_data_sz;
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
- struct __sanitizer_iovec {
- void *iov_base;
- uptr iov_len;
- };
+struct __sanitizer_iovec {
+ void *iov_base;
+ uptr iov_len;
+};
#if !SANITIZER_ANDROID
- struct __sanitizer_ifaddrs {
- struct __sanitizer_ifaddrs *ifa_next;
- char *ifa_name;
- unsigned int ifa_flags;
- void *ifa_addr; // (struct sockaddr *)
- void *ifa_netmask; // (struct sockaddr *)
- // This is a union on Linux.
+struct __sanitizer_ifaddrs {
+ struct __sanitizer_ifaddrs *ifa_next;
+ char *ifa_name;
+ unsigned int ifa_flags;
+ void *ifa_addr; // (struct sockaddr *)
+ void *ifa_netmask; // (struct sockaddr *)
+ // This is a union on Linux.
# ifdef ifa_dstaddr
# undef ifa_dstaddr
# endif
- void *ifa_dstaddr; // (struct sockaddr *)
- void *ifa_data;
- };
+ void *ifa_dstaddr; // (struct sockaddr *)
+ void *ifa_data;
+};
#endif // !SANITIZER_ANDROID
#if SANITIZER_MAC
- typedef unsigned long __sanitizer_pthread_key_t;
+typedef unsigned long __sanitizer_pthread_key_t;
#else
- typedef unsigned __sanitizer_pthread_key_t;
+typedef unsigned __sanitizer_pthread_key_t;
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- struct __sanitizer_XDR {
- int x_op;
- void *x_ops;
- uptr x_public;
- uptr x_private;
- uptr x_base;
- unsigned x_handy;
- };
+struct __sanitizer_XDR {
+ int x_op;
+ void *x_ops;
+ uptr x_public;
+ uptr x_private;
+ uptr x_base;
+ unsigned x_handy;
+};
- const int __sanitizer_XDR_ENCODE = 0;
- const int __sanitizer_XDR_DECODE = 1;
- const int __sanitizer_XDR_FREE = 2;
+const int __sanitizer_XDR_ENCODE = 0;
+const int __sanitizer_XDR_DECODE = 1;
+const int __sanitizer_XDR_FREE = 2;
#endif
- struct __sanitizer_passwd {
- char *pw_name;
- char *pw_passwd;
- int pw_uid;
- int pw_gid;
+struct __sanitizer_passwd {
+ char *pw_name;
+ char *pw_passwd;
+ int pw_uid;
+ int pw_gid;
#if SANITIZER_MAC
- long pw_change;
- char *pw_class;
+ long pw_change;
+ char *pw_class;
#endif
#if !(SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32))
- char *pw_gecos;
+ char *pw_gecos;
#endif
- char *pw_dir;
- char *pw_shell;
+ char *pw_dir;
+ char *pw_shell;
#if SANITIZER_MAC
- long pw_expire;
+ long pw_expire;
#endif
- };
+};
- struct __sanitizer_group {
- char *gr_name;
- char *gr_passwd;
- int gr_gid;
- char **gr_mem;
- };
+struct __sanitizer_group {
+ char *gr_name;
+ char *gr_passwd;
+ int gr_gid;
+ char **gr_mem;
+};
#if defined(__x86_64__) && !defined(_LP64)
- typedef long long __sanitizer_time_t;
+typedef long long __sanitizer_time_t;
#else
- typedef long __sanitizer_time_t;
+typedef long __sanitizer_time_t;
#endif
- typedef long __sanitizer_suseconds_t;
+typedef long __sanitizer_suseconds_t;
- struct __sanitizer_timeval {
- __sanitizer_time_t tv_sec;
- __sanitizer_suseconds_t tv_usec;
- };
+struct __sanitizer_timeval {
+ __sanitizer_time_t tv_sec;
+ __sanitizer_suseconds_t tv_usec;
+};
- struct __sanitizer_itimerval {
- struct __sanitizer_timeval it_interval;
- struct __sanitizer_timeval it_value;
- };
+struct __sanitizer_itimerval {
+ struct __sanitizer_timeval it_interval;
+ struct __sanitizer_timeval it_value;
+};
- struct __sanitizer_timeb {
- __sanitizer_time_t time;
- unsigned short millitm;
- short timezone;
- short dstflag;
- };
+struct __sanitizer_timeb {
+ __sanitizer_time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+};
- struct __sanitizer_ether_addr {
- u8 octet[6];
- };
+struct __sanitizer_ether_addr {
+ u8 octet[6];
+};
- struct __sanitizer_tm {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- long int tm_gmtoff;
- const char *tm_zone;
- };
+struct __sanitizer_tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+ long int tm_gmtoff;
+ const char *tm_zone;
+};
#if SANITIZER_LINUX
- struct __sanitizer_mntent {
- char *mnt_fsname;
- char *mnt_dir;
- char *mnt_type;
- char *mnt_opts;
- int mnt_freq;
- int mnt_passno;
- };
+struct __sanitizer_mntent {
+ char *mnt_fsname;
+ char *mnt_dir;
+ char *mnt_type;
+ char *mnt_opts;
+ int mnt_freq;
+ int mnt_passno;
+};
- struct __sanitizer_file_handle {
- unsigned int handle_bytes;
- int handle_type;
- unsigned char f_handle[1]; // variable sized
- };
+struct __sanitizer_file_handle {
+ unsigned int handle_bytes;
+ int handle_type;
+ unsigned char f_handle[1]; // variable sized
+};
#endif
#if SANITIZER_MAC
- struct __sanitizer_msghdr {
- void *msg_name;
- unsigned msg_namelen;
- struct __sanitizer_iovec *msg_iov;
- unsigned msg_iovlen;
- void *msg_control;
- unsigned msg_controllen;
- int msg_flags;
- };
- struct __sanitizer_cmsghdr {
- unsigned cmsg_len;
- int cmsg_level;
- int cmsg_type;
- };
+struct __sanitizer_msghdr {
+ void *msg_name;
+ unsigned msg_namelen;
+ struct __sanitizer_iovec *msg_iov;
+ unsigned msg_iovlen;
+ void *msg_control;
+ unsigned msg_controllen;
+ int msg_flags;
+};
+struct __sanitizer_cmsghdr {
+ unsigned cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+};
#else
- struct __sanitizer_msghdr {
- void *msg_name;
- unsigned msg_namelen;
- struct __sanitizer_iovec *msg_iov;
- uptr msg_iovlen;
- void *msg_control;
- uptr msg_controllen;
- int msg_flags;
- };
- struct __sanitizer_cmsghdr {
- uptr cmsg_len;
- int cmsg_level;
- int cmsg_type;
- };
+struct __sanitizer_msghdr {
+ void *msg_name;
+ unsigned msg_namelen;
+ struct __sanitizer_iovec *msg_iov;
+ uptr msg_iovlen;
+ void *msg_control;
+ uptr msg_controllen;
+ int msg_flags;
+};
+struct __sanitizer_cmsghdr {
+ uptr cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+};
#endif
#if SANITIZER_LINUX
- struct __sanitizer_mmsghdr {
- __sanitizer_msghdr msg_hdr;
- unsigned int msg_len;
- };
+struct __sanitizer_mmsghdr {
+ __sanitizer_msghdr msg_hdr;
+ unsigned int msg_len;
+};
#endif
#if SANITIZER_MAC
- struct __sanitizer_dirent {
- unsigned long long d_ino;
- unsigned long long d_seekoff;
- unsigned short d_reclen;
- // more fields that we don't care about
- };
+struct __sanitizer_dirent {
+ unsigned long long d_ino;
+ unsigned long long d_seekoff;
+ unsigned short d_reclen;
+ // more fields that we don't care about
+};
#elif SANITIZER_ANDROID || defined(__x86_64__)
- struct __sanitizer_dirent {
- unsigned long long d_ino;
- unsigned long long d_off;
- unsigned short d_reclen;
- // more fields that we don't care about
- };
+struct __sanitizer_dirent {
+ unsigned long long d_ino;
+ unsigned long long d_off;
+ unsigned short d_reclen;
+ // more fields that we don't care about
+};
#else
- struct __sanitizer_dirent {
- uptr d_ino;
- uptr d_off;
- unsigned short d_reclen;
- // more fields that we don't care about
- };
+struct __sanitizer_dirent {
+ uptr d_ino;
+ uptr d_off;
+ unsigned short d_reclen;
+ // more fields that we don't care about
+};
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- struct __sanitizer_dirent64 {
- unsigned long long d_ino;
- unsigned long long d_off;
- unsigned short d_reclen;
- // more fields that we don't care about
- };
+struct __sanitizer_dirent64 {
+ unsigned long long d_ino;
+ unsigned long long d_off;
+ unsigned short d_reclen;
+ // more fields that we don't care about
+};
#endif
#if defined(__x86_64__) && !defined(_LP64)
- typedef long long __sanitizer_clock_t;
+typedef long long __sanitizer_clock_t;
#else
- typedef long __sanitizer_clock_t;
+typedef long __sanitizer_clock_t;
#endif
#if SANITIZER_LINUX
- typedef int __sanitizer_clockid_t;
+typedef int __sanitizer_clockid_t;
#endif
#if SANITIZER_LINUX
-#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)\
- || defined(__mips__)
- typedef unsigned __sanitizer___kernel_uid_t;
- typedef unsigned __sanitizer___kernel_gid_t;
+#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__) || \
+ defined(__mips__)
+typedef unsigned __sanitizer___kernel_uid_t;
+typedef unsigned __sanitizer___kernel_gid_t;
#else
- typedef unsigned short __sanitizer___kernel_uid_t;
- typedef unsigned short __sanitizer___kernel_gid_t;
+typedef unsigned short __sanitizer___kernel_uid_t;
+typedef unsigned short __sanitizer___kernel_gid_t;
#endif
#if defined(__x86_64__) && !defined(_LP64)
- typedef long long __sanitizer___kernel_off_t;
+typedef long long __sanitizer___kernel_off_t;
#else
- typedef long __sanitizer___kernel_off_t;
+typedef long __sanitizer___kernel_off_t;
#endif
#if defined(__powerpc__) || defined(__mips__)
- typedef unsigned int __sanitizer___kernel_old_uid_t;
- typedef unsigned int __sanitizer___kernel_old_gid_t;
+typedef unsigned int __sanitizer___kernel_old_uid_t;
+typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
- typedef unsigned short __sanitizer___kernel_old_uid_t;
- typedef unsigned short __sanitizer___kernel_old_gid_t;
+typedef unsigned short __sanitizer___kernel_old_uid_t;
+typedef unsigned short __sanitizer___kernel_old_gid_t;
#endif
- typedef long long __sanitizer___kernel_loff_t;
- typedef struct {
- unsigned long fds_bits[1024 / (8 * sizeof(long))];
- } __sanitizer___kernel_fd_set;
+typedef long long __sanitizer___kernel_loff_t;
+typedef struct {
+ unsigned long fds_bits[1024 / (8 * sizeof(long))];
+} __sanitizer___kernel_fd_set;
#endif
- // This thing depends on the platform. We are only interested in the upper
- // limit. Verified with a compiler assert in .cc.
- const int pthread_attr_t_max_sz = 128;
- union __sanitizer_pthread_attr_t {
- char size[pthread_attr_t_max_sz]; // NOLINT
- void *align;
- };
+// This thing depends on the platform. We are only interested in the upper
+// limit. Verified with a compiler assert in .cpp.
+union __sanitizer_pthread_attr_t {
+ char size[128];
+ void *align;
+};
#if SANITIZER_ANDROID
# if SANITIZER_MIPS
- typedef unsigned long __sanitizer_sigset_t[16/sizeof(unsigned long)];
+typedef unsigned long __sanitizer_sigset_t[16 / sizeof(unsigned long)];
# else
- typedef unsigned long __sanitizer_sigset_t;
+typedef unsigned long __sanitizer_sigset_t;
# endif
#elif SANITIZER_MAC
- typedef unsigned __sanitizer_sigset_t;
+typedef unsigned __sanitizer_sigset_t;
#elif SANITIZER_LINUX
- struct __sanitizer_sigset_t {
- // The size is determined by looking at sizeof of real sigset_t on linux.
- uptr val[128 / sizeof(uptr)];
- };
+struct __sanitizer_sigset_t {
+ // The size is determined by looking at sizeof of real sigset_t on linux.
+ uptr val[128 / sizeof(uptr)];
+};
#endif
- struct __sanitizer_siginfo {
- // The size is determined by looking at sizeof of real siginfo_t on linux.
- u64 opaque[128 / sizeof(u64)];
- };
+struct __sanitizer_siginfo {
+ // The size is determined by looking at sizeof of real siginfo_t on linux.
+ u64 opaque[128 / sizeof(u64)];
+};
- using __sanitizer_sighandler_ptr = void (*)(int sig);
- using __sanitizer_sigactionhandler_ptr =
- void (*)(int sig, __sanitizer_siginfo *siginfo, void *uctx);
+using __sanitizer_sighandler_ptr = void (*)(int sig);
+using __sanitizer_sigactionhandler_ptr = void (*)(int sig,
+ __sanitizer_siginfo *siginfo,
+ void *uctx);
- // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
+// Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
#if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
- struct __sanitizer_sigaction {
- unsigned sa_flags;
- union {
- __sanitizer_sigactionhandler_ptr sigaction;
- __sanitizer_sighandler_ptr handler;
- };
- __sanitizer_sigset_t sa_mask;
- void (*sa_restorer)();
+struct __sanitizer_sigaction {
+ unsigned sa_flags;
+ union {
+ __sanitizer_sigactionhandler_ptr sigaction;
+ __sanitizer_sighandler_ptr handler;
};
+ __sanitizer_sigset_t sa_mask;
+ void (*sa_restorer)();
+};
#elif SANITIZER_ANDROID && SANITIZER_MIPS32 // check this before WORDSIZE == 32
- struct __sanitizer_sigaction {
- unsigned sa_flags;
- union {
- __sanitizer_sigactionhandler_ptr sigaction;
- __sanitizer_sighandler_ptr handler;
- };
- __sanitizer_sigset_t sa_mask;
+struct __sanitizer_sigaction {
+ unsigned sa_flags;
+ union {
+ __sanitizer_sigactionhandler_ptr sigaction;
+ __sanitizer_sighandler_ptr handler;
};
+ __sanitizer_sigset_t sa_mask;
+};
#elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)
- struct __sanitizer_sigaction {
- union {
- __sanitizer_sigactionhandler_ptr sigaction;
- __sanitizer_sighandler_ptr handler;
- };
- __sanitizer_sigset_t sa_mask;
- uptr sa_flags;
- void (*sa_restorer)();
+struct __sanitizer_sigaction {
+ union {
+ __sanitizer_sigactionhandler_ptr sigaction;
+ __sanitizer_sighandler_ptr handler;
};
+ __sanitizer_sigset_t sa_mask;
+ uptr sa_flags;
+ void (*sa_restorer)();
+};
#else // !SANITIZER_ANDROID
- struct __sanitizer_sigaction {
+struct __sanitizer_sigaction {
#if defined(__mips__) && !SANITIZER_FREEBSD
- unsigned int sa_flags;
+ unsigned int sa_flags;
#endif
- union {
- __sanitizer_sigactionhandler_ptr sigaction;
- __sanitizer_sighandler_ptr handler;
- };
+ union {
+ __sanitizer_sigactionhandler_ptr sigaction;
+ __sanitizer_sighandler_ptr handler;
+ };
#if SANITIZER_FREEBSD
- int sa_flags;
- __sanitizer_sigset_t sa_mask;
+ int sa_flags;
+ __sanitizer_sigset_t sa_mask;
#else
#if defined(__s390x__)
- int sa_resv;
+ int sa_resv;
#else
- __sanitizer_sigset_t sa_mask;
+ __sanitizer_sigset_t sa_mask;
#endif
#ifndef __mips__
#if defined(__sparc__)
#if __GLIBC_PREREQ (2, 20)
- // On sparc glibc 2.19 and earlier sa_flags was unsigned long.
+ // On sparc glibc 2.19 and earlier sa_flags was unsigned long.
#if defined(__arch64__)
- // To maintain ABI compatibility on sparc64 when switching to an int,
- // __glibc_reserved0 was added.
- int __glibc_reserved0;
+ // To maintain ABI compatibility on sparc64 when switching to an int,
+ // __glibc_reserved0 was added.
+ int __glibc_reserved0;
#endif
- int sa_flags;
+ int sa_flags;
#else
- unsigned long sa_flags;
+ unsigned long sa_flags;
#endif
#else
- int sa_flags;
+ int sa_flags;
#endif
#endif
#endif
#if SANITIZER_LINUX
- void (*sa_restorer)();
+ void (*sa_restorer)();
#endif
#if defined(__mips__) && (SANITIZER_WORDSIZE == 32)
- int sa_resv[1];
+ int sa_resv[1];
#endif
#if defined(__s390x__)
- __sanitizer_sigset_t sa_mask;
+ __sanitizer_sigset_t sa_mask;
#endif
- };
+};
#endif // !SANITIZER_ANDROID
#if defined(__mips__)
- struct __sanitizer_kernel_sigset_t {
- uptr sig[2];
- };
+struct __sanitizer_kernel_sigset_t {
+ uptr sig[2];
+};
#else
- struct __sanitizer_kernel_sigset_t {
- u8 sig[8];
- };
+struct __sanitizer_kernel_sigset_t {
+ u8 sig[8];
+};
#endif
- // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
+// Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
#if SANITIZER_MIPS
- struct __sanitizer_kernel_sigaction_t {
- unsigned int sa_flags;
- union {
- void (*handler)(int signo);
- void (*sigaction)(int signo, __sanitizer_siginfo *info, void *ctx);
- };
- __sanitizer_kernel_sigset_t sa_mask;
- void (*sa_restorer)(void);
+struct __sanitizer_kernel_sigaction_t {
+ unsigned int sa_flags;
+ union {
+ void (*handler)(int signo);
+ void (*sigaction)(int signo, __sanitizer_siginfo *info, void *ctx);
};
+ __sanitizer_kernel_sigset_t sa_mask;
+ void (*sa_restorer)(void);
+};
#else
- struct __sanitizer_kernel_sigaction_t {
- union {
- void (*handler)(int signo);
- void (*sigaction)(int signo, __sanitizer_siginfo *info, void *ctx);
- };
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- __sanitizer_kernel_sigset_t sa_mask;
+struct __sanitizer_kernel_sigaction_t {
+ union {
+ void (*handler)(int signo);
+ void (*sigaction)(int signo, __sanitizer_siginfo *info, void *ctx);
};
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+ __sanitizer_kernel_sigset_t sa_mask;
+};
#endif
- extern const uptr sig_ign;
- extern const uptr sig_dfl;
- extern const uptr sig_err;
- extern const uptr sa_siginfo;
+extern const uptr sig_ign;
+extern const uptr sig_dfl;
+extern const uptr sig_err;
+extern const uptr sa_siginfo;
#if SANITIZER_LINUX
- extern int e_tabsz;
+extern int e_tabsz;
#endif
- extern int af_inet;
- extern int af_inet6;
- uptr __sanitizer_in_addr_sz(int af);
+extern int af_inet;
+extern int af_inet6;
+uptr __sanitizer_in_addr_sz(int af);
#if SANITIZER_LINUX
- struct __sanitizer_dl_phdr_info {
- uptr dlpi_addr;
- const char *dlpi_name;
- const void *dlpi_phdr;
- short dlpi_phnum;
- };
+struct __sanitizer_dl_phdr_info {
+ uptr dlpi_addr;
+ const char *dlpi_name;
+ const void *dlpi_phdr;
+ short dlpi_phnum;
+};
- extern unsigned struct_ElfW_Phdr_sz;
+extern unsigned struct_ElfW_Phdr_sz;
#endif
- struct __sanitizer_addrinfo {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
+struct __sanitizer_addrinfo {
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
#if SANITIZER_ANDROID || SANITIZER_MAC
- unsigned ai_addrlen;
- char *ai_canonname;
- void *ai_addr;
+ unsigned ai_addrlen;
+ char *ai_canonname;
+ void *ai_addr;
#else // LINUX
- unsigned ai_addrlen;
- void *ai_addr;
- char *ai_canonname;
+ unsigned ai_addrlen;
+ void *ai_addr;
+ char *ai_canonname;
#endif
- struct __sanitizer_addrinfo *ai_next;
- };
+ struct __sanitizer_addrinfo *ai_next;
+};
- struct __sanitizer_hostent {
- char *h_name;
- char **h_aliases;
- int h_addrtype;
- int h_length;
- char **h_addr_list;
- };
+struct __sanitizer_hostent {
+ char *h_name;
+ char **h_aliases;
+ int h_addrtype;
+ int h_length;
+ char **h_addr_list;
+};
- struct __sanitizer_pollfd {
- int fd;
- short events;
- short revents;
- };
+struct __sanitizer_pollfd {
+ int fd;
+ short events;
+ short revents;
+};
#if SANITIZER_ANDROID || SANITIZER_MAC
- typedef unsigned __sanitizer_nfds_t;
+typedef unsigned __sanitizer_nfds_t;
#else
- typedef unsigned long __sanitizer_nfds_t;
+typedef unsigned long __sanitizer_nfds_t;
#endif
#if !SANITIZER_ANDROID
# if SANITIZER_LINUX
- struct __sanitizer_glob_t {
- uptr gl_pathc;
- char **gl_pathv;
- uptr gl_offs;
- int gl_flags;
-
- void (*gl_closedir)(void *dirp);
- void *(*gl_readdir)(void *dirp);
- void *(*gl_opendir)(const char *);
- int (*gl_lstat)(const char *, void *);
- int (*gl_stat)(const char *, void *);
- };
+struct __sanitizer_glob_t {
+ uptr gl_pathc;
+ char **gl_pathv;
+ uptr gl_offs;
+ int gl_flags;
+
+ void (*gl_closedir)(void *dirp);
+ void *(*gl_readdir)(void *dirp);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, void *);
+ int (*gl_stat)(const char *, void *);
+};
# endif // SANITIZER_LINUX
# if SANITIZER_LINUX
- extern int glob_nomatch;
- extern int glob_altdirfunc;
+extern int glob_nomatch;
+extern int glob_altdirfunc;
# endif
#endif // !SANITIZER_ANDROID
- extern unsigned path_max;
+extern unsigned path_max;
- struct __sanitizer_wordexp_t {
- uptr we_wordc;
- char **we_wordv;
- uptr we_offs;
- };
+struct __sanitizer_wordexp_t {
+ uptr we_wordc;
+ char **we_wordv;
+ uptr we_offs;
+};
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- struct __sanitizer_FILE {
- int _flags;
- char *_IO_read_ptr;
- char *_IO_read_end;
- char *_IO_read_base;
- char *_IO_write_base;
- char *_IO_write_ptr;
- char *_IO_write_end;
- char *_IO_buf_base;
- char *_IO_buf_end;
- char *_IO_save_base;
- char *_IO_backup_base;
- char *_IO_save_end;
- void *_markers;
- __sanitizer_FILE *_chain;
- int _fileno;
- };
+struct __sanitizer_FILE {
+ int _flags;
+ char *_IO_read_ptr;
+ char *_IO_read_end;
+ char *_IO_read_base;
+ char *_IO_write_base;
+ char *_IO_write_ptr;
+ char *_IO_write_end;
+ char *_IO_buf_base;
+ char *_IO_buf_end;
+ char *_IO_save_base;
+ char *_IO_backup_base;
+ char *_IO_save_end;
+ void *_markers;
+ __sanitizer_FILE *_chain;
+ int _fileno;
+};
# define SANITIZER_HAS_STRUCT_FILE 1
#else
- typedef void __sanitizer_FILE;
+typedef void __sanitizer_FILE;
# define SANITIZER_HAS_STRUCT_FILE 0
#endif
-#if SANITIZER_LINUX && !SANITIZER_ANDROID && \
- (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
- defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
- defined(__s390__))
- extern unsigned struct_user_regs_struct_sz;
- extern unsigned struct_user_fpregs_struct_sz;
- extern unsigned struct_user_fpxregs_struct_sz;
- extern unsigned struct_user_vfpregs_struct_sz;
-
- extern int ptrace_peektext;
- extern int ptrace_peekdata;
- extern int ptrace_peekuser;
- extern int ptrace_getregs;
- extern int ptrace_setregs;
- extern int ptrace_getfpregs;
- extern int ptrace_setfpregs;
- extern int ptrace_getfpxregs;
- extern int ptrace_setfpxregs;
- extern int ptrace_getvfpregs;
- extern int ptrace_setvfpregs;
- extern int ptrace_getsiginfo;
- extern int ptrace_setsiginfo;
- extern int ptrace_getregset;
- extern int ptrace_setregset;
- extern int ptrace_geteventmsg;
+#if SANITIZER_LINUX && !SANITIZER_ANDROID && \
+ (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
+ defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
+ defined(__s390__))
+extern unsigned struct_user_regs_struct_sz;
+extern unsigned struct_user_fpregs_struct_sz;
+extern unsigned struct_user_fpxregs_struct_sz;
+extern unsigned struct_user_vfpregs_struct_sz;
+
+extern int ptrace_peektext;
+extern int ptrace_peekdata;
+extern int ptrace_peekuser;
+extern int ptrace_getregs;
+extern int ptrace_setregs;
+extern int ptrace_getfpregs;
+extern int ptrace_setfpregs;
+extern int ptrace_getfpxregs;
+extern int ptrace_setfpxregs;
+extern int ptrace_getvfpregs;
+extern int ptrace_setvfpregs;
+extern int ptrace_getsiginfo;
+extern int ptrace_setsiginfo;
+extern int ptrace_getregset;
+extern int ptrace_setregset;
+extern int ptrace_geteventmsg;
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_shminfo_sz;
- extern unsigned struct_shm_info_sz;
- extern int shmctl_ipc_stat;
- extern int shmctl_ipc_info;
- extern int shmctl_shm_info;
- extern int shmctl_shm_stat;
+extern unsigned struct_shminfo_sz;
+extern unsigned struct_shm_info_sz;
+extern int shmctl_ipc_stat;
+extern int shmctl_ipc_info;
+extern int shmctl_shm_info;
+extern int shmctl_shm_stat;
#endif
#if !SANITIZER_MAC && !SANITIZER_FREEBSD
- extern unsigned struct_utmp_sz;
+extern unsigned struct_utmp_sz;
#endif
#if !SANITIZER_ANDROID
- extern unsigned struct_utmpx_sz;
+extern unsigned struct_utmpx_sz;
#endif
- extern int map_fixed;
+extern int map_fixed;
- // ioctl arguments
- struct __sanitizer_ifconf {
- int ifc_len;
- union {
- void *ifcu_req;
- } ifc_ifcu;
+// ioctl arguments
+struct __sanitizer_ifconf {
+ int ifc_len;
+ union {
+ void *ifcu_req;
+ } ifc_ifcu;
#if SANITIZER_MAC
- } __attribute__((packed));
+} __attribute__((packed));
#else
- };
+};
#endif
#if SANITIZER_LINUX && !SANITIZER_ANDROID
@@ -932,519 +934,519 @@ struct __sanitizer_cookie_io_functions_t {
#define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
#endif
- extern unsigned struct_ifreq_sz;
- extern unsigned struct_termios_sz;
- extern unsigned struct_winsize_sz;
+extern unsigned struct_ifreq_sz;
+extern unsigned struct_termios_sz;
+extern unsigned struct_winsize_sz;
#if SANITIZER_LINUX
- extern unsigned struct_arpreq_sz;
- extern unsigned struct_cdrom_msf_sz;
- extern unsigned struct_cdrom_multisession_sz;
- extern unsigned struct_cdrom_read_audio_sz;
- extern unsigned struct_cdrom_subchnl_sz;
- extern unsigned struct_cdrom_ti_sz;
- extern unsigned struct_cdrom_tocentry_sz;
- extern unsigned struct_cdrom_tochdr_sz;
- extern unsigned struct_cdrom_volctrl_sz;
- extern unsigned struct_ff_effect_sz;
- extern unsigned struct_floppy_drive_params_sz;
- extern unsigned struct_floppy_drive_struct_sz;
- extern unsigned struct_floppy_fdc_state_sz;
- extern unsigned struct_floppy_max_errors_sz;
- extern unsigned struct_floppy_raw_cmd_sz;
- extern unsigned struct_floppy_struct_sz;
- extern unsigned struct_floppy_write_errors_sz;
- extern unsigned struct_format_descr_sz;
- extern unsigned struct_hd_driveid_sz;
- extern unsigned struct_hd_geometry_sz;
- extern unsigned struct_input_absinfo_sz;
- extern unsigned struct_input_id_sz;
- extern unsigned struct_mtpos_sz;
- extern unsigned struct_termio_sz;
- extern unsigned struct_vt_consize_sz;
- extern unsigned struct_vt_sizes_sz;
- extern unsigned struct_vt_stat_sz;
+extern unsigned struct_arpreq_sz;
+extern unsigned struct_cdrom_msf_sz;
+extern unsigned struct_cdrom_multisession_sz;
+extern unsigned struct_cdrom_read_audio_sz;
+extern unsigned struct_cdrom_subchnl_sz;
+extern unsigned struct_cdrom_ti_sz;
+extern unsigned struct_cdrom_tocentry_sz;
+extern unsigned struct_cdrom_tochdr_sz;
+extern unsigned struct_cdrom_volctrl_sz;
+extern unsigned struct_ff_effect_sz;
+extern unsigned struct_floppy_drive_params_sz;
+extern unsigned struct_floppy_drive_struct_sz;
+extern unsigned struct_floppy_fdc_state_sz;
+extern unsigned struct_floppy_max_errors_sz;
+extern unsigned struct_floppy_raw_cmd_sz;
+extern unsigned struct_floppy_struct_sz;
+extern unsigned struct_floppy_write_errors_sz;
+extern unsigned struct_format_descr_sz;
+extern unsigned struct_hd_driveid_sz;
+extern unsigned struct_hd_geometry_sz;
+extern unsigned struct_input_absinfo_sz;
+extern unsigned struct_input_id_sz;
+extern unsigned struct_mtpos_sz;
+extern unsigned struct_termio_sz;
+extern unsigned struct_vt_consize_sz;
+extern unsigned struct_vt_sizes_sz;
+extern unsigned struct_vt_stat_sz;
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX
- extern unsigned struct_copr_buffer_sz;
- extern unsigned struct_copr_debug_buf_sz;
- extern unsigned struct_copr_msg_sz;
- extern unsigned struct_midi_info_sz;
- extern unsigned struct_mtget_sz;
- extern unsigned struct_mtop_sz;
- extern unsigned struct_rtentry_sz;
- extern unsigned struct_sbi_instrument_sz;
- extern unsigned struct_seq_event_rec_sz;
- extern unsigned struct_synth_info_sz;
- extern unsigned struct_vt_mode_sz;
+extern unsigned struct_copr_buffer_sz;
+extern unsigned struct_copr_debug_buf_sz;
+extern unsigned struct_copr_msg_sz;
+extern unsigned struct_midi_info_sz;
+extern unsigned struct_mtget_sz;
+extern unsigned struct_mtop_sz;
+extern unsigned struct_rtentry_sz;
+extern unsigned struct_sbi_instrument_sz;
+extern unsigned struct_seq_event_rec_sz;
+extern unsigned struct_synth_info_sz;
+extern unsigned struct_vt_mode_sz;
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_ax25_parms_struct_sz;
- extern unsigned struct_cyclades_monitor_sz;
- extern unsigned struct_input_keymap_entry_sz;
- extern unsigned struct_ipx_config_data_sz;
- extern unsigned struct_kbdiacrs_sz;
- extern unsigned struct_kbentry_sz;
- extern unsigned struct_kbkeycode_sz;
- extern unsigned struct_kbsentry_sz;
- extern unsigned struct_mtconfiginfo_sz;
- extern unsigned struct_nr_parms_struct_sz;
- extern unsigned struct_scc_modem_sz;
- extern unsigned struct_scc_stat_sz;
- extern unsigned struct_serial_multiport_struct_sz;
- extern unsigned struct_serial_struct_sz;
- extern unsigned struct_sockaddr_ax25_sz;
- extern unsigned struct_unimapdesc_sz;
- extern unsigned struct_unimapinit_sz;
+extern unsigned struct_ax25_parms_struct_sz;
+extern unsigned struct_cyclades_monitor_sz;
+extern unsigned struct_input_keymap_entry_sz;
+extern unsigned struct_ipx_config_data_sz;
+extern unsigned struct_kbdiacrs_sz;
+extern unsigned struct_kbentry_sz;
+extern unsigned struct_kbkeycode_sz;
+extern unsigned struct_kbsentry_sz;
+extern unsigned struct_mtconfiginfo_sz;
+extern unsigned struct_nr_parms_struct_sz;
+extern unsigned struct_scc_modem_sz;
+extern unsigned struct_scc_stat_sz;
+extern unsigned struct_serial_multiport_struct_sz;
+extern unsigned struct_serial_struct_sz;
+extern unsigned struct_sockaddr_ax25_sz;
+extern unsigned struct_unimapdesc_sz;
+extern unsigned struct_unimapinit_sz;
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
- extern const unsigned long __sanitizer_bufsiz;
+extern const unsigned long __sanitizer_bufsiz;
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_audio_buf_info_sz;
- extern unsigned struct_ppp_stats_sz;
+extern unsigned struct_audio_buf_info_sz;
+extern unsigned struct_ppp_stats_sz;
#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
#if !SANITIZER_ANDROID && !SANITIZER_MAC
- extern unsigned struct_sioc_sg_req_sz;
- extern unsigned struct_sioc_vif_req_sz;
-#endif
-
- // ioctl request identifiers
-
- // A special value to mark ioctls that are not present on the target platform,
- // when it can not be determined without including any system headers.
- extern const unsigned IOCTL_NOT_PRESENT;
-
- extern unsigned IOCTL_FIOASYNC;
- extern unsigned IOCTL_FIOCLEX;
- extern unsigned IOCTL_FIOGETOWN;
- extern unsigned IOCTL_FIONBIO;
- extern unsigned IOCTL_FIONCLEX;
- extern unsigned IOCTL_FIOSETOWN;
- extern unsigned IOCTL_SIOCADDMULTI;
- extern unsigned IOCTL_SIOCATMARK;
- extern unsigned IOCTL_SIOCDELMULTI;
- extern unsigned IOCTL_SIOCGIFADDR;
- extern unsigned IOCTL_SIOCGIFBRDADDR;
- extern unsigned IOCTL_SIOCGIFCONF;
- extern unsigned IOCTL_SIOCGIFDSTADDR;
- extern unsigned IOCTL_SIOCGIFFLAGS;
- extern unsigned IOCTL_SIOCGIFMETRIC;
- extern unsigned IOCTL_SIOCGIFMTU;
- extern unsigned IOCTL_SIOCGIFNETMASK;
- extern unsigned IOCTL_SIOCGPGRP;
- extern unsigned IOCTL_SIOCSIFADDR;
- extern unsigned IOCTL_SIOCSIFBRDADDR;
- extern unsigned IOCTL_SIOCSIFDSTADDR;
- extern unsigned IOCTL_SIOCSIFFLAGS;
- extern unsigned IOCTL_SIOCSIFMETRIC;
- extern unsigned IOCTL_SIOCSIFMTU;
- extern unsigned IOCTL_SIOCSIFNETMASK;
- extern unsigned IOCTL_SIOCSPGRP;
- extern unsigned IOCTL_TIOCCONS;
- extern unsigned IOCTL_TIOCEXCL;
- extern unsigned IOCTL_TIOCGETD;
- extern unsigned IOCTL_TIOCGPGRP;
- extern unsigned IOCTL_TIOCGWINSZ;
- extern unsigned IOCTL_TIOCMBIC;
- extern unsigned IOCTL_TIOCMBIS;
- extern unsigned IOCTL_TIOCMGET;
- extern unsigned IOCTL_TIOCMSET;
- extern unsigned IOCTL_TIOCNOTTY;
- extern unsigned IOCTL_TIOCNXCL;
- extern unsigned IOCTL_TIOCOUTQ;
- extern unsigned IOCTL_TIOCPKT;
- extern unsigned IOCTL_TIOCSCTTY;
- extern unsigned IOCTL_TIOCSETD;
- extern unsigned IOCTL_TIOCSPGRP;
- extern unsigned IOCTL_TIOCSTI;
- extern unsigned IOCTL_TIOCSWINSZ;
+extern unsigned struct_sioc_sg_req_sz;
+extern unsigned struct_sioc_vif_req_sz;
+#endif
+
+// ioctl request identifiers
+
+// A special value to mark ioctls that are not present on the target platform,
+// when it can not be determined without including any system headers.
+extern const unsigned IOCTL_NOT_PRESENT;
+
+extern unsigned IOCTL_FIOASYNC;
+extern unsigned IOCTL_FIOCLEX;
+extern unsigned IOCTL_FIOGETOWN;
+extern unsigned IOCTL_FIONBIO;
+extern unsigned IOCTL_FIONCLEX;
+extern unsigned IOCTL_FIOSETOWN;
+extern unsigned IOCTL_SIOCADDMULTI;
+extern unsigned IOCTL_SIOCATMARK;
+extern unsigned IOCTL_SIOCDELMULTI;
+extern unsigned IOCTL_SIOCGIFADDR;
+extern unsigned IOCTL_SIOCGIFBRDADDR;
+extern unsigned IOCTL_SIOCGIFCONF;
+extern unsigned IOCTL_SIOCGIFDSTADDR;
+extern unsigned IOCTL_SIOCGIFFLAGS;
+extern unsigned IOCTL_SIOCGIFMETRIC;
+extern unsigned IOCTL_SIOCGIFMTU;
+extern unsigned IOCTL_SIOCGIFNETMASK;
+extern unsigned IOCTL_SIOCGPGRP;
+extern unsigned IOCTL_SIOCSIFADDR;
+extern unsigned IOCTL_SIOCSIFBRDADDR;
+extern unsigned IOCTL_SIOCSIFDSTADDR;
+extern unsigned IOCTL_SIOCSIFFLAGS;
+extern unsigned IOCTL_SIOCSIFMETRIC;
+extern unsigned IOCTL_SIOCSIFMTU;
+extern unsigned IOCTL_SIOCSIFNETMASK;
+extern unsigned IOCTL_SIOCSPGRP;
+extern unsigned IOCTL_TIOCCONS;
+extern unsigned IOCTL_TIOCEXCL;
+extern unsigned IOCTL_TIOCGETD;
+extern unsigned IOCTL_TIOCGPGRP;
+extern unsigned IOCTL_TIOCGWINSZ;
+extern unsigned IOCTL_TIOCMBIC;
+extern unsigned IOCTL_TIOCMBIS;
+extern unsigned IOCTL_TIOCMGET;
+extern unsigned IOCTL_TIOCMSET;
+extern unsigned IOCTL_TIOCNOTTY;
+extern unsigned IOCTL_TIOCNXCL;
+extern unsigned IOCTL_TIOCOUTQ;
+extern unsigned IOCTL_TIOCPKT;
+extern unsigned IOCTL_TIOCSCTTY;
+extern unsigned IOCTL_TIOCSETD;
+extern unsigned IOCTL_TIOCSPGRP;
+extern unsigned IOCTL_TIOCSTI;
+extern unsigned IOCTL_TIOCSWINSZ;
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned IOCTL_SIOCGETSGCNT;
- extern unsigned IOCTL_SIOCGETVIFCNT;
+extern unsigned IOCTL_SIOCGETSGCNT;
+extern unsigned IOCTL_SIOCGETVIFCNT;
#endif
#if SANITIZER_LINUX
- extern unsigned IOCTL_EVIOCGABS;
- extern unsigned IOCTL_EVIOCGBIT;
- extern unsigned IOCTL_EVIOCGEFFECTS;
- extern unsigned IOCTL_EVIOCGID;
- extern unsigned IOCTL_EVIOCGKEY;
- extern unsigned IOCTL_EVIOCGKEYCODE;
- extern unsigned IOCTL_EVIOCGLED;
- extern unsigned IOCTL_EVIOCGNAME;
- extern unsigned IOCTL_EVIOCGPHYS;
- extern unsigned IOCTL_EVIOCGRAB;
- extern unsigned IOCTL_EVIOCGREP;
- extern unsigned IOCTL_EVIOCGSND;
- extern unsigned IOCTL_EVIOCGSW;
- extern unsigned IOCTL_EVIOCGUNIQ;
- extern unsigned IOCTL_EVIOCGVERSION;
- extern unsigned IOCTL_EVIOCRMFF;
- extern unsigned IOCTL_EVIOCSABS;
- extern unsigned IOCTL_EVIOCSFF;
- extern unsigned IOCTL_EVIOCSKEYCODE;
- extern unsigned IOCTL_EVIOCSREP;
- extern unsigned IOCTL_BLKFLSBUF;
- extern unsigned IOCTL_BLKGETSIZE;
- extern unsigned IOCTL_BLKRAGET;
- extern unsigned IOCTL_BLKRASET;
- extern unsigned IOCTL_BLKROGET;
- extern unsigned IOCTL_BLKROSET;
- extern unsigned IOCTL_BLKRRPART;
- extern unsigned IOCTL_CDROMAUDIOBUFSIZ;
- extern unsigned IOCTL_CDROMEJECT;
- extern unsigned IOCTL_CDROMEJECT_SW;
- extern unsigned IOCTL_CDROMMULTISESSION;
- extern unsigned IOCTL_CDROMPAUSE;
- extern unsigned IOCTL_CDROMPLAYMSF;
- extern unsigned IOCTL_CDROMPLAYTRKIND;
- extern unsigned IOCTL_CDROMREADAUDIO;
- extern unsigned IOCTL_CDROMREADCOOKED;
- extern unsigned IOCTL_CDROMREADMODE1;
- extern unsigned IOCTL_CDROMREADMODE2;
- extern unsigned IOCTL_CDROMREADRAW;
- extern unsigned IOCTL_CDROMREADTOCENTRY;
- extern unsigned IOCTL_CDROMREADTOCHDR;
- extern unsigned IOCTL_CDROMRESET;
- extern unsigned IOCTL_CDROMRESUME;
- extern unsigned IOCTL_CDROMSEEK;
- extern unsigned IOCTL_CDROMSTART;
- extern unsigned IOCTL_CDROMSTOP;
- extern unsigned IOCTL_CDROMSUBCHNL;
- extern unsigned IOCTL_CDROMVOLCTRL;
- extern unsigned IOCTL_CDROMVOLREAD;
- extern unsigned IOCTL_CDROM_GET_UPC;
- extern unsigned IOCTL_FDCLRPRM;
- extern unsigned IOCTL_FDDEFPRM;
- extern unsigned IOCTL_FDFLUSH;
- extern unsigned IOCTL_FDFMTBEG;
- extern unsigned IOCTL_FDFMTEND;
- extern unsigned IOCTL_FDFMTTRK;
- extern unsigned IOCTL_FDGETDRVPRM;
- extern unsigned IOCTL_FDGETDRVSTAT;
- extern unsigned IOCTL_FDGETDRVTYP;
- extern unsigned IOCTL_FDGETFDCSTAT;
- extern unsigned IOCTL_FDGETMAXERRS;
- extern unsigned IOCTL_FDGETPRM;
- extern unsigned IOCTL_FDMSGOFF;
- extern unsigned IOCTL_FDMSGON;
- extern unsigned IOCTL_FDPOLLDRVSTAT;
- extern unsigned IOCTL_FDRAWCMD;
- extern unsigned IOCTL_FDRESET;
- extern unsigned IOCTL_FDSETDRVPRM;
- extern unsigned IOCTL_FDSETEMSGTRESH;
- extern unsigned IOCTL_FDSETMAXERRS;
- extern unsigned IOCTL_FDSETPRM;
- extern unsigned IOCTL_FDTWADDLE;
- extern unsigned IOCTL_FDWERRORCLR;
- extern unsigned IOCTL_FDWERRORGET;
- extern unsigned IOCTL_HDIO_DRIVE_CMD;
- extern unsigned IOCTL_HDIO_GETGEO;
- extern unsigned IOCTL_HDIO_GET_32BIT;
- extern unsigned IOCTL_HDIO_GET_DMA;
- extern unsigned IOCTL_HDIO_GET_IDENTITY;
- extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS;
- extern unsigned IOCTL_HDIO_GET_MULTCOUNT;
- extern unsigned IOCTL_HDIO_GET_NOWERR;
- extern unsigned IOCTL_HDIO_GET_UNMASKINTR;
- extern unsigned IOCTL_HDIO_SET_32BIT;
- extern unsigned IOCTL_HDIO_SET_DMA;
- extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS;
- extern unsigned IOCTL_HDIO_SET_MULTCOUNT;
- extern unsigned IOCTL_HDIO_SET_NOWERR;
- extern unsigned IOCTL_HDIO_SET_UNMASKINTR;
- extern unsigned IOCTL_MTIOCPOS;
- extern unsigned IOCTL_PPPIOCGASYNCMAP;
- extern unsigned IOCTL_PPPIOCGDEBUG;
- extern unsigned IOCTL_PPPIOCGFLAGS;
- extern unsigned IOCTL_PPPIOCGUNIT;
- extern unsigned IOCTL_PPPIOCGXASYNCMAP;
- extern unsigned IOCTL_PPPIOCSASYNCMAP;
- extern unsigned IOCTL_PPPIOCSDEBUG;
- extern unsigned IOCTL_PPPIOCSFLAGS;
- extern unsigned IOCTL_PPPIOCSMAXCID;
- extern unsigned IOCTL_PPPIOCSMRU;
- extern unsigned IOCTL_PPPIOCSXASYNCMAP;
- extern unsigned IOCTL_SIOCDARP;
- extern unsigned IOCTL_SIOCDRARP;
- extern unsigned IOCTL_SIOCGARP;
- extern unsigned IOCTL_SIOCGIFENCAP;
- extern unsigned IOCTL_SIOCGIFHWADDR;
- extern unsigned IOCTL_SIOCGIFMAP;
- extern unsigned IOCTL_SIOCGIFMEM;
- extern unsigned IOCTL_SIOCGIFNAME;
- extern unsigned IOCTL_SIOCGIFSLAVE;
- extern unsigned IOCTL_SIOCGRARP;
- extern unsigned IOCTL_SIOCGSTAMP;
- extern unsigned IOCTL_SIOCSARP;
- extern unsigned IOCTL_SIOCSIFENCAP;
- extern unsigned IOCTL_SIOCSIFHWADDR;
- extern unsigned IOCTL_SIOCSIFLINK;
- extern unsigned IOCTL_SIOCSIFMAP;
- extern unsigned IOCTL_SIOCSIFMEM;
- extern unsigned IOCTL_SIOCSIFSLAVE;
- extern unsigned IOCTL_SIOCSRARP;
- extern unsigned IOCTL_SNDCTL_COPR_HALT;
- extern unsigned IOCTL_SNDCTL_COPR_LOAD;
- extern unsigned IOCTL_SNDCTL_COPR_RCODE;
- extern unsigned IOCTL_SNDCTL_COPR_RCVMSG;
- extern unsigned IOCTL_SNDCTL_COPR_RDATA;
- extern unsigned IOCTL_SNDCTL_COPR_RESET;
- extern unsigned IOCTL_SNDCTL_COPR_RUN;
- extern unsigned IOCTL_SNDCTL_COPR_SENDMSG;
- extern unsigned IOCTL_SNDCTL_COPR_WCODE;
- extern unsigned IOCTL_SNDCTL_COPR_WDATA;
- extern unsigned IOCTL_TCFLSH;
- extern unsigned IOCTL_TCGETA;
- extern unsigned IOCTL_TCGETS;
- extern unsigned IOCTL_TCSBRK;
- extern unsigned IOCTL_TCSBRKP;
- extern unsigned IOCTL_TCSETA;
- extern unsigned IOCTL_TCSETAF;
- extern unsigned IOCTL_TCSETAW;
- extern unsigned IOCTL_TCSETS;
- extern unsigned IOCTL_TCSETSF;
- extern unsigned IOCTL_TCSETSW;
- extern unsigned IOCTL_TCXONC;
- extern unsigned IOCTL_TIOCGLCKTRMIOS;
- extern unsigned IOCTL_TIOCGSOFTCAR;
- extern unsigned IOCTL_TIOCINQ;
- extern unsigned IOCTL_TIOCLINUX;
- extern unsigned IOCTL_TIOCSERCONFIG;
- extern unsigned IOCTL_TIOCSERGETLSR;
- extern unsigned IOCTL_TIOCSERGWILD;
- extern unsigned IOCTL_TIOCSERSWILD;
- extern unsigned IOCTL_TIOCSLCKTRMIOS;
- extern unsigned IOCTL_TIOCSSOFTCAR;
- extern unsigned IOCTL_VT_DISALLOCATE;
- extern unsigned IOCTL_VT_GETSTATE;
- extern unsigned IOCTL_VT_RESIZE;
- extern unsigned IOCTL_VT_RESIZEX;
- extern unsigned IOCTL_VT_SENDSIG;
- extern unsigned IOCTL_MTIOCGET;
- extern unsigned IOCTL_MTIOCTOP;
- extern unsigned IOCTL_SIOCADDRT;
- extern unsigned IOCTL_SIOCDELRT;
- extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
- extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
- extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
- extern unsigned IOCTL_SNDCTL_DSP_POST;
- extern unsigned IOCTL_SNDCTL_DSP_RESET;
- extern unsigned IOCTL_SNDCTL_DSP_SETFMT;
- extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
- extern unsigned IOCTL_SNDCTL_DSP_SPEED;
- extern unsigned IOCTL_SNDCTL_DSP_STEREO;
- extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
- extern unsigned IOCTL_SNDCTL_DSP_SYNC;
- extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
- extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
- extern unsigned IOCTL_SNDCTL_MIDI_INFO;
- extern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
- extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
- extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
- extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
- extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
- extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
- extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
- extern unsigned IOCTL_SNDCTL_SEQ_PANIC;
- extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
- extern unsigned IOCTL_SNDCTL_SEQ_RESET;
- extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
- extern unsigned IOCTL_SNDCTL_SEQ_SYNC;
- extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
- extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
- extern unsigned IOCTL_SNDCTL_SYNTH_INFO;
- extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
- extern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
- extern unsigned IOCTL_SNDCTL_TMR_METRONOME;
- extern unsigned IOCTL_SNDCTL_TMR_SELECT;
- extern unsigned IOCTL_SNDCTL_TMR_SOURCE;
- extern unsigned IOCTL_SNDCTL_TMR_START;
- extern unsigned IOCTL_SNDCTL_TMR_STOP;
- extern unsigned IOCTL_SNDCTL_TMR_TEMPO;
- extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
- extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
- extern unsigned IOCTL_SOUND_MIXER_READ_BASS;
- extern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
- extern unsigned IOCTL_SOUND_MIXER_READ_CD;
- extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
- extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
- extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
- extern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
- extern unsigned IOCTL_SOUND_MIXER_READ_LINE;
- extern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
- extern unsigned IOCTL_SOUND_MIXER_READ_MIC;
- extern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
- extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
- extern unsigned IOCTL_SOUND_MIXER_READ_PCM;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
- extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
- extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
- extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
- extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
- extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
- extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
- extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
- extern unsigned IOCTL_SOUND_PCM_READ_BITS;
- extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
- extern unsigned IOCTL_SOUND_PCM_READ_FILTER;
- extern unsigned IOCTL_SOUND_PCM_READ_RATE;
- extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
- extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
- extern unsigned IOCTL_VT_ACTIVATE;
- extern unsigned IOCTL_VT_GETMODE;
- extern unsigned IOCTL_VT_OPENQRY;
- extern unsigned IOCTL_VT_RELDISP;
- extern unsigned IOCTL_VT_SETMODE;
- extern unsigned IOCTL_VT_WAITACTIVE;
+extern unsigned IOCTL_EVIOCGABS;
+extern unsigned IOCTL_EVIOCGBIT;
+extern unsigned IOCTL_EVIOCGEFFECTS;
+extern unsigned IOCTL_EVIOCGID;
+extern unsigned IOCTL_EVIOCGKEY;
+extern unsigned IOCTL_EVIOCGKEYCODE;
+extern unsigned IOCTL_EVIOCGLED;
+extern unsigned IOCTL_EVIOCGNAME;
+extern unsigned IOCTL_EVIOCGPHYS;
+extern unsigned IOCTL_EVIOCGRAB;
+extern unsigned IOCTL_EVIOCGREP;
+extern unsigned IOCTL_EVIOCGSND;
+extern unsigned IOCTL_EVIOCGSW;
+extern unsigned IOCTL_EVIOCGUNIQ;
+extern unsigned IOCTL_EVIOCGVERSION;
+extern unsigned IOCTL_EVIOCRMFF;
+extern unsigned IOCTL_EVIOCSABS;
+extern unsigned IOCTL_EVIOCSFF;
+extern unsigned IOCTL_EVIOCSKEYCODE;
+extern unsigned IOCTL_EVIOCSREP;
+extern unsigned IOCTL_BLKFLSBUF;
+extern unsigned IOCTL_BLKGETSIZE;
+extern unsigned IOCTL_BLKRAGET;
+extern unsigned IOCTL_BLKRASET;
+extern unsigned IOCTL_BLKROGET;
+extern unsigned IOCTL_BLKROSET;
+extern unsigned IOCTL_BLKRRPART;
+extern unsigned IOCTL_CDROMAUDIOBUFSIZ;
+extern unsigned IOCTL_CDROMEJECT;
+extern unsigned IOCTL_CDROMEJECT_SW;
+extern unsigned IOCTL_CDROMMULTISESSION;
+extern unsigned IOCTL_CDROMPAUSE;
+extern unsigned IOCTL_CDROMPLAYMSF;
+extern unsigned IOCTL_CDROMPLAYTRKIND;
+extern unsigned IOCTL_CDROMREADAUDIO;
+extern unsigned IOCTL_CDROMREADCOOKED;
+extern unsigned IOCTL_CDROMREADMODE1;
+extern unsigned IOCTL_CDROMREADMODE2;
+extern unsigned IOCTL_CDROMREADRAW;
+extern unsigned IOCTL_CDROMREADTOCENTRY;
+extern unsigned IOCTL_CDROMREADTOCHDR;
+extern unsigned IOCTL_CDROMRESET;
+extern unsigned IOCTL_CDROMRESUME;
+extern unsigned IOCTL_CDROMSEEK;
+extern unsigned IOCTL_CDROMSTART;
+extern unsigned IOCTL_CDROMSTOP;
+extern unsigned IOCTL_CDROMSUBCHNL;
+extern unsigned IOCTL_CDROMVOLCTRL;
+extern unsigned IOCTL_CDROMVOLREAD;
+extern unsigned IOCTL_CDROM_GET_UPC;
+extern unsigned IOCTL_FDCLRPRM;
+extern unsigned IOCTL_FDDEFPRM;
+extern unsigned IOCTL_FDFLUSH;
+extern unsigned IOCTL_FDFMTBEG;
+extern unsigned IOCTL_FDFMTEND;
+extern unsigned IOCTL_FDFMTTRK;
+extern unsigned IOCTL_FDGETDRVPRM;
+extern unsigned IOCTL_FDGETDRVSTAT;
+extern unsigned IOCTL_FDGETDRVTYP;
+extern unsigned IOCTL_FDGETFDCSTAT;
+extern unsigned IOCTL_FDGETMAXERRS;
+extern unsigned IOCTL_FDGETPRM;
+extern unsigned IOCTL_FDMSGOFF;
+extern unsigned IOCTL_FDMSGON;
+extern unsigned IOCTL_FDPOLLDRVSTAT;
+extern unsigned IOCTL_FDRAWCMD;
+extern unsigned IOCTL_FDRESET;
+extern unsigned IOCTL_FDSETDRVPRM;
+extern unsigned IOCTL_FDSETEMSGTRESH;
+extern unsigned IOCTL_FDSETMAXERRS;
+extern unsigned IOCTL_FDSETPRM;
+extern unsigned IOCTL_FDTWADDLE;
+extern unsigned IOCTL_FDWERRORCLR;
+extern unsigned IOCTL_FDWERRORGET;
+extern unsigned IOCTL_HDIO_DRIVE_CMD;
+extern unsigned IOCTL_HDIO_GETGEO;
+extern unsigned IOCTL_HDIO_GET_32BIT;
+extern unsigned IOCTL_HDIO_GET_DMA;
+extern unsigned IOCTL_HDIO_GET_IDENTITY;
+extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS;
+extern unsigned IOCTL_HDIO_GET_MULTCOUNT;
+extern unsigned IOCTL_HDIO_GET_NOWERR;
+extern unsigned IOCTL_HDIO_GET_UNMASKINTR;
+extern unsigned IOCTL_HDIO_SET_32BIT;
+extern unsigned IOCTL_HDIO_SET_DMA;
+extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS;
+extern unsigned IOCTL_HDIO_SET_MULTCOUNT;
+extern unsigned IOCTL_HDIO_SET_NOWERR;
+extern unsigned IOCTL_HDIO_SET_UNMASKINTR;
+extern unsigned IOCTL_MTIOCPOS;
+extern unsigned IOCTL_PPPIOCGASYNCMAP;
+extern unsigned IOCTL_PPPIOCGDEBUG;
+extern unsigned IOCTL_PPPIOCGFLAGS;
+extern unsigned IOCTL_PPPIOCGUNIT;
+extern unsigned IOCTL_PPPIOCGXASYNCMAP;
+extern unsigned IOCTL_PPPIOCSASYNCMAP;
+extern unsigned IOCTL_PPPIOCSDEBUG;
+extern unsigned IOCTL_PPPIOCSFLAGS;
+extern unsigned IOCTL_PPPIOCSMAXCID;
+extern unsigned IOCTL_PPPIOCSMRU;
+extern unsigned IOCTL_PPPIOCSXASYNCMAP;
+extern unsigned IOCTL_SIOCDARP;
+extern unsigned IOCTL_SIOCDRARP;
+extern unsigned IOCTL_SIOCGARP;
+extern unsigned IOCTL_SIOCGIFENCAP;
+extern unsigned IOCTL_SIOCGIFHWADDR;
+extern unsigned IOCTL_SIOCGIFMAP;
+extern unsigned IOCTL_SIOCGIFMEM;
+extern unsigned IOCTL_SIOCGIFNAME;
+extern unsigned IOCTL_SIOCGIFSLAVE;
+extern unsigned IOCTL_SIOCGRARP;
+extern unsigned IOCTL_SIOCGSTAMP;
+extern unsigned IOCTL_SIOCSARP;
+extern unsigned IOCTL_SIOCSIFENCAP;
+extern unsigned IOCTL_SIOCSIFHWADDR;
+extern unsigned IOCTL_SIOCSIFLINK;
+extern unsigned IOCTL_SIOCSIFMAP;
+extern unsigned IOCTL_SIOCSIFMEM;
+extern unsigned IOCTL_SIOCSIFSLAVE;
+extern unsigned IOCTL_SIOCSRARP;
+extern unsigned IOCTL_SNDCTL_COPR_HALT;
+extern unsigned IOCTL_SNDCTL_COPR_LOAD;
+extern unsigned IOCTL_SNDCTL_COPR_RCODE;
+extern unsigned IOCTL_SNDCTL_COPR_RCVMSG;
+extern unsigned IOCTL_SNDCTL_COPR_RDATA;
+extern unsigned IOCTL_SNDCTL_COPR_RESET;
+extern unsigned IOCTL_SNDCTL_COPR_RUN;
+extern unsigned IOCTL_SNDCTL_COPR_SENDMSG;
+extern unsigned IOCTL_SNDCTL_COPR_WCODE;
+extern unsigned IOCTL_SNDCTL_COPR_WDATA;
+extern unsigned IOCTL_TCFLSH;
+extern unsigned IOCTL_TCGETA;
+extern unsigned IOCTL_TCGETS;
+extern unsigned IOCTL_TCSBRK;
+extern unsigned IOCTL_TCSBRKP;
+extern unsigned IOCTL_TCSETA;
+extern unsigned IOCTL_TCSETAF;
+extern unsigned IOCTL_TCSETAW;
+extern unsigned IOCTL_TCSETS;
+extern unsigned IOCTL_TCSETSF;
+extern unsigned IOCTL_TCSETSW;
+extern unsigned IOCTL_TCXONC;
+extern unsigned IOCTL_TIOCGLCKTRMIOS;
+extern unsigned IOCTL_TIOCGSOFTCAR;
+extern unsigned IOCTL_TIOCINQ;
+extern unsigned IOCTL_TIOCLINUX;
+extern unsigned IOCTL_TIOCSERCONFIG;
+extern unsigned IOCTL_TIOCSERGETLSR;
+extern unsigned IOCTL_TIOCSERGWILD;
+extern unsigned IOCTL_TIOCSERSWILD;
+extern unsigned IOCTL_TIOCSLCKTRMIOS;
+extern unsigned IOCTL_TIOCSSOFTCAR;
+extern unsigned IOCTL_VT_DISALLOCATE;
+extern unsigned IOCTL_VT_GETSTATE;
+extern unsigned IOCTL_VT_RESIZE;
+extern unsigned IOCTL_VT_RESIZEX;
+extern unsigned IOCTL_VT_SENDSIG;
+extern unsigned IOCTL_MTIOCGET;
+extern unsigned IOCTL_MTIOCTOP;
+extern unsigned IOCTL_SIOCADDRT;
+extern unsigned IOCTL_SIOCDELRT;
+extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
+extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
+extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
+extern unsigned IOCTL_SNDCTL_DSP_POST;
+extern unsigned IOCTL_SNDCTL_DSP_RESET;
+extern unsigned IOCTL_SNDCTL_DSP_SETFMT;
+extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
+extern unsigned IOCTL_SNDCTL_DSP_SPEED;
+extern unsigned IOCTL_SNDCTL_DSP_STEREO;
+extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
+extern unsigned IOCTL_SNDCTL_DSP_SYNC;
+extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
+extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
+extern unsigned IOCTL_SNDCTL_MIDI_INFO;
+extern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
+extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
+extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
+extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
+extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
+extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
+extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
+extern unsigned IOCTL_SNDCTL_SEQ_PANIC;
+extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
+extern unsigned IOCTL_SNDCTL_SEQ_RESET;
+extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
+extern unsigned IOCTL_SNDCTL_SEQ_SYNC;
+extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
+extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
+extern unsigned IOCTL_SNDCTL_SYNTH_INFO;
+extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
+extern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
+extern unsigned IOCTL_SNDCTL_TMR_METRONOME;
+extern unsigned IOCTL_SNDCTL_TMR_SELECT;
+extern unsigned IOCTL_SNDCTL_TMR_SOURCE;
+extern unsigned IOCTL_SNDCTL_TMR_START;
+extern unsigned IOCTL_SNDCTL_TMR_STOP;
+extern unsigned IOCTL_SNDCTL_TMR_TEMPO;
+extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
+extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
+extern unsigned IOCTL_SOUND_MIXER_READ_BASS;
+extern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
+extern unsigned IOCTL_SOUND_MIXER_READ_CD;
+extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
+extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
+extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
+extern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
+extern unsigned IOCTL_SOUND_MIXER_READ_LINE;
+extern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
+extern unsigned IOCTL_SOUND_MIXER_READ_MIC;
+extern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
+extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
+extern unsigned IOCTL_SOUND_MIXER_READ_PCM;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
+extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
+extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
+extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
+extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
+extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
+extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
+extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
+extern unsigned IOCTL_SOUND_PCM_READ_BITS;
+extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
+extern unsigned IOCTL_SOUND_PCM_READ_FILTER;
+extern unsigned IOCTL_SOUND_PCM_READ_RATE;
+extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
+extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
+extern unsigned IOCTL_VT_ACTIVATE;
+extern unsigned IOCTL_VT_GETMODE;
+extern unsigned IOCTL_VT_OPENQRY;
+extern unsigned IOCTL_VT_RELDISP;
+extern unsigned IOCTL_VT_SETMODE;
+extern unsigned IOCTL_VT_WAITACTIVE;
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned IOCTL_CYGETDEFTHRESH;
- extern unsigned IOCTL_CYGETDEFTIMEOUT;
- extern unsigned IOCTL_CYGETMON;
- extern unsigned IOCTL_CYGETTHRESH;
- extern unsigned IOCTL_CYGETTIMEOUT;
- extern unsigned IOCTL_CYSETDEFTHRESH;
- extern unsigned IOCTL_CYSETDEFTIMEOUT;
- extern unsigned IOCTL_CYSETTHRESH;
- extern unsigned IOCTL_CYSETTIMEOUT;
- extern unsigned IOCTL_EQL_EMANCIPATE;
- extern unsigned IOCTL_EQL_ENSLAVE;
- extern unsigned IOCTL_EQL_GETMASTRCFG;
- extern unsigned IOCTL_EQL_GETSLAVECFG;
- extern unsigned IOCTL_EQL_SETMASTRCFG;
- extern unsigned IOCTL_EQL_SETSLAVECFG;
- extern unsigned IOCTL_EVIOCGKEYCODE_V2;
- extern unsigned IOCTL_EVIOCGPROP;
- extern unsigned IOCTL_EVIOCSKEYCODE_V2;
- extern unsigned IOCTL_FS_IOC_GETFLAGS;
- extern unsigned IOCTL_FS_IOC_GETVERSION;
- extern unsigned IOCTL_FS_IOC_SETFLAGS;
- extern unsigned IOCTL_FS_IOC_SETVERSION;
- extern unsigned IOCTL_GIO_CMAP;
- extern unsigned IOCTL_GIO_FONT;
- extern unsigned IOCTL_GIO_UNIMAP;
- extern unsigned IOCTL_GIO_UNISCRNMAP;
- extern unsigned IOCTL_KDADDIO;
- extern unsigned IOCTL_KDDELIO;
- extern unsigned IOCTL_KDGETKEYCODE;
- extern unsigned IOCTL_KDGKBDIACR;
- extern unsigned IOCTL_KDGKBENT;
- extern unsigned IOCTL_KDGKBLED;
- extern unsigned IOCTL_KDGKBMETA;
- extern unsigned IOCTL_KDGKBSENT;
- extern unsigned IOCTL_KDMAPDISP;
- extern unsigned IOCTL_KDSETKEYCODE;
- extern unsigned IOCTL_KDSIGACCEPT;
- extern unsigned IOCTL_KDSKBDIACR;
- extern unsigned IOCTL_KDSKBENT;
- extern unsigned IOCTL_KDSKBLED;
- extern unsigned IOCTL_KDSKBMETA;
- extern unsigned IOCTL_KDSKBSENT;
- extern unsigned IOCTL_KDUNMAPDISP;
- extern unsigned IOCTL_LPABORT;
- extern unsigned IOCTL_LPABORTOPEN;
- extern unsigned IOCTL_LPCAREFUL;
- extern unsigned IOCTL_LPCHAR;
- extern unsigned IOCTL_LPGETIRQ;
- extern unsigned IOCTL_LPGETSTATUS;
- extern unsigned IOCTL_LPRESET;
- extern unsigned IOCTL_LPSETIRQ;
- extern unsigned IOCTL_LPTIME;
- extern unsigned IOCTL_LPWAIT;
- extern unsigned IOCTL_MTIOCGETCONFIG;
- extern unsigned IOCTL_MTIOCSETCONFIG;
- extern unsigned IOCTL_PIO_CMAP;
- extern unsigned IOCTL_PIO_FONT;
- extern unsigned IOCTL_PIO_UNIMAP;
- extern unsigned IOCTL_PIO_UNIMAPCLR;
- extern unsigned IOCTL_PIO_UNISCRNMAP;
- extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN;
- extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST;
- extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE;
- extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE;
- extern unsigned IOCTL_SIOCAIPXITFCRT;
- extern unsigned IOCTL_SIOCAIPXPRISLT;
- extern unsigned IOCTL_SIOCAX25ADDUID;
- extern unsigned IOCTL_SIOCAX25DELUID;
- extern unsigned IOCTL_SIOCAX25GETPARMS;
- extern unsigned IOCTL_SIOCAX25GETUID;
- extern unsigned IOCTL_SIOCAX25NOUID;
- extern unsigned IOCTL_SIOCAX25SETPARMS;
- extern unsigned IOCTL_SIOCDEVPLIP;
- extern unsigned IOCTL_SIOCIPXCFGDATA;
- extern unsigned IOCTL_SIOCNRDECOBS;
- extern unsigned IOCTL_SIOCNRGETPARMS;
- extern unsigned IOCTL_SIOCNRRTCTL;
- extern unsigned IOCTL_SIOCNRSETPARMS;
- extern unsigned IOCTL_SNDCTL_DSP_GETISPACE;
- extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE;
- extern unsigned IOCTL_TIOCGSERIAL;
- extern unsigned IOCTL_TIOCSERGETMULTI;
- extern unsigned IOCTL_TIOCSERSETMULTI;
- extern unsigned IOCTL_TIOCSSERIAL;
- extern unsigned IOCTL_GIO_SCRNMAP;
- extern unsigned IOCTL_KDDISABIO;
- extern unsigned IOCTL_KDENABIO;
- extern unsigned IOCTL_KDGETLED;
- extern unsigned IOCTL_KDGETMODE;
- extern unsigned IOCTL_KDGKBMODE;
- extern unsigned IOCTL_KDGKBTYPE;
- extern unsigned IOCTL_KDMKTONE;
- extern unsigned IOCTL_KDSETLED;
- extern unsigned IOCTL_KDSETMODE;
- extern unsigned IOCTL_KDSKBMODE;
- extern unsigned IOCTL_KIOCSOUND;
- extern unsigned IOCTL_PIO_SCRNMAP;
-#endif
-
- extern const int si_SEGV_MAPERR;
- extern const int si_SEGV_ACCERR;
+extern unsigned IOCTL_CYGETDEFTHRESH;
+extern unsigned IOCTL_CYGETDEFTIMEOUT;
+extern unsigned IOCTL_CYGETMON;
+extern unsigned IOCTL_CYGETTHRESH;
+extern unsigned IOCTL_CYGETTIMEOUT;
+extern unsigned IOCTL_CYSETDEFTHRESH;
+extern unsigned IOCTL_CYSETDEFTIMEOUT;
+extern unsigned IOCTL_CYSETTHRESH;
+extern unsigned IOCTL_CYSETTIMEOUT;
+extern unsigned IOCTL_EQL_EMANCIPATE;
+extern unsigned IOCTL_EQL_ENSLAVE;
+extern unsigned IOCTL_EQL_GETMASTRCFG;
+extern unsigned IOCTL_EQL_GETSLAVECFG;
+extern unsigned IOCTL_EQL_SETMASTRCFG;
+extern unsigned IOCTL_EQL_SETSLAVECFG;
+extern unsigned IOCTL_EVIOCGKEYCODE_V2;
+extern unsigned IOCTL_EVIOCGPROP;
+extern unsigned IOCTL_EVIOCSKEYCODE_V2;
+extern unsigned IOCTL_FS_IOC_GETFLAGS;
+extern unsigned IOCTL_FS_IOC_GETVERSION;
+extern unsigned IOCTL_FS_IOC_SETFLAGS;
+extern unsigned IOCTL_FS_IOC_SETVERSION;
+extern unsigned IOCTL_GIO_CMAP;
+extern unsigned IOCTL_GIO_FONT;
+extern unsigned IOCTL_GIO_UNIMAP;
+extern unsigned IOCTL_GIO_UNISCRNMAP;
+extern unsigned IOCTL_KDADDIO;
+extern unsigned IOCTL_KDDELIO;
+extern unsigned IOCTL_KDGETKEYCODE;
+extern unsigned IOCTL_KDGKBDIACR;
+extern unsigned IOCTL_KDGKBENT;
+extern unsigned IOCTL_KDGKBLED;
+extern unsigned IOCTL_KDGKBMETA;
+extern unsigned IOCTL_KDGKBSENT;
+extern unsigned IOCTL_KDMAPDISP;
+extern unsigned IOCTL_KDSETKEYCODE;
+extern unsigned IOCTL_KDSIGACCEPT;
+extern unsigned IOCTL_KDSKBDIACR;
+extern unsigned IOCTL_KDSKBENT;
+extern unsigned IOCTL_KDSKBLED;
+extern unsigned IOCTL_KDSKBMETA;
+extern unsigned IOCTL_KDSKBSENT;
+extern unsigned IOCTL_KDUNMAPDISP;
+extern unsigned IOCTL_LPABORT;
+extern unsigned IOCTL_LPABORTOPEN;
+extern unsigned IOCTL_LPCAREFUL;
+extern unsigned IOCTL_LPCHAR;
+extern unsigned IOCTL_LPGETIRQ;
+extern unsigned IOCTL_LPGETSTATUS;
+extern unsigned IOCTL_LPRESET;
+extern unsigned IOCTL_LPSETIRQ;
+extern unsigned IOCTL_LPTIME;
+extern unsigned IOCTL_LPWAIT;
+extern unsigned IOCTL_MTIOCGETCONFIG;
+extern unsigned IOCTL_MTIOCSETCONFIG;
+extern unsigned IOCTL_PIO_CMAP;
+extern unsigned IOCTL_PIO_FONT;
+extern unsigned IOCTL_PIO_UNIMAP;
+extern unsigned IOCTL_PIO_UNIMAPCLR;
+extern unsigned IOCTL_PIO_UNISCRNMAP;
+extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN;
+extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST;
+extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE;
+extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE;
+extern unsigned IOCTL_SIOCAIPXITFCRT;
+extern unsigned IOCTL_SIOCAIPXPRISLT;
+extern unsigned IOCTL_SIOCAX25ADDUID;
+extern unsigned IOCTL_SIOCAX25DELUID;
+extern unsigned IOCTL_SIOCAX25GETPARMS;
+extern unsigned IOCTL_SIOCAX25GETUID;
+extern unsigned IOCTL_SIOCAX25NOUID;
+extern unsigned IOCTL_SIOCAX25SETPARMS;
+extern unsigned IOCTL_SIOCDEVPLIP;
+extern unsigned IOCTL_SIOCIPXCFGDATA;
+extern unsigned IOCTL_SIOCNRDECOBS;
+extern unsigned IOCTL_SIOCNRGETPARMS;
+extern unsigned IOCTL_SIOCNRRTCTL;
+extern unsigned IOCTL_SIOCNRSETPARMS;
+extern unsigned IOCTL_SNDCTL_DSP_GETISPACE;
+extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE;
+extern unsigned IOCTL_TIOCGSERIAL;
+extern unsigned IOCTL_TIOCSERGETMULTI;
+extern unsigned IOCTL_TIOCSERSETMULTI;
+extern unsigned IOCTL_TIOCSSERIAL;
+extern unsigned IOCTL_GIO_SCRNMAP;
+extern unsigned IOCTL_KDDISABIO;
+extern unsigned IOCTL_KDENABIO;
+extern unsigned IOCTL_KDGETLED;
+extern unsigned IOCTL_KDGETMODE;
+extern unsigned IOCTL_KDGKBMODE;
+extern unsigned IOCTL_KDGKBTYPE;
+extern unsigned IOCTL_KDMKTONE;
+extern unsigned IOCTL_KDSETLED;
+extern unsigned IOCTL_KDSETMODE;
+extern unsigned IOCTL_KDSKBMODE;
+extern unsigned IOCTL_KIOCSOUND;
+extern unsigned IOCTL_PIO_SCRNMAP;
+#endif
+
+extern const int si_SEGV_MAPERR;
+extern const int si_SEGV_ACCERR;
} // namespace __sanitizer
#define CHECK_TYPE_SIZE(TYPE) \
COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
-#define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \
- COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
- sizeof(((CLASS *) NULL)->MEMBER)); \
- COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
+#define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \
+ COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
+ sizeof(((CLASS *)NULL)->MEMBER)); \
+ COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
offsetof(CLASS, MEMBER))
// For sigaction, which is a function and struct at the same time,
// and thus requires explicit "struct" in sizeof() expression.
-#define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \
- COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *) NULL)->MEMBER) == \
- sizeof(((struct CLASS *) NULL)->MEMBER)); \
- COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
+#define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \
+ COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *)NULL)->MEMBER) == \
+ sizeof(((struct CLASS *)NULL)->MEMBER)); \
+ COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
offsetof(struct CLASS, MEMBER))
#define SIGACTION_SYMNAME sigaction
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc b/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
index 3503eb2eab34..9717d98ebf1a 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_platform_limits_solaris.cc ------------------------------===//
+//===-- sanitizer_platform_limits_solaris.cpp -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_solaris.h b/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
index eb5c5855b378..77ae6e6a44db 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
@@ -68,7 +68,7 @@ struct __sanitizer_ipc_perm {
#if !defined(_LP64)
int pad[4];
#endif
- };
+};
struct __sanitizer_shmid_ds {
__sanitizer_ipc_perm shm_perm;
@@ -236,10 +236,9 @@ typedef long __sanitizer_clock_t;
typedef int __sanitizer_clockid_t;
// This thing depends on the platform. We are only interested in the upper
-// limit. Verified with a compiler assert in .cc.
-const int pthread_attr_t_max_sz = 128;
+// limit. Verified with a compiler assert in .cpp.
union __sanitizer_pthread_attr_t {
- char size[pthread_attr_t_max_sz]; // NOLINT
+ char size[128];
void *align;
};
diff --git a/lib/sanitizer_common/sanitizer_posix.cc b/lib/sanitizer_common/sanitizer_posix.cpp
index bf7127443c41..d890a3a31773 100644
--- a/lib/sanitizer_common/sanitizer_posix.cc
+++ b/lib/sanitizer_common/sanitizer_posix.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_posix.cc ------------------------------------------------===//
+//===-- sanitizer_posix.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -312,6 +312,8 @@ const char *SignalContext::Describe() const {
return "SEGV";
case SIGBUS:
return "BUS";
+ case SIGTRAP:
+ return "TRAP";
}
return "UNKNOWN SIGNAL";
}
diff --git a/lib/sanitizer_common/sanitizer_posix.h b/lib/sanitizer_common/sanitizer_posix.h
index 6cf5ce75b12e..05fb0f630207 100644
--- a/lib/sanitizer_common/sanitizer_posix.h
+++ b/lib/sanitizer_common/sanitizer_posix.h
@@ -63,7 +63,7 @@ uptr internal_ptrace(int request, int pid, void *addr, void *data);
uptr internal_waitpid(int pid, int *status, int options);
int internal_fork();
-int internal_forkpty(int *amaster);
+fd_t internal_spawn(const char *argv[], pid_t *pid);
int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
uptr *oldlenp, const void *newp, uptr newlen);
diff --git a/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index 23a2f84ac887..304b3a01a08b 100644
--- a/lib/sanitizer_common/sanitizer_posix_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_posix_libcdep.cc ----------------------------------------===//
+//===-- sanitizer_posix_libcdep.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -68,11 +68,12 @@ void ReleaseMemoryPagesToOS(uptr beg, uptr end) {
SANITIZER_MADVISE_DONTNEED);
}
-bool NoHugePagesInRegion(uptr addr, uptr size) {
+void SetShadowRegionHugePageMode(uptr addr, uptr size) {
#ifdef MADV_NOHUGEPAGE // May not be defined on old systems.
- return madvise((char *)addr, size, MADV_NOHUGEPAGE) == 0;
-#else
- return true;
+ if (common_flags()->no_huge_pages_for_shadow)
+ madvise((char *)addr, size, MADV_NOHUGEPAGE);
+ else
+ madvise((char *)addr, size, MADV_HUGEPAGE);
#endif // MADV_NOHUGEPAGE
}
@@ -303,11 +304,13 @@ void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {
MemoryMappingLayout::CacheMemoryMappings();
}
-bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
+static bool MmapFixed(uptr fixed_addr, uptr size, int additional_flags,
+ const char *name) {
size = RoundUpTo(size, GetPageSizeCached());
fixed_addr = RoundDownTo(fixed_addr, GetPageSizeCached());
- uptr p = MmapNamed((void *)fixed_addr, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE | MAP_ANON, name);
+ uptr p =
+ MmapNamed((void *)fixed_addr, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED | additional_flags | MAP_ANON, name);
int reserrno;
if (internal_iserror(p, &reserrno)) {
Report("ERROR: %s failed to "
@@ -319,6 +322,24 @@ bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
return true;
}
+bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
+ return MmapFixed(fixed_addr, size, MAP_NORESERVE, name);
+}
+
+bool MmapFixedSuperNoReserve(uptr fixed_addr, uptr size, const char *name) {
+#if SANITIZER_FREEBSD
+ if (common_flags()->no_huge_pages_for_shadow)
+ return MmapFixedNoReserve(fixed_addr, size, name);
+ // MAP_NORESERVE is implicit with FreeBSD
+ return MmapFixed(fixed_addr, size, MAP_ALIGNED_SUPER, name);
+#else
+ bool r = MmapFixedNoReserve(fixed_addr, size, name);
+ if (r)
+ SetShadowRegionHugePageMode(fixed_addr, size);
+ return r;
+#endif
+}
+
uptr ReservedAddressRange::Init(uptr size, const char *name, uptr fixed_addr) {
base_ = fixed_addr ? MmapFixedNoAccess(fixed_addr, size, name)
: MmapNoAccess(size);
diff --git a/lib/sanitizer_common/sanitizer_printf.cc b/lib/sanitizer_common/sanitizer_printf.cpp
index f4e17a8f51fd..a032787114bb 100644
--- a/lib/sanitizer_common/sanitizer_printf.cc
+++ b/lib/sanitizer_common/sanitizer_printf.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_printf.cc -----------------------------------------------===//
+//===-- sanitizer_printf.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -229,15 +229,15 @@ void SetPrintfAndReportCallback(void (*callback)(const char *)) {
// Can be overriden in frontend.
#if SANITIZER_GO && defined(TSAN_EXTERNAL_HOOKS)
// Implementation must be defined in frontend.
-extern "C" void OnPrint(const char *str);
+extern "C" void __sanitizer_on_print(const char *str);
#else
-SANITIZER_INTERFACE_WEAK_DEF(void, OnPrint, const char *str) {
+SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_on_print, const char *str) {
(void)str;
}
#endif
static void CallPrintfAndReportCallback(const char *str) {
- OnPrint(str);
+ __sanitizer_on_print(str);
if (PrintfAndReportCallback)
PrintfAndReportCallback(str);
}
diff --git a/lib/sanitizer_common/sanitizer_procmaps.h b/lib/sanitizer_common/sanitizer_procmaps.h
index 052027111ceb..d0e5245f84da 100644
--- a/lib/sanitizer_common/sanitizer_procmaps.h
+++ b/lib/sanitizer_common/sanitizer_procmaps.h
@@ -37,7 +37,7 @@ struct MemoryMappedSegmentData;
class MemoryMappedSegment {
public:
- MemoryMappedSegment(char *buff = nullptr, uptr size = 0)
+ explicit MemoryMappedSegment(char *buff = nullptr, uptr size = 0)
: filename(buff), filename_size(size), data_(nullptr) {}
~MemoryMappedSegment() {}
diff --git a/lib/sanitizer_common/sanitizer_procmaps_bsd.cc b/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
index c38bafd9f52f..02ff7c0e91a8 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_bsd.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_procmaps_bsd.cc -----------------------------------------===//
+//===-- sanitizer_procmaps_bsd.cpp ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_procmaps_common.cc b/lib/sanitizer_common/sanitizer_procmaps_common.cpp
index 4a2b0a047ad6..e0cb47f8ca9a 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_common.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_common.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_procmaps_common.cc --------------------------------------===//
+//===-- sanitizer_procmaps_common.cpp -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_procmaps_linux.cc b/lib/sanitizer_common/sanitizer_procmaps_linux.cpp
index fd5e03619bdd..c7af57355b91 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_linux.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_linux.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_procmaps_linux.cc ---------------------------------------===//
+//===-- sanitizer_procmaps_linux.cpp --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_procmaps_mac.cc b/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
index 148910f42061..d02afcfe87ae 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_mac.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_procmaps_mac.cc -----------------------------------------===//
+//===-- sanitizer_procmaps_mac.cpp ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -181,13 +181,14 @@ const mach_header *get_dyld_hdr() {
// Note that the segment addresses are not necessarily sorted.
template <u32 kLCSegment, typename SegmentCommand>
static bool NextSegmentLoad(MemoryMappedSegment *segment,
-MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
- const char *lc = layout_data.current_load_cmd_addr;
- layout_data.current_load_cmd_addr += ((const load_command *)lc)->cmdsize;
+ MemoryMappedSegmentData *seg_data,
+ MemoryMappingLayoutData *layout_data) {
+ const char *lc = layout_data->current_load_cmd_addr;
+ layout_data->current_load_cmd_addr += ((const load_command *)lc)->cmdsize;
if (((const load_command *)lc)->cmd == kLCSegment) {
const SegmentCommand* sc = (const SegmentCommand *)lc;
uptr base_virt_addr, addr_mask;
- if (layout_data.current_image == kDyldImageIdx) {
+ if (layout_data->current_image == kDyldImageIdx) {
base_virt_addr = (uptr)get_dyld_hdr();
// vmaddr is masked with 0xfffff because on macOS versions < 10.12,
// it contains an absolute address rather than an offset for dyld.
@@ -198,7 +199,7 @@ MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
addr_mask = 0xfffff;
} else {
base_virt_addr =
- (uptr)_dyld_get_image_vmaddr_slide(layout_data.current_image);
+ (uptr)_dyld_get_image_vmaddr_slide(layout_data->current_image);
addr_mask = ~0;
}
@@ -219,18 +220,18 @@ MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
// Return the initial protection.
segment->protection = sc->initprot;
- segment->offset = (layout_data.current_filetype ==
+ segment->offset = (layout_data->current_filetype ==
/*MH_EXECUTE*/ 0x2)
? sc->vmaddr
: sc->fileoff;
if (segment->filename) {
- const char *src = (layout_data.current_image == kDyldImageIdx)
+ const char *src = (layout_data->current_image == kDyldImageIdx)
? kDyldPath
- : _dyld_get_image_name(layout_data.current_image);
+ : _dyld_get_image_name(layout_data->current_image);
internal_strncpy(segment->filename, src, segment->filename_size);
}
- segment->arch = layout_data.current_arch;
- internal_memcpy(segment->uuid, layout_data.current_uuid, kModuleUUIDSize);
+ segment->arch = layout_data->current_arch;
+ internal_memcpy(segment->uuid, layout_data->current_uuid, kModuleUUIDSize);
return true;
}
return false;
@@ -331,14 +332,14 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
#ifdef MH_MAGIC_64
case MH_MAGIC_64: {
if (NextSegmentLoad<LC_SEGMENT_64, struct segment_command_64>(
- segment, segment->data_, data_))
+ segment, segment->data_, &data_))
return true;
break;
}
#endif
case MH_MAGIC: {
if (NextSegmentLoad<LC_SEGMENT, struct segment_command>(
- segment, segment->data_, data_))
+ segment, segment->data_, &data_))
return true;
break;
}
diff --git a/lib/sanitizer_common/sanitizer_procmaps_solaris.cc b/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp
index b5df6fe4c41e..8793423a6017 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_solaris.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_procmaps_solaris.cc -------------------------------------===//
+//===-- sanitizer_procmaps_solaris.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_rtems.cc b/lib/sanitizer_common/sanitizer_rtems.cpp
index ffc21b958b8e..0d2576c00ab3 100644
--- a/lib/sanitizer_common/sanitizer_rtems.cc
+++ b/lib/sanitizer_common/sanitizer_rtems.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_rtems.cc ------------------------------------------------===//
+//===-- sanitizer_rtems.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_solaris.cc b/lib/sanitizer_common/sanitizer_solaris.cpp
index 37b50c6b243a..035f2d0ca292 100644
--- a/lib/sanitizer_common/sanitizer_solaris.cc
+++ b/lib/sanitizer_common/sanitizer_solaris.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_solaris.cc ----------------------------------------------===//
+//===-- sanitizer_solaris.cpp ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_stackdepot.cc b/lib/sanitizer_common/sanitizer_stackdepot.cpp
index 1cdedfa32fbe..30073a96ceeb 100644
--- a/lib/sanitizer_common/sanitizer_stackdepot.cc
+++ b/lib/sanitizer_common/sanitizer_stackdepot.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stackdepot.cc -------------------------------------------===//
+//===-- sanitizer_stackdepot.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_stacktrace.cc b/lib/sanitizer_common/sanitizer_stacktrace.cpp
index 26474037ff35..ef14fb704eed 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stacktrace.cc -------------------------------------------===//
+//===-- sanitizer_stacktrace.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
index 859032ba84e1..4ef305cf1799 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stacktrace_libcdep.cc -----------------------------------===//
+//===-- sanitizer_stacktrace_libcdep.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -150,8 +150,9 @@ void __sanitizer_symbolize_global(uptr data_addr, const char *fmt,
}
SANITIZER_INTERFACE_ATTRIBUTE
-int __sanitizer_get_module_and_offset_for_pc( // NOLINT
- uptr pc, char *module_name, uptr module_name_len, uptr *pc_offset) {
+int __sanitizer_get_module_and_offset_for_pc(uptr pc, char *module_name,
+ uptr module_name_len,
+ uptr *pc_offset) {
return __sanitizer::GetModuleAndOffsetForPc(pc, module_name, module_name_len,
pc_offset);
}
diff --git a/lib/sanitizer_common/sanitizer_stacktrace_printer.cc b/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
index 17bbf6c0b868..150ff475316b 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace_printer.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_common.cc -----------------------------------------------===//
+//===-- sanitizer_common.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -16,7 +16,7 @@
namespace __sanitizer {
-// sanitizer_symbolizer_markup.cc implements these differently.
+// sanitizer_symbolizer_markup.cpp implements these differently.
#if !SANITIZER_SYMBOLIZER_MARKUP
static const char *StripFunctionName(const char *function, const char *prefix) {
diff --git a/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc b/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
index b238cfbc26a3..34190fb1bbb2 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stacktrace_sparc.cc -------------------------------------===//
+//===-- sanitizer_stacktrace_sparc.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index 716f0d226954..651d5056dd9d 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stoptheworld_linux_libcdep.cc ---------------------------===//
+//===-- sanitizer_stoptheworld_linux_libcdep.cpp --------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -223,10 +223,11 @@ bool ThreadSuspender::SuspendAllThreads() {
case ThreadLister::Ok:
break;
}
- for (tid_t tid : threads)
+ for (tid_t tid : threads) {
if (SuspendThread(tid))
retry = true;
- };
+ }
+ }
return suspended_threads_list_.ThreadCount();
}
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc b/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp
index e79edc40f98f..9dffd21ecb7c 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stoptheworld_mac.cc -------------------------------------===//
+//===-- sanitizer_stoptheworld_mac.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp
index 7a8d14ae741e..5690d75097f9 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_stoptheworld_netbsd_libcdep.cc --------------------------===//
+//===-- sanitizer_stoptheworld_netbsd_libcdep.cpp -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +10,7 @@
// This implementation was inspired by Markus Gutschke's linuxthreads.cc.
//
// This is a NetBSD variation of Linux stoptheworld implementation
-// See sanitizer_stoptheworld_linux_libcdep.cc for code comments.
+// See sanitizer_stoptheworld_linux_libcdep.cpp for code comments.
//
//===----------------------------------------------------------------------===//
diff --git a/lib/sanitizer_common/sanitizer_suppressions.cc b/lib/sanitizer_common/sanitizer_suppressions.cpp
index 12ecd9a2e368..44c83a66c5fe 100644
--- a/lib/sanitizer_common/sanitizer_suppressions.cc
+++ b/lib/sanitizer_common/sanitizer_suppressions.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_suppressions.cc -----------------------------------------===//
+//===-- sanitizer_suppressions.cpp ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_suppressions.h b/lib/sanitizer_common/sanitizer_suppressions.h
index f9da7af7e6ab..2d88b1f72fa6 100644
--- a/lib/sanitizer_common/sanitizer_suppressions.h
+++ b/lib/sanitizer_common/sanitizer_suppressions.h
@@ -42,7 +42,7 @@ class SuppressionContext {
void GetMatched(InternalMmapVector<Suppression *> *matched);
private:
- static const int kMaxSuppressionTypes = 32;
+ static const int kMaxSuppressionTypes = 64;
const char **const suppression_types_;
const int suppression_types_num_;
diff --git a/lib/sanitizer_common/sanitizer_symbolizer.cc b/lib/sanitizer_common/sanitizer_symbolizer.cpp
index 216ce585a0c6..ce2ece5f4d51 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer.cc -------------------------------------------===//
+//===-- sanitizer_symbolizer.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_internal.h b/lib/sanitizer_common/sanitizer_symbolizer_internal.h
index 4611b7dfe1e5..c04797dd61b8 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_internal.h
+++ b/lib/sanitizer_common/sanitizer_symbolizer_internal.h
@@ -76,30 +76,31 @@ class SymbolizerTool {
// SymbolizerProcess may not be used from two threads simultaneously.
class SymbolizerProcess {
public:
- explicit SymbolizerProcess(const char *path, bool use_forkpty = false);
+ explicit SymbolizerProcess(const char *path, bool use_posix_spawn = false);
const char *SendCommand(const char *command);
protected:
+ /// The maximum number of arguments required to invoke a tool process.
+ static const unsigned kArgVMax = 6;
+
+ // Customizable by subclasses.
+ virtual bool StartSymbolizerSubprocess();
+ virtual bool ReadFromSymbolizer(char *buffer, uptr max_length);
+
+ private:
virtual bool ReachedEndOfOutput(const char *buffer, uptr length) const {
UNIMPLEMENTED();
}
- /// The maximum number of arguments required to invoke a tool process.
- enum { kArgVMax = 6 };
-
/// Fill in an argv array to invoke the child process.
virtual void GetArgV(const char *path_to_binary,
const char *(&argv)[kArgVMax]) const {
UNIMPLEMENTED();
}
- virtual bool ReadFromSymbolizer(char *buffer, uptr max_length);
-
- private:
bool Restart();
const char *SendCommandImpl(const char *command);
bool WriteToSymbolizer(const char *buffer, uptr length);
- bool StartSymbolizerSubprocess();
const char *path_;
fd_t input_fd_;
@@ -113,7 +114,7 @@ class SymbolizerProcess {
uptr times_restarted_;
bool failed_to_start_;
bool reported_invalid_path_;
- bool use_forkpty_;
+ bool use_posix_spawn_;
};
class LLVMSymbolizerProcess;
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc b/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp
index 8a20e062cf47..27ed222745ec 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_libbacktrace.cc ------------------------------===//
+//===-- sanitizer_symbolizer_libbacktrace.cpp -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc b/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp
index 7f5bc55bd865..3b19a6836ec5 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_libcdep.cc -----------------------------------===//
+//===-- sanitizer_symbolizer_libcdep.cpp ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -25,7 +25,7 @@ Symbolizer *Symbolizer::GetOrInit() {
return symbolizer_;
}
-// See sanitizer_symbolizer_markup.cc.
+// See sanitizer_symbolizer_markup.cpp.
#if !SANITIZER_SYMBOLIZER_MARKUP
const char *ExtractToken(const char *str, const char *delims, char **result) {
@@ -238,7 +238,8 @@ const LoadedModule *Symbolizer::FindModuleForAddress(uptr address) {
// <empty line>
class LLVMSymbolizerProcess : public SymbolizerProcess {
public:
- explicit LLVMSymbolizerProcess(const char *path) : SymbolizerProcess(path) {}
+ explicit LLVMSymbolizerProcess(const char *path)
+ : SymbolizerProcess(path, /*use_posix_spawn=*/SANITIZER_MAC) {}
private:
bool ReachedEndOfOutput(const char *buffer, uptr length) const override {
@@ -452,14 +453,14 @@ const char *LLVMSymbolizer::FormatAndSendCommand(const char *command_prefix,
return symbolizer_process_->SendCommand(buffer_);
}
-SymbolizerProcess::SymbolizerProcess(const char *path, bool use_forkpty)
+SymbolizerProcess::SymbolizerProcess(const char *path, bool use_posix_spawn)
: path_(path),
input_fd_(kInvalidFd),
output_fd_(kInvalidFd),
times_restarted_(0),
failed_to_start_(false),
reported_invalid_path_(false),
- use_forkpty_(use_forkpty) {
+ use_posix_spawn_(use_posix_spawn) {
CHECK(path_);
CHECK_NE(path_[0], '\0');
}
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc b/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
index d3566571948e..a619ed092f0b 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_mac.cc ---------------------------------------===//
+//===-- sanitizer_symbolizer_mac.cpp --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -50,13 +50,18 @@ bool DlAddrSymbolizer::SymbolizeData(uptr addr, DataInfo *datainfo) {
class AtosSymbolizerProcess : public SymbolizerProcess {
public:
explicit AtosSymbolizerProcess(const char *path, pid_t parent_pid)
- : SymbolizerProcess(path, /*use_forkpty*/ true) {
+ : SymbolizerProcess(path, /*use_posix_spawn*/ true) {
// Put the string command line argument in the object so that it outlives
// the call to GetArgV.
internal_snprintf(pid_str_, sizeof(pid_str_), "%d", parent_pid);
}
private:
+ bool StartSymbolizerSubprocess() override {
+ // Configure sandbox before starting atos process.
+ return SymbolizerProcess::StartSymbolizerSubprocess();
+ }
+
bool ReachedEndOfOutput(const char *buffer, uptr length) const override {
return (length >= 1 && buffer[length - 1] == '\n');
}
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_markup.cc b/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
index aee49b4c4567..57b4d0c9d961 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_markup.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_markup.cc ------------------------------------===//
+//===-- sanitizer_symbolizer_markup.cpp -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 2df3a90bafaa..c123ecb11206 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_posix_libcdep.cc -----------------------------===//
+//===-- sanitizer_symbolizer_posix_libcdep.cpp ----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -33,10 +33,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#if SANITIZER_MAC
-#include <util.h> // for forkpty()
-#endif // SANITIZER_MAC
-
// C++ demangling function, as required by Itanium C++ ABI. This is weak,
// because we do not require a C++ ABI library to be linked to a program
// using sanitizers; if it's not present, we'll just use the mangled name.
@@ -151,80 +147,32 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() {
return false;
}
- int pid = -1;
-
- int infd[2];
- internal_memset(&infd, 0, sizeof(infd));
- int outfd[2];
- internal_memset(&outfd, 0, sizeof(outfd));
- if (!CreateTwoHighNumberedPipes(infd, outfd)) {
- Report("WARNING: Can't create a socket pair to start "
- "external symbolizer (errno: %d)\n", errno);
- return false;
- }
+ const char *argv[kArgVMax];
+ GetArgV(path_, argv);
+ pid_t pid;
- if (use_forkpty_) {
+ if (use_posix_spawn_) {
#if SANITIZER_MAC
- fd_t fd = kInvalidFd;
-
- // forkpty redirects stdout and stderr into a single stream, so we would
- // receive error messages as standard replies. To avoid that, let's dup
- // stderr and restore it in the child.
- int saved_stderr = dup(STDERR_FILENO);
- CHECK_GE(saved_stderr, 0);
-
- // We only need one pipe, for stdin of the child.
- close(outfd[0]);
- close(outfd[1]);
-
- // Use forkpty to disable buffering in the new terminal.
- pid = internal_forkpty(&fd);
- if (pid == -1) {
- // forkpty() failed.
- Report("WARNING: failed to fork external symbolizer (errno: %d)\n",
+ fd_t fd = internal_spawn(argv, &pid);
+ if (fd == kInvalidFd) {
+ Report("WARNING: failed to spawn external symbolizer (errno: %d)\n",
errno);
return false;
- } else if (pid == 0) {
- // Child subprocess.
-
- // infd[0] is the child's reading end.
- close(infd[1]);
-
- // Set up stdin to read from the pipe.
- CHECK_GE(dup2(infd[0], STDIN_FILENO), 0);
- close(infd[0]);
-
- // Restore stderr.
- CHECK_GE(dup2(saved_stderr, STDERR_FILENO), 0);
- close(saved_stderr);
-
- const char *argv[kArgVMax];
- GetArgV(path_, argv);
- execv(path_, const_cast<char **>(&argv[0]));
- internal__exit(1);
}
- // Input for the child, infd[1] is our writing end.
- output_fd_ = infd[1];
- close(infd[0]);
-
- // Continue execution in parent process.
input_fd_ = fd;
-
- close(saved_stderr);
-
- // Disable echo in the new terminal, disable CR.
- struct termios termflags;
- tcgetattr(fd, &termflags);
- termflags.c_oflag &= ~ONLCR;
- termflags.c_lflag &= ~ECHO;
- tcsetattr(fd, TCSANOW, &termflags);
+ output_fd_ = fd;
#else // SANITIZER_MAC
UNIMPLEMENTED();
#endif // SANITIZER_MAC
} else {
- const char *argv[kArgVMax];
- GetArgV(path_, argv);
+ fd_t infd[2] = {}, outfd[2] = {};
+ if (!CreateTwoHighNumberedPipes(infd, outfd)) {
+ Report("WARNING: Can't create a socket pair to start "
+ "external symbolizer (errno: %d)\n", errno);
+ return false;
+ }
+
pid = StartSubprocess(path_, argv, /* stdin */ outfd[0],
/* stdout */ infd[1]);
if (pid < 0) {
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_report.cc b/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index f4167d160ae8..c26724ceb7a7 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_report.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_report.cc ------------------------------------===//
+//===-- sanitizer_symbolizer_report.cpp -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -106,8 +106,9 @@ void ReportMmapWriteExec(int prot) {
if (StackTrace::WillUseFastUnwind(fast)) {
GetThreadStackTopAndBottom(false, &top, &bottom);
stack->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, true);
- } else
+ } else {
stack->Unwind(kStackTraceMax, pc, 0, nullptr, 0, 0, false);
+ }
Printf("%s", d.Warning());
Report("WARNING: %s: writable-executable page usage\n", SanitizerToolName);
@@ -190,9 +191,14 @@ static void ReportDeadlySignalImpl(const SignalContext &sig, u32 tid,
SanitizerCommonDecorator d;
Printf("%s", d.Warning());
const char *description = sig.Describe();
- Report("ERROR: %s: %s on unknown address %p (pc %p bp %p sp %p T%d)\n",
- SanitizerToolName, description, (void *)sig.addr, (void *)sig.pc,
- (void *)sig.bp, (void *)sig.sp, tid);
+ if (sig.is_memory_access && !sig.is_true_faulting_addr)
+ Report("ERROR: %s: %s on unknown address (pc %p bp %p sp %p T%d)\n",
+ SanitizerToolName, description, (void *)sig.pc, (void *)sig.bp,
+ (void *)sig.sp, tid);
+ else
+ Report("ERROR: %s: %s on unknown address %p (pc %p bp %p sp %p T%d)\n",
+ SanitizerToolName, description, (void *)sig.addr, (void *)sig.pc,
+ (void *)sig.bp, (void *)sig.sp, tid);
Printf("%s", d.Default());
if (sig.pc < GetPageSizeCached())
Report("Hint: pc points to the zero page.\n");
@@ -202,7 +208,11 @@ static void ReportDeadlySignalImpl(const SignalContext &sig, u32 tid,
? "WRITE"
: (sig.write_flag == SignalContext::READ ? "READ" : "UNKNOWN");
Report("The signal is caused by a %s memory access.\n", access_type);
- if (sig.addr < GetPageSizeCached())
+ if (!sig.is_true_faulting_addr)
+ Report("Hint: this fault was caused by a dereference of a high value "
+ "address (see register values below). Dissassemble the provided "
+ "pc to learn which register was used.\n");
+ else if (sig.addr < GetPageSizeCached())
Report("Hint: address points to the zero page.\n");
}
MaybeReportNonExecRegion(sig.pc);
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_win.cc b/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
index 1badcf5f0a35..2808779156ed 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_win.cc ---------------------------------------===//
+//===-- sanitizer_symbolizer_win.cpp --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_termination.cc b/lib/sanitizer_common/sanitizer_termination.cpp
index a011cce42aa2..84be6fc32342 100644
--- a/lib/sanitizer_common/sanitizer_termination.cc
+++ b/lib/sanitizer_common/sanitizer_termination.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_termination.cc --------------------------------*- C++ -*-===//
+//===-- sanitizer_termination.cpp -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -84,7 +84,7 @@ void NORETURN CheckFailed(const char *file, int line, const char *cond,
} // namespace __sanitizer
-using namespace __sanitizer; // NOLINT
+using namespace __sanitizer;
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
diff --git a/lib/sanitizer_common/sanitizer_thread_registry.cc b/lib/sanitizer_common/sanitizer_thread_registry.cpp
index 02691287d763..f2c6f2799315 100644
--- a/lib/sanitizer_common/sanitizer_thread_registry.cc
+++ b/lib/sanitizer_common/sanitizer_thread_registry.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_thread_registry.cc --------------------------------------===//
+//===-- sanitizer_thread_registry.cpp -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_tls_get_addr.cc b/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
index 5e33e2a514f4..9ca898a306a8 100644
--- a/lib/sanitizer_common/sanitizer_tls_get_addr.cc
+++ b/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_tls_get_addr.cc -----------------------------------------===//
+//===-- sanitizer_tls_get_addr.cpp ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_tls_get_addr.h b/lib/sanitizer_common/sanitizer_tls_get_addr.h
index cc178d3d15ae..c7cd5a8bffcf 100644
--- a/lib/sanitizer_common/sanitizer_tls_get_addr.h
+++ b/lib/sanitizer_common/sanitizer_tls_get_addr.h
@@ -42,7 +42,7 @@ struct DTLS {
uptr dtv_size;
DTV *dtv; // dtv_size elements, allocated by MmapOrDie.
- // Auxiliary fields, don't access them outside sanitizer_tls_get_addr.cc
+ // Auxiliary fields, don't access them outside sanitizer_tls_get_addr.cpp
uptr last_memalign_size;
uptr last_memalign_ptr;
};
diff --git a/lib/sanitizer_common/sanitizer_type_traits.cc b/lib/sanitizer_common/sanitizer_type_traits.cpp
index e3e431a13d44..5ee37d7376f9 100644
--- a/lib/sanitizer_common/sanitizer_type_traits.cc
+++ b/lib/sanitizer_common/sanitizer_type_traits.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_type_traits.cc --------------------------------*- C++ -*-===//
+//===-- sanitizer_type_traits.cpp -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
index 30581e848594..b2628dcc4dc1 100644
--- a/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_unwind_linux_libcdep.cc ---------------------------------===//
+//===-- sanitizer_unwind_linux_libcdep.cpp --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -27,6 +27,8 @@
namespace __sanitizer {
+namespace {
+
//---------------------------- UnwindSlow --------------------------------------
typedef struct {
@@ -46,38 +48,6 @@ release_my_map_info_list_func release_my_map_info_list;
unwind_backtrace_signal_arch_func unwind_backtrace_signal_arch;
} // extern "C"
-#if SANITIZER_ANDROID
-void SanitizerInitializeUnwinder() {
- if (AndroidGetApiLevel() >= ANDROID_LOLLIPOP_MR1) return;
-
- // Pre-lollipop Android can not unwind through signal handler frames with
- // libgcc unwinder, but it has a libcorkscrew.so library with the necessary
- // workarounds.
- void *p = dlopen("libcorkscrew.so", RTLD_LAZY);
- if (!p) {
- VReport(1,
- "Failed to open libcorkscrew.so. You may see broken stack traces "
- "in SEGV reports.");
- return;
- }
- acquire_my_map_info_list =
- (acquire_my_map_info_list_func)(uptr)dlsym(p, "acquire_my_map_info_list");
- release_my_map_info_list =
- (release_my_map_info_list_func)(uptr)dlsym(p, "release_my_map_info_list");
- unwind_backtrace_signal_arch = (unwind_backtrace_signal_arch_func)(uptr)dlsym(
- p, "unwind_backtrace_signal_arch");
- if (!acquire_my_map_info_list || !release_my_map_info_list ||
- !unwind_backtrace_signal_arch) {
- VReport(1,
- "Failed to find one of the required symbols in libcorkscrew.so. "
- "You may see broken stack traces in SEGV reports.");
- acquire_my_map_info_list = 0;
- unwind_backtrace_signal_arch = 0;
- release_my_map_info_list = 0;
- }
-}
-#endif
-
#if defined(__arm__) && !SANITIZER_NETBSD
// NetBSD uses dwarf EH
#define UNWIND_STOP _URC_END_OF_STACK
@@ -119,6 +89,40 @@ _Unwind_Reason_Code Unwind_Trace(struct _Unwind_Context *ctx, void *param) {
return UNWIND_CONTINUE;
}
+} // namespace
+
+#if SANITIZER_ANDROID
+void SanitizerInitializeUnwinder() {
+ if (AndroidGetApiLevel() >= ANDROID_LOLLIPOP_MR1) return;
+
+ // Pre-lollipop Android can not unwind through signal handler frames with
+ // libgcc unwinder, but it has a libcorkscrew.so library with the necessary
+ // workarounds.
+ void *p = dlopen("libcorkscrew.so", RTLD_LAZY);
+ if (!p) {
+ VReport(1,
+ "Failed to open libcorkscrew.so. You may see broken stack traces "
+ "in SEGV reports.");
+ return;
+ }
+ acquire_my_map_info_list =
+ (acquire_my_map_info_list_func)(uptr)dlsym(p, "acquire_my_map_info_list");
+ release_my_map_info_list =
+ (release_my_map_info_list_func)(uptr)dlsym(p, "release_my_map_info_list");
+ unwind_backtrace_signal_arch = (unwind_backtrace_signal_arch_func)(uptr)dlsym(
+ p, "unwind_backtrace_signal_arch");
+ if (!acquire_my_map_info_list || !release_my_map_info_list ||
+ !unwind_backtrace_signal_arch) {
+ VReport(1,
+ "Failed to find one of the required symbols in libcorkscrew.so. "
+ "You may see broken stack traces in SEGV reports.");
+ acquire_my_map_info_list = 0;
+ unwind_backtrace_signal_arch = 0;
+ release_my_map_info_list = 0;
+ }
+}
+#endif
+
void BufferedStackTrace::UnwindSlow(uptr pc, u32 max_depth) {
CHECK_GE(max_depth, 2);
size = 0;
diff --git a/lib/sanitizer_common/sanitizer_unwind_win.cc b/lib/sanitizer_common/sanitizer_unwind_win.cpp
index 93908ababe25..8e06940685dc 100644
--- a/lib/sanitizer_common/sanitizer_unwind_win.cc
+++ b/lib/sanitizer_common/sanitizer_unwind_win.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_unwind_win.cc -------------------------------------------===//
+//===-- sanitizer_unwind_win.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_vector.h b/lib/sanitizer_common/sanitizer_vector.h
index 4b9ae7db4c13..31216f3ec3a6 100644
--- a/lib/sanitizer_common/sanitizer_vector.h
+++ b/lib/sanitizer_common/sanitizer_vector.h
@@ -23,11 +23,7 @@ namespace __sanitizer {
template<typename T>
class Vector {
public:
- explicit Vector()
- : begin_()
- , end_()
- , last_() {
- }
+ Vector() : begin_(), end_(), last_() {}
~Vector() {
if (begin_)
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cpp
index 457cecb8cec1..36dde49d8708 100644
--- a/lib/sanitizer_common/sanitizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_win.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_win.cc --------------------------------------------------===//
+//===-- sanitizer_win.cpp -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -239,6 +239,11 @@ bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) {
return true;
}
+bool MmapFixedSuperNoReserve(uptr fixed_addr, uptr size, const char *name) {
+ // FIXME: Windows support large pages too. Might be worth checking
+ return MmapFixedNoReserve(fixed_addr, size, name);
+}
+
// Memory space mapped by 'MmapFixedOrDie' must have been reserved by
// 'MmapFixedNoAccess'.
void *MmapFixedOrDie(uptr fixed_addr, uptr size, const char *name) {
@@ -329,9 +334,8 @@ void ReleaseMemoryPagesToOS(uptr beg, uptr end) {
// FIXME: add madvise-analog when we move to 64-bits.
}
-bool NoHugePagesInRegion(uptr addr, uptr size) {
+void SetShadowRegionHugePageMode(uptr addr, uptr size) {
// FIXME: probably similar to ReleaseMemoryToOS.
- return true;
}
bool DontDumpShadowMemory(uptr addr, uptr length) {
@@ -672,7 +676,7 @@ static int RunAtexit() {
return ret;
}
-#pragma section(".CRT$XID", long, read) // NOLINT
+#pragma section(".CRT$XID", long, read)
__declspec(allocate(".CRT$XID")) int (*__run_atexit)() = RunAtexit;
#endif
@@ -941,6 +945,11 @@ bool SignalContext::IsMemoryAccess() const {
return GetWriteFlag() != SignalContext::UNKNOWN;
}
+bool SignalContext::IsTrueFaultingAddress() const {
+ // FIXME: Provide real implementation for this. See Linux and Mac variants.
+ return IsMemoryAccess();
+}
+
SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
EXCEPTION_RECORD *exception_record = (EXCEPTION_RECORD *)siginfo;
// The contents of this array are documented at
@@ -1055,7 +1064,7 @@ pid_t StartSubprocess(const char *program, const char *const argv[],
// FIXME: implement on this platform
// Should be implemented based on
// SymbolizerProcess::StarAtSymbolizerSubprocess
- // from lib/sanitizer_common/sanitizer_symbolizer_win.cc.
+ // from lib/sanitizer_common/sanitizer_symbolizer_win.cpp.
return -1;
}
diff --git a/lib/sanitizer_common/sanitizer_win_defs.h b/lib/sanitizer_common/sanitizer_win_defs.h
index bcd94a08dc44..bfe38a332367 100644
--- a/lib/sanitizer_common/sanitizer_win_defs.h
+++ b/lib/sanitizer_common/sanitizer_win_defs.h
@@ -43,6 +43,8 @@
#define STRINGIFY_(A) #A
#define STRINGIFY(A) STRINGIFY_(A)
+#if !SANITIZER_GO
+
// ----------------- A workaround for the absence of weak symbols --------------
// We don't have a direct equivalent of weak symbols when using MSVC, but we can
// use the /alternatename directive to tell the linker to default a specific
@@ -158,5 +160,15 @@
// return a >= b;
// }
//
+
+#else // SANITIZER_GO
+
+// Go neither needs nor wants weak references.
+// The shenanigans above don't work for gcc.
+# define WIN_WEAK_EXPORT_DEF(ReturnType, Name, ...) \
+ extern "C" ReturnType Name(__VA_ARGS__)
+
+#endif // SANITIZER_GO
+
#endif // SANITIZER_WINDOWS
#endif // SANITIZER_WIN_DEFS_H
diff --git a/lib/sanitizer_common/sanitizer_win_dll_thunk.cc b/lib/sanitizer_common/sanitizer_win_dll_thunk.cpp
index 5a947916de0a..1562c161a762 100644
--- a/lib/sanitizer_common/sanitizer_win_dll_thunk.cc
+++ b/lib/sanitizer_common/sanitizer_win_dll_thunk.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_win_dll_thunk.cc ----------------------------------------===//
+//===-- sanitizer_win_dll_thunk.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -54,8 +54,8 @@ int dllThunkInterceptWhenPossible(const char* main_function,
#define INTERFACE_WEAK_FUNCTION(Name) INTERCEPT_SANITIZER_WEAK_FUNCTION(Name)
#include "sanitizer_common_interface.inc"
-#pragma section(".DLLTH$A", read) // NOLINT
-#pragma section(".DLLTH$Z", read) // NOLINT
+#pragma section(".DLLTH$A", read)
+#pragma section(".DLLTH$Z", read)
typedef void (*DllThunkCB)();
extern "C" {
@@ -85,7 +85,7 @@ extern "C" int __dll_thunk_init() {
// We want to call dll_thunk_init before C/C++ initializers / constructors are
// executed, otherwise functions like memset might be invoked.
-#pragma section(".CRT$XIB", long, read) // NOLINT
+#pragma section(".CRT$XIB", long, read)
__declspec(allocate(".CRT$XIB")) int (*__dll_thunk_preinit)() =
__dll_thunk_init;
@@ -94,7 +94,7 @@ static void WINAPI dll_thunk_thread_init(void *mod, unsigned long reason,
if (reason == /*DLL_PROCESS_ATTACH=*/1) __dll_thunk_init();
}
-#pragma section(".CRT$XLAB", long, read) // NOLINT
+#pragma section(".CRT$XLAB", long, read)
__declspec(allocate(".CRT$XLAB")) void (WINAPI *__dll_thunk_tls_init)(void *,
unsigned long, void *) = dll_thunk_thread_init;
diff --git a/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc b/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cpp
index 89756f1b70af..87c032c6e61b 100644
--- a/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc
+++ b/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cpp
@@ -1,4 +1,4 @@
-//===-- santizer_win_dynamic_runtime_thunk.cc -----------------------------===//
+//===-- santizer_win_dynamic_runtime_thunk.cpp ----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/sanitizer_win_weak_interception.cc b/lib/sanitizer_common/sanitizer_win_weak_interception.cpp
index b1ac44d75ceb..b14bbf76d9a7 100644
--- a/lib/sanitizer_common/sanitizer_win_weak_interception.cc
+++ b/lib/sanitizer_common/sanitizer_win_weak_interception.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_win_weak_interception.cc --------------------------------===//
+//===-- sanitizer_win_weak_interception.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -38,6 +38,7 @@ int interceptWhenPossible(uptr dll_function, const char *real_function) {
// Declare weak hooks.
extern "C" {
+void __sanitizer_on_print(const char *str);
void __sanitizer_weak_hook_memcmp(uptr called_pc, const void *s1,
const void *s2, uptr n, int result);
void __sanitizer_weak_hook_strcmp(uptr called_pc, const char *s1,
@@ -53,8 +54,8 @@ void __sanitizer_weak_hook_strstr(uptr called_pc, const char *s1,
#define INTERFACE_WEAK_FUNCTION(Name) INTERCEPT_SANITIZER_WEAK_FUNCTION(Name)
#include "sanitizer_common_interface.inc"
-#pragma section(".WEAK$A", read) // NOLINT
-#pragma section(".WEAK$Z", read) // NOLINT
+#pragma section(".WEAK$A", read)
+#pragma section(".WEAK$Z", read)
typedef void (*InterceptCB)();
extern "C" {
@@ -77,7 +78,7 @@ static int weak_intercept_init() {
return 0;
}
-#pragma section(".CRT$XIB", long, read) // NOLINT
+#pragma section(".CRT$XIB", long, read)
__declspec(allocate(".CRT$XIB")) int (*__weak_intercept_preinit)() =
weak_intercept_init;
@@ -86,7 +87,7 @@ static void WINAPI weak_intercept_thread_init(void *mod, unsigned long reason,
if (reason == /*DLL_PROCESS_ATTACH=*/1) weak_intercept_init();
}
-#pragma section(".CRT$XLAB", long, read) // NOLINT
+#pragma section(".CRT$XLAB", long, read)
__declspec(allocate(".CRT$XLAB")) void(WINAPI *__weak_intercept_tls_init)(
void *, unsigned long, void *) = weak_intercept_thread_init;
diff --git a/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cc b/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
index 8150b7a09a0e..ba285bc1e884 100644
--- a/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cc
+++ b/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolize.cc ----------------------------------*- C++ -*-===//
+//===-- sanitizer_symbolize.cpp ---------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
//
-// Implementation of weak hooks from sanitizer_symbolizer_posix_libcdep.cc.
+// Implementation of weak hooks from sanitizer_symbolizer_posix_libcdep.cpp.
//
//===----------------------------------------------------------------------===//
diff --git a/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cc b/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp
index c85ebe5e2e29..ac351d3a8362 100644
--- a/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cc
+++ b/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp
@@ -1,4 +1,4 @@
-//===-- sanitizer_wrappers.cc -----------------------------------*- C++ -*-===//
+//===-- sanitizer_wrappers.cpp ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh b/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
index 0c3917c6b17b..be79f1df64ba 100755
--- a/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
+++ b/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
@@ -25,15 +25,25 @@
# object file with only our entry points exposed. However, this does not work at
# present, see PR30750.
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+set -x
+set -e
+set -u
+
+SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SRC_DIR=$(readlink -f $SCRIPT_DIR/..)
TARGE_DIR=$(readlink -f $1)
-
-LLVM_SRC="${LLVM_SRC:-$SCRIPT_DIR/../../../../../..}"
+COMPILER_RT_SRC=$(readlink -f ${SCRIPT_DIR}/../../../..)
+LLVM_SRC=${LLVM_SRC:-${COMPILER_RT_SRC}/../llvm}
LLVM_SRC=$(readlink -f $LLVM_SRC)
+if [[ ! -d "${LLVM_SRC}/../llvm" ]] ; then
+ LLVM_SRC=$(readlink -f ${COMPILER_RT_SRC}/../../../llvm)
+fi
+LIBCXX_SRC=$(readlink -f ${COMPILER_RT_SRC}/../libcxx)
+LIBCXXABI_SRC=$(readlink -f ${COMPILER_RT_SRC}/../libcxxabi)
-if [[ ! -d "${LLVM_SRC}/projects/libcxxabi" ||
- ! -d "${LLVM_SRC}/projects/libcxx" ]]; then
+if [[ ! -d "${LLVM_SRC}/../llvm" ||
+ ! -d "${LIBCXX_SRC}" ||
+ ! -d "${LIBCXXABI_SRC}" ]]; then
echo "Missing or incomplete LLVM_SRC"
exit 1
fi
@@ -88,8 +98,13 @@ make -j${J} libz.a
if [[ ! -d ${LIBCXX_BUILD} ]]; then
mkdir -p ${LIBCXX_BUILD}
cd ${LIBCXX_BUILD}
- LIBCXX_FLAGS="${FLAGS} -Wno-macro-redefined -I${LLVM_SRC}/projects/libcxxabi/include"
+ LIBCXX_FLAGS="${FLAGS} -Wno-macro-redefined -I${LIBCXX_SRC}/include"
+ PROJECTS=
+ if [[ ! -d $LLVM_SRC/projects/libcxxabi ]] ; then
+ PROJECTS="-DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi'"
+ fi
cmake -GNinja \
+ ${PROJECTS} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
@@ -127,7 +142,7 @@ if [[ ! -d ${LLVM_BUILD} ]]; then
$LLVM_SRC
fi
cd ${LLVM_BUILD}
-ninja LLVMSymbolize LLVMObject LLVMBinaryFormat LLVMDebugInfoDWARF LLVMSupport LLVMDebugInfoPDB LLVMMC LLVMDemangle
+ninja LLVMSymbolize LLVMObject LLVMBinaryFormat LLVMDebugInfoDWARF LLVMSupport LLVMDebugInfoPDB LLVMMC LLVMDemangle LLVMTextAPI
cd ${BUILD_DIR}
rm -rf ${SYMBOLIZER_BUILD}
@@ -135,8 +150,8 @@ mkdir ${SYMBOLIZER_BUILD}
cd ${SYMBOLIZER_BUILD}
echo "Compiling..."
-SYMBOLIZER_FLAGS="$LLVM_FLAGS -I${LLVM_SRC}/include -I${LLVM_BUILD}/include -std=c++11"
-$CXX $SYMBOLIZER_FLAGS ${SRC_DIR}/sanitizer_symbolize.cc ${SRC_DIR}/sanitizer_wrappers.cc -c
+SYMBOLIZER_FLAGS="$LLVM_FLAGS -I${LLVM_SRC}/include -I${LLVM_BUILD}/include -std=c++14"
+$CXX $SYMBOLIZER_FLAGS ${SRC_DIR}/sanitizer_symbolize.cpp ${SRC_DIR}/sanitizer_wrappers.cpp -c
$AR rc symbolizer.a sanitizer_symbolize.o sanitizer_wrappers.o
SYMBOLIZER_API_LIST=__sanitizer_symbolize_code,__sanitizer_symbolize_data,__sanitizer_symbolize_flush,__sanitizer_symbolize_demangle
@@ -152,6 +167,7 @@ $SCRIPT_DIR/ar_to_bc.sh $LIBCXX_BUILD/lib/libc++.a \
$LLVM_BUILD/lib/libLLVMDebugInfoPDB.a \
$LLVM_BUILD/lib/libLLVMDemangle.a \
$LLVM_BUILD/lib/libLLVMMC.a \
+ $LLVM_BUILD/lib/libLLVMTextAPI.a \
$ZLIB_BUILD/libz.a \
symbolizer.a \
all.bc
diff --git a/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt b/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
index 2a0f76b80ef4..fa42e2a01965 100644
--- a/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
+++ b/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
@@ -19,8 +19,13 @@ __interceptor_pthread_cond_broadcast w
__interceptor_pthread_cond_wait w
__interceptor_pthread_getspecific w
__interceptor_pthread_key_create w
+__interceptor_pthread_mutex_destroy w
+__interceptor_pthread_mutex_init w
__interceptor_pthread_mutex_lock w
__interceptor_pthread_mutex_unlock w
+__interceptor_pthread_mutexattr_destroy w
+__interceptor_pthread_mutexattr_init w
+__interceptor_pthread_mutexattr_settype w
__interceptor_pthread_once w
__interceptor_pthread_setspecific w
__interceptor_read w
@@ -70,9 +75,11 @@ getpid U
getrlimit U
gettimeofday U
ioctl U
+isalnum U
isalpha U
isatty U
islower U
+isspace U
isprint U
isupper U
isxdigit U