Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Make sure we're loading a relocatable binary, ...
details: https://anonhg.NetBSD.org/src/rev/36eaef84f0d0
branches: trunk
changeset: 358319:36eaef84f0d0
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Dec 21 14:28:39 2017 +0000
description:
Make sure we're loading a relocatable binary, to give the user a chance to
correct the kernel name if he mistakenly typed pkboot on a static kernel,
without having to reboot the machine (currently the prekern sees it's a
static kernel and panics).
diffstat:
sys/lib/libsa/loadfile_elf32.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (21 lines):
diff -r ef6a3aec246a -r 36eaef84f0d0 sys/lib/libsa/loadfile_elf32.c
--- a/sys/lib/libsa/loadfile_elf32.c Thu Dec 21 12:25:03 2017 +0000
+++ b/sys/lib/libsa/loadfile_elf32.c Thu Dec 21 14:28:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.51 2017/11/15 18:02:37 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.52 2017/12/21 14:28:39 maxv Exp $ */
/*
* Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -352,6 +352,11 @@
internalize_ehdr(elf->e_ident[EI_DATA], elf);
+ if (elf->e_type != ET_REL) {
+ errno = EINVAL;
+ return 1;
+ }
+
/* Create a local copy of the SECTION HEADERS. */
shdrsz = elf->e_shnum * sizeof(Elf_Shdr);
shdr = ALLOC(shdrsz);
Home |
Main Index |
Thread Index |
Old Index