Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix previous, pr_size includes the KASAN redzone. R...
details: https://anonhg.NetBSD.org/src/rev/a51417610530
branches: trunk
changeset: 996869:a51417610530
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Feb 11 11:12:58 2019 +0000
description:
Fix previous, pr_size includes the KASAN redzone. Repurpose pr_reqsize and
use it for PR_ZERO, it holds the size requested by the user with no padding
or redzone added, and only these bytes should be zeroed.
diffstat:
sys/kern/subr_pool.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diffs (64 lines):
diff -r 1232f81320c5 -r a51417610530 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c Mon Feb 11 07:51:46 2019 +0000
+++ b/sys/kern/subr_pool.c Mon Feb 11 11:12:58 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_pool.c,v 1.232 2019/02/10 17:13:33 christos Exp $ */
+/* $NetBSD: subr_pool.c,v 1.233 2019/02/11 11:12:58 maxv Exp $ */
/*
* Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.232 2019/02/10 17:13:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.233 2019/02/11 11:12:58 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -575,6 +575,7 @@
pp->pr_roflags = flags;
pp->pr_flags = 0;
pp->pr_size = prsize;
+ pp->pr_reqsize = size;
pp->pr_align = align;
pp->pr_wchan = wchan;
pp->pr_alloc = palloc;
@@ -960,7 +961,7 @@
FREECHECK_OUT(&pp->pr_freecheck, v);
pool_redzone_fill(pp, v);
if (flags & PR_ZERO)
- memset(v, 0, pp->pr_size);
+ memset(v, 0, pp->pr_reqsize);
else
pool_kleak_fill(pp, v);
return v;
@@ -2820,7 +2821,6 @@
#endif
if (pp->pr_roflags & PR_NOTOUCH) {
- pp->pr_reqsize = 0;
pp->pr_redzone = false;
return;
}
@@ -2830,7 +2830,6 @@
* there's naturally space in the padding for a red zone.
*/
if (pp->pr_size - requested_size >= redzsz) {
- pp->pr_reqsize = requested_size;
pp->pr_reqsize_with_redzone = requested_size + redzsz;
pp->pr_redzone = true;
return;
@@ -2844,12 +2843,10 @@
if (nsz <= pp->pr_alloc->pa_pagesz) {
/* Ok, we can */
pp->pr_size = nsz;
- pp->pr_reqsize = requested_size;
pp->pr_reqsize_with_redzone = requested_size + redzsz;
pp->pr_redzone = true;
} else {
/* No space for a red zone... snif :'( */
- pp->pr_reqsize = 0;
pp->pr_redzone = false;
printf("pool redzone disabled for '%s'\n", pp->pr_wchan);
}
Home |
Main Index |
Thread Index |
Old Index