Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/5378ea1be275
branches:  trunk
changeset: 379477:5378ea1be275
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jun 02 08:46:16 2021 +0000

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

Apparently the equality kassert this restored doesn't work; to be
analyzed.

diffstat:

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

diffs (42 lines):

diff -r 8ce49d07b859 -r 5378ea1be275 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c     Wed Jun 02 06:48:10 2021 +0000
+++ b/sys/kern/kern_ksyms.c     Wed Jun 02 08:46:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ksyms.c,v 1.92 2021/06/01 21:11:52 riastradh Exp $        */
+/*     $NetBSD: kern_ksyms.c,v 1.93 2021/06/02 08:46:16 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.92 2021/06/01 21:11:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.93 2021/06/02 08:46:16 riastradh Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_copy_symtab.h"
@@ -1089,6 +1089,8 @@ ksymsread(dev_t dev, struct uio *uio, in
        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) {
@@ -1104,11 +1106,13 @@ ksymsread(dev_t dev, struct uio *uio, in
        /*
         * 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