Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Mmh, fix len, mh_size includes the malloc header, b...



details:   https://anonhg.NetBSD.org/src/rev/33397d1e90e9
branches:  trunk
changeset: 997432:33397d1e90e9
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Mar 07 18:32:10 2019 +0000

description:
Mmh, fix len, mh_size includes the malloc header, but we don't redzone it.

diffstat:

 sys/kern/kern_malloc.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r d520343ed135 -r 33397d1e90e9 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Thu Mar 07 15:47:34 2019 +0000
+++ b/sys/kern/kern_malloc.c    Thu Mar 07 18:32:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.155 2018/12/23 12:15:01 maxv Exp $   */
+/*     $NetBSD: kern_malloc.c,v 1.156 2019/03/07 18:32:10 maxv Exp $   */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.155 2018/12/23 12:15:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.156 2019/03/07 18:32:10 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -152,7 +152,8 @@
        mh = addr;
        mh--;
 
-       kasan_mark(addr, mh->mh_size, mh->mh_size);
+       kasan_mark(addr, mh->mh_size - sizeof(struct malloc_header),
+           mh->mh_size - sizeof(struct malloc_header));
 
        if (mh->mh_size >= PAGE_SIZE + sizeof(struct malloc_header))
                kmem_intr_free((char *)addr - PAGE_SIZE,



Home | Main Index | Thread Index | Old Index