Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LLDB introspection entrypoints from the shim #68450

Merged
merged 1 commit into from
Oct 9, 2023
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
18 changes: 0 additions & 18 deletions compiler-rt/lib/asan_abi/asan_abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,4 @@ void *__asan_abi_stack_malloc_always_n(size_t scale, size_t size) {

// Functions concerning fake stack free
void __asan_abi_stack_free_n(int scale, void *p, size_t n) {}

// Functions concerning introspection (including lldb support)
void *__asan_abi_get_alloc_stack(void *addr, void **trace, size_t size,
int *thread_id) {
return NULL;
}
void __asan_abi_report_error(void *pc, void *bp, void *sp, void *addr,
bool is_write, size_t access_size, int exp) {}
void __asan_abi_set_error_report_callback(void (*callback)(const char *)) {}
void __asan_abi_describe_address(void *addr) {}
bool __asan_abi_report_present(void) { return false; }
void *__asan_abi_get_report_pc(void) { return NULL; }
void *__asan_abi_get_report_bp(void) { return NULL; }
void *__asan_abi_get_report_sp(void) { return NULL; }
void *__asan_abi_get_report_address(void) { return NULL; }
int __asan_abi_get_report_access_type(void) { return 0; }
size_t __asan_abi_get_report_access_size(void) { return 0; }
const char *__asan_abi_get_report_description(void) { return NULL; }
}
16 changes: 0 additions & 16 deletions compiler-rt/lib/asan_abi/asan_abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,5 @@ void *__asan_abi_stack_malloc_always_n(size_t scale, size_t size);
// Functions concerning fake stack free
void __asan_abi_stack_free_n(int scale, void *p, size_t n);

// Functions concerning introspection (including lldb support)
void *__asan_abi_get_alloc_stack(void *addr, void **trace, size_t size,
int *thread_id);
void __asan_abi_report_error(void *pc, void *bp, void *sp, void *addr,
bool is_write, size_t access_size, int exp);
void __asan_abi_set_error_report_callback(void (*callback)(const char *));
void __asan_abi_describe_address(void *addr);
bool __asan_abi_report_present(void);
void *__asan_abi_get_report_pc(void);
void *__asan_abi_get_report_bp(void);
void *__asan_abi_get_report_sp(void);
void *__asan_abi_get_report_address(void);
int __asan_abi_get_report_access_type(void);
size_t __asan_abi_get_report_access_size(void);
const char *__asan_abi_get_report_description(void);

__END_DECLS
#endif // ASAN_ABI_H
33 changes: 0 additions & 33 deletions compiler-rt/lib/asan_abi/asan_abi_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,37 +478,4 @@ void __asan_stack_free_9(uptr ptr, uptr size) {
void __asan_stack_free_10(uptr ptr, uptr size) {
__asan_abi_stack_free_n(10, (void *)ptr, size);
}

// Functions concerning introspection (including lldb support)
uptr __asan_get_alloc_stack(uptr addr, uptr *trace, uptr size, u32 *thread_id) {
return (uptr)__asan_abi_get_alloc_stack((void *)addr, (void **)trace,
(size_t)size, (int *)thread_id);
}
void __asan_report_error(uptr pc, uptr bp, uptr sp, uptr addr, int is_write,
uptr access_size, u32 exp) {
__asan_abi_report_error((void *)pc, (void *)bp, (void *)sp, (void *)addr,
(bool)is_write, (size_t)access_size, (int)exp);
}
void __asan_set_error_report_callback(void (*callback)(const char *)) {
__asan_abi_set_error_report_callback(callback);
}
void __asan_describe_address(uptr addr) {
__asan_abi_describe_address((void *)addr);
}
int __asan_report_present(void) { return __asan_abi_report_present(); }
uptr __asan_get_report_pc(void) { return (uptr)__asan_abi_get_report_pc(); }
uptr __asan_get_report_bp(void) { return (uptr)__asan_abi_get_report_bp(); }
uptr __asan_get_report_sp(void) { return (uptr)__asan_abi_get_report_sp(); }
uptr __asan_get_report_address(void) {
return (uptr)__asan_abi_get_report_address();
}
int __asan_get_report_access_type(void) {
return __asan_abi_get_report_access_type();
}
uptr __asan_get_report_access_size(void) {
return (uptr)__asan_abi_get_report_access_size();
}
const char *__asan_get_report_description(void) {
return __asan_abi_get_report_description();
}
}
12 changes: 12 additions & 0 deletions compiler-rt/lib/asan_abi/asan_abi_tbd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ __asan_on_error
__asan_print_accumulated_stats
__asan_set_death_callback
__asan_update_allocation_context
__asan_describe_address
__asan_get_alloc_stack
__asan_get_report_access_size
__asan_get_report_access_type
__asan_get_report_address
__asan_get_report_bp
__asan_get_report_description
__asan_get_report_pc
__asan_get_report_sp
__asan_report_error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we call __asan_report_error from the instrumented program. @rsundahl Can you please verify this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a "text-based stub library (.tbd)" file or just a "to be defined", list of symbols we need to figure out what to do with?
If it's the former, what/where is this consumed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of above is the list of entrypoints that are required by the llvm instrumentation to be provided by the runtime. The test looking for the symbols is: AddressSanitizerABI-arm64-darwin :: TestCases/Darwin/llvm_interface_symbols.cpp. It is likely true that __asan_report_error may not be used by us @usama54321, but it seems to be used by Linux and Windows platforms but it looks like the test is making an unqualified requirements of all platforms that the runtime includes the symbols that it does.

__asan_report_present
__asan_set_error_report_callback