summary refs log tree commit diff
path: root/malloc/mcheck.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-07-12 14:36:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-07-12 18:13:32 -0700
commit84ea6ea24bd5bef674ce16a2832dbbe4d514e6d9 (patch)
tree4481eb56c43060ed63b8f4013e20f2169d32c0fe /malloc/mcheck.c
parent72e84d1db22203e01a43268de71ea8669eca2863 (diff)
downloadglibc-84ea6ea24bd5bef674ce16a2832dbbe4d514e6d9.tar.gz
glibc-84ea6ea24bd5bef674ce16a2832dbbe4d514e6d9.tar.xz
glibc-84ea6ea24bd5bef674ce16a2832dbbe4d514e6d9.zip
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 <siddhesh@sourceware.org>
Diffstat (limited to 'malloc/mcheck.c')
-rw-r--r--malloc/mcheck.c3
1 files changed, 2 insertions, 1 deletions
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 <malloc.h>
+# include <malloc-size.h>
 # include <mcheck.h>
 # include <stdint.h>
 # include <stdio.h>
@@ -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.  */