diff options
author | ian <ian@FreeBSD.org> | 2013-03-10 00:43:01 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2013-03-10 00:43:01 +0000 |
commit | 84fe418fcb138d0ad2fe6b181a17c4eee59e2a0e (patch) | |
tree | 57af97b3bf14dc2635ddddc2bef0199b60539a72 /sys/boot/common | |
parent | 5e403de75ee05384c91cbd144df91148207fc551 (diff) | |
download | FreeBSD-src-84fe418fcb138d0ad2fe6b181a17c4eee59e2a0e.zip FreeBSD-src-84fe418fcb138d0ad2fe6b181a17c4eee59e2a0e.tar.gz |
Attach the elf section headers to the loaded kernel as metadata, so
they can easily be used by later post-processing. When searching for
a compiled-in fdt blob, use the section headers to get the size and
location of the .dynsym section to do a symbol search.
This fixes a problem where the search could overshoot the symbol
table and wander into the string table. Sometimes that was harmless
and sometimes it lead to spurious panic messages about an offset
bigger than the module size.
Diffstat (limited to 'sys/boot/common')
-rw-r--r-- | sys/boot/common/load_elf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c index 4a1896e..8990d90 100644 --- a/sys/boot/common/load_elf.c +++ b/sys/boot/common/load_elf.c @@ -397,6 +397,8 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) "_loadimage: failed to read section headers"); goto nosyms; } + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + symtabindex = -1; symstrindex = -1; for (i = 0; i < ehdr->e_shnum; i++) { |