Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ See docs/process.md for more on how version tagging works.
FS-backend handler signature changed from `poll(stream, timeout)` to
`poll(stream)` returning the current readiness mask; out-of-tree custom FS
backends with a `poll` handler must update. (#27226)
- compiler-rt was updated to LLVM 22.1.8. (#27245)

6.0.2 - 07/01/26
----------------
Expand Down
2 changes: 1 addition & 1 deletion system/lib/compiler-rt/include/profile/InstrProfData.inc
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
/* Raw profile format version (start from 1). */
#define INSTR_PROF_RAW_VERSION 10
/* Indexed profile format version (start from 1). */
#define INSTR_PROF_INDEX_VERSION 12
#define INSTR_PROF_INDEX_VERSION 13
/* Coverage mapping format version (start from 0). */
#define INSTR_PROF_COVMAP_VERSION 6

Expand Down
40 changes: 37 additions & 3 deletions system/lib/compiler-rt/include/profile/MemProfData.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@
(uint64_t)'o' << 24 | (uint64_t)'f' << 16 | (uint64_t)'r' << 8 | (uint64_t)129)

// The version number of the raw binary format.
#define MEMPROF_RAW_VERSION 4ULL
#define MEMPROF_RAW_VERSION 5ULL

// Currently supported versions.
#define MEMPROF_RAW_SUPPORTED_VERSIONS \
{ 3ULL, 4ULL }
#define MEMPROF_RAW_SUPPORTED_VERSIONS {3ULL, 4ULL, 5ULL}

#define MEMPROF_V3_MIB_SIZE 132ULL;

Expand Down Expand Up @@ -229,6 +228,41 @@ void Merge(const MemInfoBlock &newMIB) {
} __attribute__((__packed__));
#endif

constexpr int MantissaBits = 12;
constexpr int ExponentBits = 4;
constexpr uint16_t MaxMantissa = (1U << MantissaBits) - 1;
constexpr uint16_t MaxExponent = (1U << ExponentBits) - 1;
constexpr uint64_t MaxRepresentableValue = static_cast<uint64_t>(MaxMantissa)
<< MaxExponent;

// Encodes a 64-bit unsigned integer into a 16-bit scaled integer format.
inline uint16_t encodeHistogramCount(uint64_t Count) {
if (Count == 0)
return 0;

if (Count > MaxRepresentableValue)
Count = MaxRepresentableValue;

if (Count <= MaxMantissa)
return Count;

uint64_t M = Count;
uint16_t E = 0;
while (M > MaxMantissa) {
M = (M + 1) >> 1;
E++;
}
return (E << MantissaBits) | static_cast<uint16_t>(M);
}

// Decodes a 16-bit scaled integer and returns the
// decoded 64-bit unsigned integer.
inline uint64_t decodeHistogramCount(uint16_t EncodedValue) {
const uint16_t E = EncodedValue >> MantissaBits;
const uint16_t M = EncodedValue & MaxMantissa;
return static_cast<uint64_t>(M) << E;
}

} // namespace memprof
} // namespace llvm

Expand Down
8 changes: 8 additions & 0 deletions system/lib/compiler-rt/include/sanitizer/asan_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ void SANITIZER_CDECL __asan_handle_no_return(void);
/// trace. Returns 1 if successful, 0 if not.
int SANITIZER_CDECL __asan_update_allocation_context(void *addr);

/// Suppresses fake stack for the current thread.
/// Temporarily disables use-after-return detection for current thread.
void SANITIZER_CDECL __asan_suppress_fake_stack(void);

/// Unsupresses fake stack for the current thread.
/// Should be paired with a previous __asan_suppress_fake_stack() call.
void SANITIZER_CDECL __asan_unsuppress_fake_stack(void);

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
52 changes: 52 additions & 0 deletions system/lib/compiler-rt/include/sanitizer/common_interface_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,15 @@ int SANITIZER_CDECL __sanitizer_acquire_crash_state();
/// \param end End of memory region.
/// \param old_mid Old middle of memory region.
/// \param new_mid New middle of memory region.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline void SANITIZER_CDECL
__sanitizer_annotate_contiguous_container(const void *beg, const void *end,
const void *old_mid,
const void *new_mid) {}
#else
void SANITIZER_CDECL __sanitizer_annotate_contiguous_container(
const void *beg, const void *end, const void *old_mid, const void *new_mid);
#endif

/// Similar to <c>__sanitizer_annotate_contiguous_container</c>.
///
Expand Down Expand Up @@ -188,10 +195,18 @@ void SANITIZER_CDECL __sanitizer_annotate_contiguous_container(
/// \param old_container_end End of used region.
/// \param new_container_beg New beginning of used region.
/// \param new_container_end New end of used region.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline void
SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
const void *storage_beg, const void *storage_end,
const void *old_container_beg, const void *old_container_end,
const void *new_container_beg, const void *new_container_end) {}
#else
void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
const void *storage_beg, const void *storage_end,
const void *old_container_beg, const void *old_container_end,
const void *new_container_beg, const void *new_container_end);
#endif

