Source-Changes-HG archive

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

[src/trunk]: src/sys/kern skip symbol tables that were unloaded again to avoi...



details:   https://anonhg.NetBSD.org/src/rev/6ea9ff54218e
branches:  trunk
changeset: 1022433:6ea9ff54218e
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jul 18 06:57:28 2021 +0000

description:
skip symbol tables that were unloaded again to avoid EFAULT when reading
ksyms.

also restore TAILQ_FOREACH idiom.

diffstat:

 sys/kern/kern_ksyms.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 8f98b8483819 -r 6ea9ff54218e sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c     Sun Jul 18 06:24:58 2021 +0000
+++ b/sys/kern/kern_ksyms.c     Sun Jul 18 06:57:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ksyms.c,v 1.97 2021/06/03 09:22:47 riastradh Exp $        */
+/*     $NetBSD: kern_ksyms.c,v 1.98 2021/07/18 06:57:28 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.97 2021/06/03 09:22:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.98 2021/07/18 06:57:28 mlelstv Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_copy_symtab.h"
@@ -1084,9 +1084,9 @@
         * Copy out the symbol table.
         */
        filepos = sizeof(struct ksyms_hdr);
-       for (st = TAILQ_FIRST(&ksyms_symtabs);
-            ;
-            st = TAILQ_NEXT(st, sd_queue)) {
+       TAILQ_FOREACH(st, &ksyms_symtabs, sd_queue) {
+               if (__predict_false(st->sd_gone))
+                       continue;
                if (uio->uio_resid == 0)
                        return 0;
                if (uio->uio_offset <= st->sd_symsize + filepos) {



Home | Main Index | Thread Index | Old Index