Sourceware Bugzilla – Attachment 7769 Details for
Bug 17344
Enhance glibc metadata hardening with the attached patch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Check linked list integrity for the large sized chunk list too.
glibc_malloc.diff (text/plain), 3.04 KB, created by
Chris Evans
on 2014-09-03 01:31:21 UTC
(
hide
)
Description:
Check linked list integrity for the large sized chunk list too.
Filename:
MIME Type:
Creator:
Chris Evans
Created:
2014-09-03 01:31:21 UTC
Size:
3.04 KB
patch
obsolete
>--- malloc.c.orig 2014-09-02 17:53:21.233522659 -0700 >+++ malloc.c 2014-09-02 18:04:28.608777748 -0700 >@@ -1421,35 +1421,40 @@ > #define last(b) ((b)->bk) > > /* Take a chunk off a bin list */ >-#define unlink(AV, P, BK, FD) { \ >- FD = P->fd; \ >- BK = P->bk; \ >- if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \ >- mutex_unlock(&(AV)->mutex); \ >- malloc_printerr (check_action, "corrupted double-linked list", P); \ >- mutex_lock(&(AV)->mutex); \ >- } else { \ >- FD->bk = BK; \ >- BK->fd = FD; \ >- if (!in_smallbin_range (P->size) \ >- && __builtin_expect (P->fd_nextsize != NULL, 0)) { \ >- assert (P->fd_nextsize->bk_nextsize == P); \ >- assert (P->bk_nextsize->fd_nextsize == P); \ >- if (FD->fd_nextsize == NULL) { \ >- if (P->fd_nextsize == P) \ >- FD->fd_nextsize = FD->bk_nextsize = FD; \ >- else { \ >- FD->fd_nextsize = P->fd_nextsize; \ >- FD->bk_nextsize = P->bk_nextsize; \ >- P->fd_nextsize->bk_nextsize = FD; \ >- P->bk_nextsize->fd_nextsize = FD; \ >- } \ >- } else { \ >- P->fd_nextsize->bk_nextsize = P->bk_nextsize; \ >- P->bk_nextsize->fd_nextsize = P->fd_nextsize; \ >- } \ >- } \ >- } \ >+#define unlink(AV, P, BK, FD) { \ >+ FD = P->fd; \ >+ BK = P->bk; \ >+ if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \ >+ mutex_unlock(&(AV)->mutex); \ >+ malloc_printerr (check_action, "corrupted linked list (main)", P); \ >+ mutex_lock(&(AV)->mutex); \ >+ } else { \ >+ FD->bk = BK; \ >+ BK->fd = FD; \ >+ if (!in_smallbin_range (P->size) \ >+ && __builtin_expect (P->fd_nextsize != NULL, 0)) { \ >+ if (__builtin_expect (P->fd_nextsize->bk_nextsize != P \ >+ || P->bk_nextsize->fd_nextsize != P, 0)) { \ >+ mutex_unlock(&(AV)->mutex); \ >+ malloc_printerr (check_action, "corrupted linked list (large)", P); \ >+ mutex_lock(&(AV)->mutex); \ >+ } else { \ >+ if (FD->fd_nextsize == NULL) { \ >+ if (P->fd_nextsize == P) \ >+ FD->fd_nextsize = FD->bk_nextsize = FD; \ >+ else { \ >+ FD->fd_nextsize = P->fd_nextsize; \ >+ FD->bk_nextsize = P->bk_nextsize; \ >+ P->fd_nextsize->bk_nextsize = FD; \ >+ P->bk_nextsize->fd_nextsize = FD; \ >+ } \ >+ } else { \ >+ P->fd_nextsize->bk_nextsize = P->bk_nextsize; \ >+ P->bk_nextsize->fd_nextsize = P->fd_nextsize; \ >+ } \ >+ } \ >+ } \ >+ } \ > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 17344
: 7769