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/f365aedc5d33
branches:  trunk
changeset: 983714:f365aedc5d33
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jun 03 01:00:24 2021 +0000

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

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

The previous change was busted because of an off-by-one error in a
previous previous change's iteration over the symtabs; that error has
since been corrected.

diffstat:

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

diffs (42 lines):

diff -r 9f88787504c7 -r f365aedc5d33 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c     Thu Jun 03 01:00:15 2021 +0000
+++ b/sys/kern/kern_ksyms.c     Thu Jun 03 01:00:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ksyms.c,v 1.95 2021/06/03 01:00:15 riastradh Exp $        */
+/*     $NetBSD: kern_ksyms.c,v 1.96 2021/06/03 01:00:24 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.95 2021/06/03 01:00:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.96 2021/06/03 01:00:24 riastradh Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_copy_symtab.h"
@@ -1089,8 +1089,6 @@
        for (st = TAILQ_FIRST(&ksyms_symtabs);
             ;
             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) {
@@ -1108,13 +1106,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 = 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