This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 2/7] malloc: Additional checks for unsorted bin integrity I.
- From: Florian Weimer <fweimer at redhat dot com>
- To: Istvan Kurucsai <pistukem at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 20 Aug 2018 14:59:32 +0200
- Subject: Re: [PATCH v2 2/7] malloc: Additional checks for unsorted bin integrity I.
- References: <1510068430-27816-1-git-send-email-pistukem@gmail.com> <1510068430-27816-3-git-send-email-pistukem@gmail.com> <5ccf43e6-88b4-4863-69a3-2971ccd640e2@redhat.com> <CAHJ3J3nW_CDjizW1JKMH=349KGfZxAKcdBmjKp1d1VN4RnOCMA@mail.gmail.com> <9df0b3e0-20bb-5680-3b1e-cd526b76c160@redhat.com>
On 08/17/2018 04:07 PM, Florian Weimer wrote:
On 01/16/2018 02:54 PM, Istvan Kurucsai wrote:
+ if (__glibc_unlikely ((prev_size (next) & ~(SIZE_BITS)) !=
size))
+ malloc_printerr ("malloc(): mismatching next->prev_size
(unsorted)");
Is the masking required? I think prev_size is stored without the bits.
+ if (__glibc_unlikely (bck->fd != victim)
+ || __glibc_unlikely (victim->fd != unsorted_chunks (av)))
+ malloc_printerr ("malloc(): unsorted double linked list
corrupted");
+ if (__glibc_unlikely (prev_inuse(next)))
+ malloc_printerr ("malloc(): invalid next->prev_inuse
(unsorted)");
Space missing after prev_inuse.
Otherwise, this looks okay.
I accidentally pushed this without a ChangeLog entry. Fixed with the
attached patch. Sorry about that.
Florian
>From 35cfefd96062145eeb8aee6bd72d07e0909a6b2e Mon Sep 17 00:00:00 2001
Message-Id: <35cfefd96062145eeb8aee6bd72d07e0909a6b2e.1534769912.git.fweimer@redhat.com>
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 20 Aug 2018 14:57:13 +0200
Subject: [PATCH] malloc: Add ChangeLog for accidentally committed change
To: libc-alpha@sourceware.org
Commit b90ddd08f6dd688e651df9ee89ca3a69ff88cd0c ("malloc: Additional
checks for unsorted bin integrity I.") was committed without a
whitespace fix, so it is adjusted here as well.
---
ChangeLog | 4 ++++
malloc/malloc.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index deb099483f..56ab51d1b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,10 @@
* sysdeps/s390/fpu/libm-test-ulps: Regenerate.
+2018-08-17 Istvan Kurucsai <pistukem@gmail.com>
+
+ * malloc/malloc.c (_int_malloc): Additional binning code checks.
+
2018-08-16 Florian Weimer <fweimer@redhat.com>
* configure.ac: Add --with-nonshared-cflags option.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 47795601c8..67cdfd0ad2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3730,7 +3730,7 @@ _int_malloc (mstate av, size_t bytes)
if (__glibc_unlikely (bck->fd != victim)
|| __glibc_unlikely (victim->fd != unsorted_chunks (av)))
malloc_printerr ("malloc(): unsorted double linked list corrupted");
- if (__glibc_unlikely (prev_inuse(next)))
+ if (__glibc_unlikely (prev_inuse (next)))
malloc_printerr ("malloc(): invalid next->prev_inuse (unsorted)");
/*
--
2.14.4