[NFC][sanitizer] Limit StackStore stack size/tag to 1 byte

Nothing uses more than 8bit now. So the rest of the headers can store other data.
kStackTraceMax is 256 now, but all sanitizers by default store just 20-30 frames here.
This commit is contained in:
Vitaly Buka 2021-11-23 16:52:02 -08:00
parent 402a406323
commit 6889592ebc
2 changed files with 6 additions and 6 deletions

View File

@ -16,13 +16,13 @@ namespace __sanitizer {
namespace {
struct StackTraceHeader {
static constexpr u32 kStackSizeBits = 16;
static constexpr u32 kStackSizeBits = 8;
u32 size;
u32 tag;
u8 size;
u8 tag;
explicit StackTraceHeader(const StackTrace &trace)
: size(trace.size), tag(trace.tag) {
CHECK_LT(trace.size, 1 << kStackSizeBits);
: size(Min<uptr>(trace.size, (1u << 8) - 1)), tag(trace.tag) {
CHECK_EQ(trace.tag, static_cast<uptr>(tag));
}
explicit StackTraceHeader(uptr h)
: size(h & ((1 << kStackSizeBits) - 1)), tag(h >> kStackSizeBits) {}

View File

@ -20,7 +20,7 @@ namespace __sanitizer {
struct BufferedStackTrace;
static const u32 kStackTraceMax = 256;
static const u32 kStackTraceMax = 255;
#if SANITIZER_LINUX && defined(__mips__)
# define SANITIZER_CAN_FAST_UNWIND 0