/// Copies memory annotations from a source storage region to a destination
/// storage region. After the operation, the destination region has the same
Expand Down Expand Up @@ -226,9 +241,17 @@ void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
/// \param src_end End of the source container region.
/// \param dst_begin Begin of the destination container region.
/// \param dst_end End of the destination container region.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline void SANITIZER_CDECL
__sanitizer_copy_contiguous_container_annotations(const void *src_begin,
const void *src_end,
const void *dst_begin,
const void *dst_end) {}
#else
void SANITIZER_CDECL __sanitizer_copy_contiguous_container_annotations(
const void *src_begin, const void *src_end, const void *dst_begin,
const void *dst_end);
#endif

/// Returns true if the contiguous container <c>[beg, end)</c> is properly
/// poisoned.
Expand All @@ -246,9 +269,16 @@ void SANITIZER_CDECL __sanitizer_copy_contiguous_container_annotations(
///
/// \returns True if the contiguous container <c>[beg, end)</c> is properly
/// poisoned.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline int
SANITIZER_CDECL __sanitizer_verify_contiguous_container(const void *beg,
const void *mid,
const void *end) {}
#else
int SANITIZER_CDECL __sanitizer_verify_contiguous_container(const void *beg,
const void *mid,
const void *end);
#endif

/// Returns true if the double ended contiguous
/// container <c>[storage_beg, storage_end)</c> is properly poisoned.
Expand All @@ -271,9 +301,17 @@ int SANITIZER_CDECL __sanitizer_verify_contiguous_container(const void *beg,
/// \returns True if the double-ended contiguous container <c>[storage_beg,
/// container_beg, container_end, end)</c> is properly poisoned - only
/// [container_beg; container_end) is addressable.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline int SANITIZER_CDECL
__sanitizer_verify_double_ended_contiguous_container(const void *storage_beg,
const void *container_beg,
const void *container_end,
const void *storage_end) {}
#else
int SANITIZER_CDECL __sanitizer_verify_double_ended_contiguous_container(
const void *storage_beg, const void *container_beg,
const void *container_end, const void *storage_end);
#endif

/// Similar to <c>__sanitizer_verify_contiguous_container()</c> but also
/// returns the address of the first improperly poisoned byte.
Expand All @@ -285,8 +323,15 @@ int SANITIZER_CDECL __sanitizer_verify_double_ended_contiguous_container(
/// \param end Old end of memory region.
///
/// \returns The bad address or NULL.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline const void *SANITIZER_CDECL
__sanitizer_contiguous_container_find_bad_address(const void *beg,
const void *mid,
const void *end) {}
#else
const void *SANITIZER_CDECL __sanitizer_contiguous_container_find_bad_address(
const void *beg, const void *mid, const void *end);
#endif

/// returns the address of the first improperly poisoned byte.
///
Expand All @@ -298,10 +343,17 @@ const void *SANITIZER_CDECL __sanitizer_contiguous_container_find_bad_address(
/// \param storage_end End of memory region.
///
/// \returns The bad address or NULL.
#ifdef __SANITIZER_DISABLE_CONTAINER_OVERFLOW__
__attribute__((__internal_linkage__)) inline const void *SANITIZER_CDECL
__sanitizer_double_ended_contiguous_container_find_bad_address(
const void *storage_beg, const void *container_beg,
const void *container_end, const void *storage_end) {}
#else
const void *SANITIZER_CDECL
__sanitizer_double_ended_contiguous_container_find_bad_address(
const void *storage_beg, const void *container_beg,
const void *container_end, const void *storage_end);
#endif

/// Prints the stack trace leading to this call (useful for calling from the
/// debugger).
Expand Down
48 changes: 48 additions & 0 deletions system/lib/compiler-rt/lib/asan/asan_aix.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//===-- asan_aix.cpp ------------------------------------------------------===//
//
// 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 AddressSanitizer, an address sanity checker.
//
// AIX-specific details.
//===----------------------------------------------------------------------===//

#include "sanitizer_common/sanitizer_platform.h"

#if SANITIZER_AIX
# include "asan_mapping.h"
# include "sanitizer_common/sanitizer_internal_defs.h"

namespace __asan {

void TryReExecWithoutASLR() {
// Allowed to fail and do nothing.
}

void AsanCheckIncompatibleRT() {}

void AsanCheckDynamicRTPrereqs() {}

void InitializePlatformExceptionHandlers() {}

void* AsanDoesNotSupportStaticLinkage() { return 0; }

void InitializePlatformInterceptors() {}
void AsanApplyToGlobals(globals_op_fptr op, const void* needle) {}

uptr FindDynamicShadowStart() {
UNREACHABLE("AIX does not use dynamic shadow offset!");
return 0;
}

void FlushUnneededASanShadowMemory(uptr p, uptr size) {
ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size));
}

} // namespace __asan

#endif // SANITIZER_AIX
Loading