Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Zero clear sh_offset to indicate a section is unused.
details: https://anonhg.NetBSD.org/src/rev/b17bbbb1a229
branches: trunk
changeset: 989081:b17bbbb1a229
user: rin <rin%NetBSD.org@localhost>
date: Mon Oct 11 14:14:40 2021 +0000
description:
Zero clear sh_offset to indicate a section is unused.
Avoid kernel text being doubly allocated due to non-zero sh_offset for
unused sections.
None of MD codes and kern_ksyms.c use sh_type == SHT_NULL (yet?) to
determine whether a section is unused.
diffstat:
sys/dev/kloader.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 547393ca712e -r b17bbbb1a229 sys/dev/kloader.c
--- a/sys/dev/kloader.c Mon Oct 11 13:42:33 2021 +0000
+++ b/sys/dev/kloader.c Mon Oct 11 14:14:40 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kloader.c,v 1.29 2021/06/29 22:40:53 dholland Exp $ */
+/* $NetBSD: kloader.c,v 1.30 2021/10/11 14:14:40 rin Exp $ */
/*-
* Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.29 2021/06/29 22:40:53 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.30 2021/10/11 14:14:40 rin Exp $");
#include "debug_kloader.h"
@@ -263,9 +263,11 @@
symndx = i;
else if (strcmp(shstrtab + sh[i].sh_name, ".strtab") == 0)
strndx = i;
- else if (i != eh.e_shstrndx)
+ else if (i != eh.e_shstrndx) {
/* while here, mark all other sections as unused */
sh[i].sh_type = SHT_NULL;
+ sh[i].sh_offset = 0;
+ }
}
if (symndx < 0 || strndx < 0) {
Home |
Main Index |
Thread Index |
Old Index