Skip to content

Commit ba0da51

Browse files
authored
QASan: remove chunk_struct (#2899)
1 parent b320a8d commit ba0da51

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

libafl_qemu/libqasan/malloc.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ struct chunk_begin {
6363

6464
} __attribute__((packed));
6565

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-
7366
#ifdef USE_LIBC_ALLOC
7467

7568
void *(*__lq_libc_memalign)(size_t, size_t);
@@ -177,14 +170,14 @@ void *__libqasan_malloc(size_t size) {
177170

178171
struct chunk_begin *p = backend_memalign(
179172
ALLOC_ALIGN_SIZE,
180-
sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
173+
sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
181174

182175
QASAN_SWAP(state);
183176

184177
if (!p) return NULL;
185178

186179
QASAN_UNPOISON(
187-
p, sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
180+
p, sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
188181

189182
p->requested_size = size;
190183
p->aligned_orig = NULL;
@@ -281,13 +274,13 @@ int __libqasan_posix_memalign(void **ptr, size_t align, size_t len) {
281274

282275
char *orig = backend_memalign(
283276
ALLOC_ALIGN_SIZE,
284-
sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
277+
sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
285278

286279
QASAN_SWAP(state);
287280

288281
if (!orig) return ENOMEM;
289282

290-
QASAN_UNPOISON(orig, sizeof(struct chunk_struct) +
283+
QASAN_UNPOISON(orig, sizeof(struct chunk_begin) +
291284
qasan_align_up(size, ALLOC_ALIGN_SIZE));
292285

293286
char *data = orig + sizeof(struct chunk_begin);

0 commit comments

Comments
 (0)