Source-Changes-HG archive

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

[src/trunk]: src/sys/kern ksyms(4): Don't skip symbol tables that are soon to...



details:   https://anonhg.NetBSD.org/src/rev/a3160a0e0c63
branches:  trunk
changeset: 1021493:a3160a0e0c63
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jun 01 21:11:52 2021 +0000

description:
ksyms(4): Don't skip symbol tables that are soon to be freed.

They will not actually be freed until /dev/ksyms is closed, so
continued access to them remains kosher.

diffstat:

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

diffs (42 lines):

diff -r 7ab0d1d4bd5e -r a3160a0e0c63 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c     Tue Jun 01 21:11:07 2021 +0000
+++ b/sys/kern/kern_ksyms.c     Tue Jun 01 21:11:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ksyms.c,v 1.91 2021/06/01 21:11:07 riastradh Exp $        */
+/*     $NetBSD: kern_ksyms.c,v 1.92 2021/06/01 21:11:52 riastradh 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.91 2021/06/01 21:11:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.92 2021/06/01 21:11:52 riastradh Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_copy_symtab.h"
@@ -1089,8 +1089,6 @@
        for (st = TAILQ_FIRST(&ksyms_symtabs);
             st != ksyms_last_snapshot;
             st = TAILQ_NEXT(st, sd_queue)) {
-               if (__predict_false(st->sd_gone))
-                       continue;
                if (uio->uio_resid == 0)
                        return 0;
                if (uio->uio_offset <= st->sd_symsize + filepos) {
@@ -1106,13 +1104,11 @@
        /*
         * Copy out the string table
         */
-       KASSERT(filepos <= sizeof(struct ksyms_hdr) +
+       KASSERT(filepos == sizeof(struct ksyms_hdr) +
            ksyms_hdr.kh_shdr[SYMTAB].sh_size);
        for (st = TAILQ_FIRST(&ksyms_symtabs);
             st != ksyms_last_snapshot;
             st = TAILQ_NEXT(st, sd_queue)) {
-               if (__predict_false(st->sd_gone))
-                       continue;
                if (uio->uio_resid == 0)
                        return 0;
                if (uio->uio_offset <= st->sd_strsize + filepos) {



Home | Main Index | Thread Index | Old Index