@@ -63,6 +63,13 @@ struct chunk_begin {
63
63
64
64
} __attribute__((packed ));
65
65
66
+ struct chunk_struct {
67
+ struct chunk_begin begin ;
68
+ char redzone [REDZONE_SIZE ];
69
+ size_t prev_size_padding ;
70
+
71
+ } __attribute__((packed ));
72
+
66
73
#ifdef USE_LIBC_ALLOC
67
74
68
75
void * (* __lq_libc_memalign )(size_t , size_t );
@@ -170,14 +177,14 @@ void *__libqasan_malloc(size_t size) {
170
177
171
178
struct chunk_begin * p = backend_memalign (
172
179
ALLOC_ALIGN_SIZE ,
173
- sizeof (struct chunk_begin ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
180
+ sizeof (struct chunk_struct ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
174
181
175
182
QASAN_SWAP (state );
176
183
177
184
if (!p ) return NULL ;
178
185
179
186
QASAN_UNPOISON (
180
- p , sizeof (struct chunk_begin ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
187
+ p , sizeof (struct chunk_struct ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
181
188
182
189
p -> requested_size = size ;
183
190
p -> aligned_orig = NULL ;
@@ -274,13 +281,13 @@ int __libqasan_posix_memalign(void **ptr, size_t align, size_t len) {
274
281
275
282
char * orig = backend_memalign (
276
283
ALLOC_ALIGN_SIZE ,
277
- sizeof (struct chunk_begin ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
284
+ sizeof (struct chunk_struct ) + qasan_align_up (size , ALLOC_ALIGN_SIZE ));
278
285
279
286
QASAN_SWAP (state );
280
287
281
288
if (!orig ) return ENOMEM ;
282
289
283
- QASAN_UNPOISON (orig , sizeof (struct chunk_begin ) +
290
+ QASAN_UNPOISON (orig , sizeof (struct chunk_struct ) +
284
291
qasan_align_up (size , ALLOC_ALIGN_SIZE ));
285
292
286
293
char * data = orig + sizeof (struct chunk_begin );
0 commit comments