asan: don't use thread user_id
asan does not use user_id for anything, so don't pass it to ThreadCreate. Passing a random uninitialized field of AsanThread as user_id does not make much sense anyway. Depends on D113921. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D113922
This commit is contained in:
parent
d1f72f02d0
commit
bdabf3c38a
|
|
@ -118,14 +118,12 @@ struct AsanThread::InitOptions {
|
|||
|
||||
// Shared setup between thread creation and startup for the initial thread.
|
||||
static AsanThread *CreateAsanThread(StackTrace *stack, u32 parent_tid,
|
||||
uptr user_id, bool detached,
|
||||
const char *name) {
|
||||
bool detached, const char *name) {
|
||||
// In lieu of AsanThread::Create.
|
||||
AsanThread *thread = (AsanThread *)MmapOrDie(AsanThreadMmapSize(), __func__);
|
||||
|
||||
AsanThreadContext::CreateThreadContextArgs args = {thread, stack};
|
||||
u32 tid =
|
||||
asanThreadRegistry().CreateThread(user_id, detached, parent_tid, &args);
|
||||
u32 tid = asanThreadRegistry().CreateThread(0, detached, parent_tid, &args);
|
||||
asanThreadRegistry().SetThreadName(tid, name);
|
||||
|
||||
return thread;
|
||||
|
|
@ -147,12 +145,11 @@ void AsanThread::SetThreadStackAndTls(const AsanThread::InitOptions *options) {
|
|||
|
||||
// Called by __asan::AsanInitInternal (asan_rtl.c).
|
||||
AsanThread *CreateMainThread() {
|
||||
thrd_t self = thrd_current();
|
||||
char name[ZX_MAX_NAME_LEN];
|
||||
CHECK_NE(__sanitizer::MainThreadStackBase, 0);
|
||||
CHECK_GT(__sanitizer::MainThreadStackSize, 0);
|
||||
AsanThread *t = CreateAsanThread(
|
||||
nullptr, 0, reinterpret_cast<uptr>(self), true,
|
||||
nullptr, 0, true,
|
||||
_zx_object_get_property(thrd_get_zx_handle(self), ZX_PROP_NAME, name,
|
||||
sizeof(name)) == ZX_OK
|
||||
? name
|
||||
|
|
@ -182,8 +179,7 @@ static void *BeforeThreadCreateHook(uptr user_id, bool detached,
|
|||
GET_STACK_TRACE_THREAD;
|
||||
u32 parent_tid = GetCurrentTidOrInvalid();
|
||||
|
||||
AsanThread *thread =
|
||||
CreateAsanThread(&stack, parent_tid, user_id, detached, name);
|
||||
AsanThread *thread = CreateAsanThread(&stack, parent_tid, detached, name);
|
||||
|
||||
// On other systems, AsanThread::Init() is called from the new
|
||||
// thread itself. But on Fuchsia we already know the stack address
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ AsanThread *AsanThread::Create(thread_callback_t start_routine, void *arg,
|
|||
thread->start_routine_ = start_routine;
|
||||
thread->arg_ = arg;
|
||||
AsanThreadContext::CreateThreadContextArgs args = {thread, stack};
|
||||
asanThreadRegistry().CreateThread(*reinterpret_cast<uptr *>(thread), detached,
|
||||
parent_tid, &args);
|
||||
asanThreadRegistry().CreateThread(0, detached, parent_tid, &args);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue