Source-Changes-HG archive

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

[src/trunk]: src/sys/kern kMSan: re-set the orig after pool_cache_get_slow(),...



details:   https://anonhg.NetBSD.org/src/rev/3156f3bc7b48
branches:  trunk
changeset: 1010775:3156f3bc7b48
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jun 06 06:42:54 2020 +0000

description:
kMSan: re-set the orig after pool_cache_get_slow(), using the address of
the caller of pool_cache_get_paddr().

Otherwise the orig is just pool_cache_get_paddr(), and that's not really
useful for debugging.

diffstat:

 sys/kern/subr_pool.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 98d0a285582e -r 3156f3bc7b48 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Fri Jun 05 22:08:10 2020 +0000
+++ b/sys/kern/subr_pool.c      Sat Jun 06 06:42:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.268 2020/04/15 17:16:22 maxv Exp $     */
+/*     $NetBSD: subr_pool.c,v 1.269 2020/06/06 06:42:54 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.268 2020/04/15 17:16:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.269 2020/06/06 06:42:54 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2574,8 +2574,13 @@
                 * no more objects are available, it will return false.
                 * Otherwise, we need to retry.
                 */
-               if (!pool_cache_get_slow(cc, s, &object, pap, flags))
+               if (!pool_cache_get_slow(cc, s, &object, pap, flags)) {
+                       if (object != NULL) {
+                               kmsan_orig(object, pc->pc_pool.pr_size,
+                                   KMSAN_TYPE_POOL, __RET_ADDR);
+                       }
                        break;
+               }
        }
 
        /*



Home | Main Index | Thread Index | Old Index