Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/lib/libsa Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/38568d13600e
branches:  netbsd-9
changeset: 460447:38568d13600e
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Oct 23 19:17:15 2019 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #361):

        sys/lib/libsa/loadfile_elf32.c: revision 1.56

Make sure we're dealing with a static binary. Otherwise we could crash if
the user mistakenly tries to boot a KASLR kernel with 'boot' instead of
'pkboot'. Now we fail cleanly. Reported by cryo@.

diffstat:

 sys/lib/libsa/loadfile_elf32.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r e1e1edd930fc -r 38568d13600e sys/lib/libsa/loadfile_elf32.c
--- a/sys/lib/libsa/loadfile_elf32.c    Wed Oct 23 19:14:19 2019 +0000
+++ b/sys/lib/libsa/loadfile_elf32.c    Wed Oct 23 19:17:15 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.55 2019/07/21 16:53:17 rin Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.55.2.1 2019/10/23 19:17:15 martin Exp $ */
 
 /*
  * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -699,6 +699,11 @@
 
        internalize_ehdr(elf->e_ident[EI_DATA], elf);
 
+       if (elf->e_type != ET_EXEC) {
+               errno = EINVAL;
+               return 1;
+       }
+
        sz = elf->e_phnum * sizeof(Elf_Phdr);
        phdr = ALLOC(sz);
        ret = ELFNAMEEND(readfile_local)(fd, elf->e_phoff, phdr, sz);



Home | Main Index | Thread Index | Old Index