Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern ksymsmmap: Add missing uao_reference(9) call for ks...
details: https://anonhg.NetBSD.org/src/rev/a82602f6a7a9
branches: trunk
changeset: 1023686:a82602f6a7a9
user: rin <rin%NetBSD.org@localhost>
date: Wed Sep 22 05:42:19 2021 +0000
description:
ksymsmmap: Add missing uao_reference(9) call for ks->ks_uobj.
Fix failure for savecore(8) and subsequent kernel panic, introduced to
kern_ksyms.c rev 1.03, at least for sh3 and alpha.
For sh3 and alpha, savecore(8) supports coff and ecoff, respectively, via
libkvm via nlist(3). nlist(3) routines for coff and ecoff use mmap(2) and
munmap(2) for /dev/ksyms.
This munmap(2) decrements reference count for ks->ks_uobj. Unless it is
incremented in ksymsmmap(), ks->ks_uobj will be freed unexpectedly.
diffstat:
sys/kern/kern_ksyms.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 71219afc9e2a -r a82602f6a7a9 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c Tue Sep 21 23:06:18 2021 +0000
+++ b/sys/kern/kern_ksyms.c Wed Sep 22 05:42:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ksyms.c,v 1.104 2021/09/11 10:09:55 riastradh Exp $ */
+/* $NetBSD: kern_ksyms.c,v 1.105 2021/09/22 05:42:19 rin 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.104 2021/09/11 10:09:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.105 2021/09/22 05:42:19 rin Exp $");
#if defined(_KERNEL) && defined(_KERNEL_OPT)
#include "opt_copy_symtab.h"
@@ -1406,6 +1406,7 @@
return EINVAL; /* XXX ??? */
/* Success! */
+ uao_reference(ks->ks_uobj);
*advicep = UVM_ADV_SEQUENTIAL;
*uobjp = ks->ks_uobj;
*maxprotp = prot & VM_PROT_READ;
Home |
Main Index |
Thread Index |
Old Index