Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Ignore REL/RELA if they aren't against a PROGBIT se...
details: https://anonhg.NetBSD.org/src/rev/ebf5e6582980
branches: trunk
changeset: 789149:ebf5e6582980
user: matt <matt%NetBSD.org@localhost>
date: Fri Aug 09 05:10:14 2013 +0000
description:
Ignore REL/RELA if they aren't against a PROGBIT section.
(this causes EXIDX sections to be ignored for ARM).
diffstat:
sys/kern/subr_kobj.c | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
diffs (98 lines):
diff -r ccd348b7a76c -r ebf5e6582980 sys/kern/subr_kobj.c
--- a/sys/kern/subr_kobj.c Fri Aug 09 04:24:19 2013 +0000
+++ b/sys/kern/subr_kobj.c Fri Aug 09 05:10:14 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_kobj.c,v 1.45 2012/12/30 20:52:20 pooka Exp $ */
+/* $NetBSD: subr_kobj.c,v 1.46 2013/08/09 05:10:14 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.45 2012/12/30 20:52:20 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.46 2013/08/09 05:10:14 matt Exp $");
#include "opt_modular.h"
@@ -257,9 +257,13 @@
symstrindex = shdr[i].sh_link;
break;
case SHT_REL:
+ if (shdr[shdr[i].sh_info].sh_type != SHT_PROGBITS)
+ continue;
ko->ko_nrel++;
break;
case SHT_RELA:
+ if (shdr[shdr[i].sh_info].sh_type != SHT_PROGBITS)
+ continue;
ko->ko_nrela++;
break;
case SHT_STRTAB:
@@ -488,6 +492,8 @@
pb++;
break;
case SHT_REL:
+ if (shdr[shdr[i].sh_info].sh_type != SHT_PROGBITS)
+ break;
ko->ko_reltab[rl].size = shdr[i].sh_size;
ko->ko_reltab[rl].size -=
shdr[i].sh_size % sizeof(Elf_Rel);
@@ -508,6 +514,8 @@
rl++;
break;
case SHT_RELA:
+ if (shdr[shdr[i].sh_info].sh_type != SHT_PROGBITS)
+ break;
ko->ko_relatab[ra].size = shdr[i].sh_size;
ko->ko_relatab[ra].size -=
shdr[i].sh_size % sizeof(Elf_Rela);
@@ -532,16 +540,21 @@
}
}
if (pb != ko->ko_nprogtab) {
- panic("lost progbits");
+ panic("%s:%d: %s: lost progbits", __func__, __LINE__,
+ ko->ko_name);
}
if (rl != ko->ko_nrel) {
- panic("lost rel");
+ panic("%s:%d: %s: lost rel", __func__, __LINE__,
+ ko->ko_name);
}
if (ra != ko->ko_nrela) {
- panic("lost rela");
+ panic("%s:%d: %s: lost rela", __func__, __LINE__,
+ ko->ko_name);
}
if (ko->ko_type != KT_MEMORY && mapbase != ko->ko_address + mapsize) {
- panic("mapbase 0x%lx != address %lx + mapsize %ld (0x%lx)\n",
+ panic("%s:%d: %s: "
+ "mapbase 0x%lx != address %lx + mapsize %ld (0x%lx)\n",
+ __func__, __LINE__, ko->ko_name,
(long)mapbase, (long)ko->ko_address, (long)mapsize,
(long)ko->ko_address + mapsize);
}
@@ -929,7 +942,9 @@
rellim = rel + ko->ko_reltab[i].nrel;
base = kobj_findbase(ko, ko->ko_reltab[i].sec);
if (base == 0) {
- panic("lost base for e_reltab");
+ panic("%s:%d: %s: lost base for e_reltab[%d] sec %d",
+ __func__, __LINE__, ko->ko_name, i,
+ ko->ko_reltab[i].sec);
}
for (; rel < rellim; rel++) {
symidx = ELF_R_SYM(rel->r_info);
@@ -958,7 +973,9 @@
relalim = rela + ko->ko_relatab[i].nrela;
base = kobj_findbase(ko, ko->ko_relatab[i].sec);
if (base == 0) {
- panic("lost base for e_relatab");
+ panic("%s:%d: %s: lost base for e_relatab[%d] sec %d",
+ __func__, __LINE__, ko->ko_name, i,
+ ko->ko_relatab[i].sec);
}
for (; rela < relalim; rela++) {
symidx = ELF_R_SYM(rela->r_info);
Home |
Main Index |
Thread Index |
Old Index