From 84ea6ea24bd5bef674ce16a2832dbbe4d514e6d9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 12 Jul 2021 14:36:39 -0700 Subject: mcheck: Align struct hdr to MALLOC_ALIGNMENT bytes [BZ #28068] 1. Align struct hdr to MALLOC_ALIGNMENT bytes so that malloc hooks in libmcheck align memory to MALLOC_ALIGNMENT bytes. 2. Remove tst-mallocalign1 from tests-exclude-mcheck for i386 and x32. 3. Add tst-pvalloc-fortify and tst-reallocarray to tests-exclude-mcheck since they use malloc_usable_size (see BZ #22057). This fixed BZ #28068. Reviewed-by: Siddhesh Poyarekar --- malloc/Makefile | 4 +++- malloc/mcheck.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'malloc') diff --git a/malloc/Makefile b/malloc/Makefile index b685ed6d61..47369b6084 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -95,7 +95,9 @@ tests-exclude-mcheck = tst-mallocstate \ tst-malloc_info \ tst-memalign \ tst-posix_memalign \ - tst-realloc + tst-realloc \ + tst-pvalloc-fortify \ + tst-reallocarray tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests)) diff --git a/malloc/mcheck.c b/malloc/mcheck.c index 2a1fc645d4..d2efcfb742 100644 --- a/malloc/mcheck.c +++ b/malloc/mcheck.c @@ -20,6 +20,7 @@ #ifndef _MALLOC_INTERNAL # define _MALLOC_INTERNAL # include +# include # include # include # include @@ -53,7 +54,7 @@ struct hdr struct hdr *next; void *block; /* Real block allocated, for memalign. */ unsigned long int magic2; /* Extra, keeps us doubleword aligned. */ -}; +} __attribute__ ((aligned (MALLOC_ALIGNMENT))); /* This is the beginning of the list of all memory blocks allocated. It is only constructed if the pedantic testing is requested. */ -- cgit v1.2.1