Skip to content

Commit 332d076

Browse files
authored
Update compiler-rt to LLVM 14 (#16991)
1 parent d5ef693 commit 332d076

File tree

191 files changed

+7755
-4677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+7755
-4677
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ See docs/process.md for more on how version tagging works.
2626
wide under `wasm64`. (#16938)
2727
- The `EM_BUILD_VERBOSE` environment variable only effects test code these days
2828
and therefore was renamed to `EMTEST_BUILD_VERBOSE`. (#16904)
29+
- compiler-rt code updated to LLVM 14. (#16991)
2930

3031
3.1.10 - 05/02/2022
3132
-------------------

system/lib/compiler-rt/include/sanitizer/asan_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
316316
void __asan_handle_no_return(void);
317317

318318
/// Update allocation stack trace for the given allocation to the current stack
319-
/// trace. Returns 1 if successfull, 0 if not.
319+
/// trace. Returns 1 if successful, 0 if not.
320320
int __asan_update_allocation_context(void* addr);
321321

322322
#ifdef __cplusplus

system/lib/compiler-rt/include/sanitizer/common_interface_defs.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef struct {
2828
// Enable sandbox support in sanitizer coverage.
2929
int coverage_sandboxed;
3030
// File descriptor to write coverage data to. If -1 is passed, a file will
31-
// be pre-opened by __sanitizer_sandobx_on_notify(). This field has no
31+
// be pre-opened by __sanitizer_sandbox_on_notify(). This field has no
3232
// effect if coverage_sandboxed == 0.
3333
intptr_t coverage_fd;
3434
// If non-zero, split the coverage data into well-formed blocks. This is
@@ -211,6 +211,15 @@ void __sanitizer_symbolize_pc(void *pc, const char *fmt, char *out_buf,
211211
// Same as __sanitizer_symbolize_pc, but for data section (i.e. globals).
212212
void __sanitizer_symbolize_global(void *data_ptr, const char *fmt,
213213
char *out_buf, size_t out_buf_size);
214+
// Determine the return address.
215+
#if !defined(_MSC_VER) || defined(__clang__)
216+
#define __sanitizer_return_address() \
217+
__builtin_extract_return_addr(__builtin_return_address(0))
218+
#else
219+
extern "C" void *_ReturnAddress(void);
220+
#pragma intrinsic(_ReturnAddress)
221+
#define __sanitizer_return_address() _ReturnAddress()
222+
#endif
214223

215224
/// Sets the callback to be called immediately before death on error.
216225
///

system/lib/compiler-rt/include/sanitizer/dfsan_interface.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ typedef uint32_t dfsan_origin;
2727
/// Signature of the callback argument to dfsan_set_write_callback().
2828
typedef void (*dfsan_write_callback_t)(int fd, const void *buf, size_t count);
2929

30+
/// Signature of the callback argument to dfsan_set_conditional_callback().
31+
typedef void (*dfsan_conditional_callback_t)(dfsan_label label,
32+
dfsan_origin origin);
33+
3034
/// Computes the union of \c l1 and \c l2, resulting in a union label.
3135
dfsan_label dfsan_union(dfsan_label l1, dfsan_label l2);
3236

@@ -54,6 +58,10 @@ dfsan_origin dfsan_get_origin(long data);
5458
/// Retrieves the label associated with the data at the given address.
5559
dfsan_label dfsan_read_label(const void *addr, size_t size);
5660

61+
/// Return the origin associated with the first taint byte in the size bytes
62+
/// from the address addr.
63+
dfsan_origin dfsan_read_origin_of_first_taint(const void *addr, size_t size);
64+
5765
/// Returns whether the given label label contains the label elem.
5866
int dfsan_has_label(dfsan_label label, dfsan_label elem);
5967

@@ -70,6 +78,19 @@ void dfsan_flush(void);
7078
/// callback executes. Pass in NULL to remove any callback.
7179
void dfsan_set_write_callback(dfsan_write_callback_t labeled_write_callback);
7280

81+
/// Sets a callback to be invoked on any conditional expressions which have a
82+
/// taint label set. This can be used to find where tainted data influences
83+
/// the behavior of the program.
84+
/// These callbacks will only be added when -dfsan-conditional-callbacks=true.
85+
void dfsan_set_conditional_callback(dfsan_conditional_callback_t callback);
86+
87+
/// Conditional expressions occur during signal handlers.
88+
/// Making callbacks that handle signals well is tricky, so when
89+
/// -dfsan-conditional-callbacks=true, conditional expressions used in signal
90+
/// handlers will add the labels they see into a global (bitwise-or together).
91+
/// This function returns all label bits seen in signal handler conditions.
92+
dfsan_label dfsan_get_labels_in_signal_conditional();
93+
7394
/// Interceptor hooks.
7495
/// Whenever a dfsan's custom function is called the corresponding
7596
/// hook is called it non-zero. The hooks should be defined by the user.
@@ -87,6 +108,9 @@ void dfsan_weak_hook_strncmp(void *caller_pc, const char *s1, const char *s2,
87108
/// prints description at the beginning of the trace. If origin tracking is not
88109
/// on, or the address is not labeled, it prints nothing.
89110
void dfsan_print_origin_trace(const void *addr, const char *description);
111+
/// As above, but use an origin id from dfsan_get_origin() instead of address.
112+
/// Does not include header line with taint label and address information.
113+
void dfsan_print_origin_id_trace(dfsan_origin origin);
90114

91115
/// Prints the origin trace of the label at the address \p addr to a
92116
/// pre-allocated output buffer. If origin tracking is not on, or the address is
@@ -124,6 +148,10 @@ void dfsan_print_origin_trace(const void *addr, const char *description);
124148
/// return value is not less than \p out_buf_size.
125149
size_t dfsan_sprint_origin_trace(const void *addr, const char *description,
126150
char *out_buf, size_t out_buf_size);
151+
/// As above, but use an origin id from dfsan_get_origin() instead of address.
152+
/// Does not include header line with taint label and address information.
153+
size_t dfsan_sprint_origin_id_trace(dfsan_origin origin, char *out_buf,
154+
size_t out_buf_size);
127155

128156
/// Prints the stack trace leading to this call to a pre-allocated output
129157
/// buffer.
@@ -150,8 +178,7 @@ int dfsan_get_track_origins(void);
150178
#ifdef __cplusplus
151179
} // extern "C"
152180

153-
template <typename T>
154-
void dfsan_set_label(dfsan_label label, T &data) { // NOLINT
181+
template <typename T> void dfsan_set_label(dfsan_label label, T &data) {
155182
dfsan_set_label(label, (void *)&data, sizeof(T));
156183
}
157184

0 commit comments

Comments
 (0)