@@ -73,13 +73,13 @@ static const uptr kAllocBegMagic = 0xCC6E96B9;
73
73
struct ChunkHeader {
74
74
// 1-st 8 bytes.
75
75
atomic_uint8_t chunk_state;
76
- u32 alloc_tid : 24 ;
76
+ u32 alloc_tid : 24 ;
77
77
78
- u32 free_tid : 24 ;
79
- u32 from_memalign : 1 ;
80
- u32 alloc_type : 2 ;
81
- u32 rz_log : 3 ;
82
- u32 lsan_tag : 2 ;
78
+ u32 free_tid : 24 ;
79
+ u32 from_memalign : 1 ;
80
+ u32 alloc_type : 2 ;
81
+ u32 rz_log : 3 ;
82
+ u32 lsan_tag : 2 ;
83
83
// 2-nd 8 bytes
84
84
// This field is used for small sizes. For large sizes it is equal to
85
85
// SizeClassMap::kMaxSize and the actual size is stored in the
@@ -109,7 +109,7 @@ enum {
109
109
// The chunk is allocated and not yet freed.
110
110
CHUNK_ALLOCATED = 2 ,
111
111
// The chunk was freed and put into quarantine zone.
112
- CHUNK_QUARANTINE = 3
112
+ CHUNK_QUARANTINE = 3 ,
113
113
};
114
114
115
115
struct AsanChunk : ChunkBase {
@@ -118,7 +118,7 @@ struct AsanChunk: ChunkBase {
118
118
if (user_requested_size != SizeClassMap::kMaxSize )
119
119
return user_requested_size;
120
120
return *reinterpret_cast <uptr *>(
121
- get_allocator ().GetMetaData (AllocBeg (locked_version)));
121
+ get_allocator ().GetMetaData (AllocBeg (locked_version)));
122
122
}
123
123
void *AllocBeg (bool locked_version = false ) {
124
124
if (from_memalign) {
@@ -519,7 +519,7 @@ struct Allocator {
519
519
m->free_tid = kInvalidTid ;
520
520
m->from_memalign = user_beg != beg_plus_redzone;
521
521
if (alloc_beg != chunk_beg) {
522
- CHECK_LE (alloc_beg+ 2 * sizeof (uptr), chunk_beg);
522
+ CHECK_LE (alloc_beg + 2 * sizeof (uptr), chunk_beg);
523
523
reinterpret_cast <uptr *>(alloc_beg)[0 ] = kAllocBegMagic ;
524
524
reinterpret_cast <uptr *>(alloc_beg)[1 ] = chunk_beg;
525
525
}
@@ -735,7 +735,8 @@ struct Allocator {
735
735
736
736
// Assumes alloc_beg == allocator.GetBlockBegin(alloc_beg).
737
737
AsanChunk *GetAsanChunk (void *alloc_beg) {
738
- if (!alloc_beg) return nullptr ;
738
+ if (!alloc_beg)
739
+ return nullptr ;
739
740
if (!allocator.FromPrimary (alloc_beg)) {
740
741
uptr *meta = reinterpret_cast <uptr *>(allocator.GetMetaData (alloc_beg));
741
742
AsanChunk *m = reinterpret_cast <AsanChunk *>(meta[1 ]);
@@ -751,11 +752,13 @@ struct Allocator {
751
752
}
752
753
753
754
AsanChunk *GetAsanChunkDebug (void *alloc_beg) {
754
- if (!alloc_beg) return nullptr ;
755
+ if (!alloc_beg)
756
+ return nullptr ;
755
757
if (!allocator.FromPrimary (alloc_beg)) {
756
758
uptr *meta = reinterpret_cast <uptr *>(allocator.GetMetaData (alloc_beg));
757
759
AsanChunk *m = reinterpret_cast <AsanChunk *>(meta[1 ]);
758
- Printf (" GetAsanChunkDebug1 alloc_beg %p meta %p m %p\n " , alloc_beg, meta, m);
760
+ Printf (" GetAsanChunkDebug1 alloc_beg %p meta %p m %p\n " , alloc_beg, meta,
761
+ m);
759
762
return m;
760
763
}
761
764
uptr *alloc_magic = reinterpret_cast <uptr *>(alloc_beg);
@@ -768,7 +771,6 @@ struct Allocator {
768
771
return reinterpret_cast <AsanChunk *>(alloc_beg);
769
772
}
770
773
771
-
772
774
AsanChunk *GetAsanChunkByAddr (uptr p) {
773
775
void *alloc_beg = allocator.GetBlockBegin (reinterpret_cast <void *>(p));
774
776
return GetAsanChunk (alloc_beg);
@@ -784,7 +786,8 @@ struct Allocator {
784
786
AsanChunk *GetAsanChunkByAddrFastLockedDebug (uptr p) {
785
787
void *alloc_beg =
786
788
allocator.GetBlockBeginFastLockedDebug (reinterpret_cast <void *>(p));
787
- Printf (" GetAsanChunkByAddrFastLockedDebug p %p alloc_beg %p\n " , p, alloc_beg);
789
+ Printf (" GetAsanChunkByAddrFastLockedDebug p %p alloc_beg %p\n " , p,
790
+ alloc_beg);
788
791
return GetAsanChunkDebug (alloc_beg);
789
792
}
790
793
@@ -1055,7 +1058,7 @@ void AsanSoftRssLimitExceededCallback(bool limit_exceeded) {
1055
1058
instance.SetRssLimitExceeded (limit_exceeded);
1056
1059
}
1057
1060
1058
- } // namespace __asan
1061
+ } // namespace __asan
1059
1062
1060
1063
// --- Implementation of LSan-specific functions --- {{{1
1061
1064
namespace __lsan {
@@ -1092,7 +1095,8 @@ extern "C" SANITIZER_WEAK_ATTRIBUTE const char *__lsan_current_stage;
1092
1095
1093
1096
void GetUserBeginDebug (uptr chunk) {
1094
1097
Printf (" GetUserBeginDebug1 chunk %p\n " , chunk);
1095
- __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddrFastLockedDebug (chunk);
1098
+ __asan::AsanChunk *m =
1099
+ __asan::instance.GetAsanChunkByAddrFastLockedDebug (chunk);
1096
1100
Printf (" GetUserBeginDebug2 m %p\n " , m);
1097
1101
}
1098
1102
0 commit comments