Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/stand/prekern Make sure we're relocating a re...



details:   https://anonhg.NetBSD.org/src/rev/1074dbdeb0ae
branches:  trunk
changeset: 827070:1074dbdeb0ae
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Oct 11 16:21:06 2017 +0000

description:
Make sure we're relocating a relocatable kernel.

diffstat:

 sys/arch/amd64/stand/prekern/elf.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r a33274cb3f54 -r 1074dbdeb0ae sys/arch/amd64/stand/prekern/elf.c
--- a/sys/arch/amd64/stand/prekern/elf.c        Wed Oct 11 16:18:11 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/elf.c        Wed Oct 11 16:21:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elf.c,v 1.1 2017/10/10 09:29:14 maxv Exp $     */
+/*     $NetBSD: elf.c,v 1.2 2017/10/11 16:21:06 maxv Exp $     */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -86,7 +86,8 @@
 elf_check_header()
 {
        if (memcmp((char *)eif.ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
-           eif.ehdr->e_ident[EI_CLASS] != ELFCLASS) {
+           eif.ehdr->e_ident[EI_CLASS] != ELFCLASS ||
+           eif.ehdr->e_type != ET_REL) {
                return -1;
        }
        return 0;



Home | Main Index | Thread Index | Old Index