QASan: remove chunk_struct (#2899)

This commit is contained in:
Romain Malmain 2025-01-28 01:46:09 +01:00 committed by GitHub
parent b320a8dbab
commit ba0da5121b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,13 +63,6 @@ struct chunk_begin {
} __attribute__((packed));
struct chunk_struct {
struct chunk_begin begin;
char redzone[REDZONE_SIZE];
size_t prev_size_padding;
} __attribute__((packed));
#ifdef USE_LIBC_ALLOC
void *(*__lq_libc_memalign)(size_t, size_t);
@ -177,14 +170,14 @@ void *__libqasan_malloc(size_t size) {
struct chunk_begin *p = backend_memalign(
ALLOC_ALIGN_SIZE,
sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
QASAN_SWAP(state);
if (!p) return NULL;
QASAN_UNPOISON(
p, sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
p, sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
p->requested_size = size;
p->aligned_orig = NULL;
@ -281,13 +274,13 @@ int __libqasan_posix_memalign(void **ptr, size_t align, size_t len) {
char *orig = backend_memalign(
ALLOC_ALIGN_SIZE,
sizeof(struct chunk_struct) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
sizeof(struct chunk_begin) + qasan_align_up(size, ALLOC_ALIGN_SIZE));
QASAN_SWAP(state);
if (!orig) return ENOMEM;
QASAN_UNPOISON(orig, sizeof(struct chunk_struct) +
QASAN_UNPOISON(orig, sizeof(struct chunk_begin) +
qasan_align_up(size, ALLOC_ALIGN_SIZE));
char *data = orig + sizeof(struct chunk_begin);