[PATCH] D137292: [lsan] Fix stack buffer overwrite in SuspendedThreadsListMac::GetRegistersAndSP

Usama Hameed via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:45:41 PST 2022


usama54321 added a comment.

Added a minor comment below. Apart from that looks good to me



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp:152
   int err;
-  mach_msg_type_number_t reg_count = MACHINE_THREAD_STATE_COUNT;
-  err = thread_get_state(thread, MACHINE_THREAD_STATE, (thread_state_t)&regs,
+  mach_msg_type_number_t reg_count = sizeof(regs) / sizeof(natural_t);
+  err = thread_get_state(thread, regs_flavor, (thread_state_t)&regs,
----------------
I will just suggest using the corresponding macros for reg count, e.g. ARM_THREAD_STATE64_COUNT etc. from the headers rather the inlining the calculation. Apart from that looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137292/new/

https://reviews.llvm.org/D137292



More information about the llvm-commits mailing list