public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Istvan Kurucsai <pistukem@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2 2/7] malloc: Additional checks for unsorted bin integrity I.
Date: Mon, 20 Aug 2018 12:59:00 -0000	[thread overview]
Message-ID: <36f9ab9c-c265-666e-1a64-b435a4cfdc41@redhat.com> (raw)
In-Reply-To: <9df0b3e0-20bb-5680-3b1e-cd526b76c160@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

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

[-- Attachment #2: 0001-malloc-Add-ChangeLog-for-accidentally-committed-chan.patch --]
[-- Type: text/x-patch, Size: 1638 bytes --]

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


  reply	other threads:[~2018-08-20 12:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 15:27 [PATCH v2 0/7] Additional integrity checks for the malloc Istvan Kurucsai
2017-11-07 15:27 ` [PATCH v2 7/7] malloc: Check the alignment of mmapped chunks before unmapping Istvan Kurucsai
2018-11-15 23:58   ` DJ Delorie
2018-11-16 10:35     ` Florian Weimer
2018-12-21  6:33       ` DJ Delorie
2017-11-07 15:27 ` [PATCH v2 5/7] malloc: Verify the integrity of mmapped chunks in calloc Istvan Kurucsai
2018-08-17 14:15   ` Florian Weimer
2018-11-16 10:33     ` Florian Weimer
2017-11-07 15:27 ` [PATCH v2 3/7] malloc: Ensure that the consolidated fast chunk has a sane size Istvan Kurucsai
2018-01-12 14:29   ` Florian Weimer
2017-11-07 15:27 ` [PATCH v2 1/7] malloc: Add check for top size corruption Istvan Kurucsai
2017-11-07 15:53   ` Andreas Schwab
2018-01-11 12:05   ` Florian Weimer
2018-01-16 12:05     ` Istvan Kurucsai
2018-02-20 13:49       ` Florian Weimer
2018-08-17 14:08         ` Florian Weimer
2017-11-07 15:27 ` [PATCH v2 2/7] malloc: Additional checks for unsorted bin integrity I Istvan Kurucsai
2018-01-11 14:50   ` Florian Weimer
2018-01-16 13:54     ` Istvan Kurucsai
2018-08-17 14:07       ` Florian Weimer
2018-08-20 12:59         ` Florian Weimer [this message]
2017-11-07 15:27 ` [PATCH v2 4/7] malloc: Ensure lower bound on chunk size in __libc_realloc Istvan Kurucsai
2018-08-17 14:12   ` Florian Weimer
2018-08-20 21:20     ` DJ Delorie
2018-08-21  0:07       ` Carlos O'Donell
2018-08-21  0:17         ` DJ Delorie
2018-08-21  0:40           ` Carlos O'Donell
2017-11-07 15:27 ` [PATCH v2 6/7] malloc: Add more integrity checks to mremap_chunk Istvan Kurucsai
2018-11-15 23:55   ` DJ Delorie
2018-11-16 10:32     ` Florian Weimer
2018-12-21  6:32       ` DJ Delorie
2017-11-16  4:18 ` [PATCH v2 0/7] Additional integrity checks for the malloc DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36f9ab9c-c265-666e-1a64-b435a4cfdc41@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=pistukem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).