Blame SOURCES/glibc-rh1447556.patch
|
|
51f0aa |
From 17f487b7afa7cd6c316040f3e6c86dc96b2eec30 Mon Sep 17 00:00:00 2001
|
|
|
51f0aa |
From: DJ Delorie <dj@delorie.com>
|
|
|
51f0aa |
Date: Fri, 17 Mar 2017 15:31:38 -0400
|
|
|
51f0aa |
Subject: [PATCH] Further harden glibc malloc metadata against 1-byte
|
|
|
51f0aa |
overflows.
|
|
|
51f0aa |
|
|
|
51f0aa |
Additional check for chunk_size == next->prev->chunk_size in unlink()
|
|
|
51f0aa |
|
|
|
51f0aa |
2017-03-17 Chris Evans <scarybeasts@gmail.com>
|
|
|
51f0aa |
|
|
|
51f0aa |
* malloc/malloc.c (unlink): Add consistency check between size and
|
|
|
51f0aa |
next->prev->size, to further harden against 1-byte overflows.
|
|
|
51f0aa |
|
|
|
51f0aa |
diff -rup a/malloc/malloc.c b/malloc/malloc.c
|
|
|
51f0aa |
--- a/malloc/malloc.c 2017-08-01 18:11:00.000000000 -0400
|
|
|
51f0aa |
+++ b/malloc/malloc.c 2017-08-01 18:13:07.907438098 -0400
|
|
|
51f0aa |
@@ -1429,6 +1429,8 @@ typedef struct malloc_chunk* mbinptr;
|
|
|
51f0aa |
|
|
|
51f0aa |
/* Take a chunk off a bin list */
|
|
|
51f0aa |
#define unlink(AV, P, BK, FD) { \
|
|
|
51f0aa |
+ if (__builtin_expect (chunksize(P) != next_chunk(P)->prev_size, 0)) \
|
|
|
51f0aa |
+ malloc_printerr (check_action, "corrupted size vs. prev_size", P, AV); \
|
|
|
51f0aa |
FD = P->fd; \
|
|
|
51f0aa |
BK = P->bk; \
|
|
|
51f0aa |
if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \
|