Module Name: src
Committed By: maxv
Date: Sat Aug 3 09:31:07 UTC 2019
Modified Files:
src/sys/kern: subr_pool.c
Log Message:
Replace || by && in KASAN, to increase the pool coverage.
Strictly speaking, what we want to avoid is poisoning buffers that were
referenced in a global list as part of the ctor. But, if a buffer indeed
got referenced as part of the ctor, it necessarily has to be unreferenced
in the dtor; which implies it has to have a dtor. So we want both a ctor
and a dtor, and not just one of them.
Note that POOL_QUARANTINE already implicitly provides this increased
coverage.
To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/kern/subr_pool.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.253 src/sys/kern/subr_pool.c:1.254
--- src/sys/kern/subr_pool.c:1.253 Fri Aug 2 05:22:14 2019
+++ src/sys/kern/subr_pool.c Sat Aug 3 09:31:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_pool.c,v 1.253 2019/08/02 05:22:14 maxv Exp $ */
+/* $NetBSD: subr_pool.c,v 1.254 2019/08/03 09:31:07 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.253 2019/08/02 05:22:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.254 2019/08/03 09:31:07 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -3098,8 +3098,8 @@ static void
pool_cache_redzone_check(pool_cache_t pc, void *p)
{
#ifdef KASAN
- /* If there is a ctor/dtor, leave the data as valid. */
- if (__predict_false(pc_has_ctor(pc) || pc_has_dtor(pc))) {
+ /* If there is a ctor+dtor, leave the data as valid. */
+ if (__predict_false(pc_has_ctor(pc) && pc_has_dtor(pc))) {
return;
}
#endif