Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Actually, uio_vmspace is never NULL, the check shou...



details:   https://anonhg.NetBSD.org/src/rev/2037de4aca38
branches:  trunk
changeset: 1006727:2037de4aca38
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jan 25 15:55:33 2020 +0000

description:
Actually, uio_vmspace is never NULL, the check should be against
pmap_kernel.

diffstat:

 sys/kern/subr_asan.c |  18 ++++++++++--------
 sys/kern/subr_msan.c |   8 ++++----
 2 files changed, 14 insertions(+), 12 deletions(-)

diffs (86 lines):

diff -r 4971a7183513 -r 2037de4aca38 sys/kern/subr_asan.c
--- a/sys/kern/subr_asan.c      Sat Jan 25 15:41:52 2020 +0000
+++ b/sys/kern/subr_asan.c      Sat Jan 25 15:55:33 2020 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: subr_asan.c,v 1.16 2019/10/10 13:45:14 maxv Exp $      */
+/*     $NetBSD: subr_asan.c,v 1.17 2020/01/25 15:55:33 maxv Exp $      */
 
 /*
- * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.16 2019/10/10 13:45:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.17 2020/01/25 15:55:33 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1077,11 +1077,11 @@
        struct iovec *iov;
        int i;
 
-       if (uio->uio_vmspace != NULL)
+       kasan_shadow_check((uintptr_t)uio, sizeof(struct uio), false, pc);
+
+       if (!VMSPACE_IS_KERNEL_P(uio->uio_vmspace))
                return;
 
-       kasan_shadow_check((uintptr_t)uio, sizeof(struct uio), false, pc);
-
        resid = uio->uio_resid;
        iov = uio->uio_iov;
 
@@ -1233,13 +1233,15 @@
 void __asan_poison_stack_memory(const void *, size_t);
 void __asan_unpoison_stack_memory(const void *, size_t);
 
-void __asan_poison_stack_memory(const void *addr, size_t size)
+void
+__asan_poison_stack_memory(const void *addr, size_t size)
 {
        size = roundup(size, KASAN_SHADOW_SCALE_SIZE);
        kasan_shadow_Nbyte_fill(addr, size, KASAN_USE_AFTER_SCOPE);
 }
 
-void __asan_unpoison_stack_memory(const void *addr, size_t size)
+void
+__asan_unpoison_stack_memory(const void *addr, size_t size)
 {
        kasan_shadow_Nbyte_markvalid(addr, size);
 }
diff -r 4971a7183513 -r 2037de4aca38 sys/kern/subr_msan.c
--- a/sys/kern/subr_msan.c      Sat Jan 25 15:41:52 2020 +0000
+++ b/sys/kern/subr_msan.c      Sat Jan 25 15:55:33 2020 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $       */
+/*     $NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $       */
 
 /*
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1538,7 +1538,7 @@
        struct iovec *iov;
        int i;
 
-       if (uio->uio_vmspace != NULL)
+       if (!VMSPACE_IS_KERNEL_P(uio->uio_vmspace))
                return;
 
        resid = uio->uio_resid;



Home | Main Index | Thread Index | Old Index