From owner-svn-src-stable@freebsd.org Mon Mar 7 07:57:58 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A29EDAC257D; Mon, 7 Mar 2016 07:57:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E93EB83; Mon, 7 Mar 2016 07:57:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u277vv3E026523; Mon, 7 Mar 2016 07:57:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u277vvlt026521; Mon, 7 Mar 2016 07:57:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201603070757.u277vvlt026521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 7 Mar 2016 07:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r296439 - in stable/9/sys: boot/common kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2016 07:57:58 -0000 Author: dim Date: Mon Mar 7 07:57:57 2016 New Revision: 296439 URL: https://svnweb.freebsd.org/changeset/base/296439 Log: MFC r296419 (by kib): In the link_elf_obj.c, handle sections of type SHT_AMD64_UNWIND same as SHT_PROGBITS. This is needed after the clang 3.8 import, which generates that type for .eh_frame section, which had SHT_PROGBITS type before. Reported by: Nikolai Lifanov PR: 207729 Tested by: dim (previous version) Sponsored by: The FreeBSD Foundation MFC r296428: Since kernel modules can now contain sections of type SHT_AMD64_UNWIND, the boot loader should not skip over these anymore while loading images. Otherwise the kernel can still panic when it doesn't find the .eh_frame section belonging to the .rela.eh_frame section. Unfortunately this will require installing boot loaders from sys/boot before attempting to boot with a new kernel. Reviewed by: kib Modified: stable/9/sys/boot/common/load_elf_obj.c stable/9/sys/kern/link_elf_obj.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/common/load_elf_obj.c ============================================================================== --- stable/9/sys/boot/common/load_elf_obj.c Mon Mar 7 07:54:48 2016 (r296438) +++ stable/9/sys/boot/common/load_elf_obj.c Mon Mar 7 07:57:57 2016 (r296439) @@ -228,6 +228,9 @@ __elfN(obj_loadimage)(struct preloaded_f switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#if defined(__i386__) || defined(__amd64__) + case SHT_AMD64_UNWIND: +#endif lastaddr = roundup(lastaddr, shdr[i].sh_addralign); shdr[i].sh_addr = (Elf_Addr)lastaddr; lastaddr += shdr[i].sh_size; Modified: stable/9/sys/kern/link_elf_obj.c ============================================================================== --- stable/9/sys/kern/link_elf_obj.c Mon Mar 7 07:54:48 2016 (r296438) +++ stable/9/sys/kern/link_elf_obj.c Mon Mar 7 07:57:57 2016 (r296439) @@ -255,6 +255,9 @@ link_elf_link_preload(linker_class_t cls switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#ifdef __amd64__ + case SHT_AMD64_UNWIND: +#endif ef->nprogtab++; break; case SHT_SYMTAB: @@ -325,9 +328,16 @@ link_elf_link_preload(linker_class_t cls switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#ifdef __amd64__ + case SHT_AMD64_UNWIND: +#endif ef->progtab[pb].addr = (void *)shdr[i].sh_addr; if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; +#ifdef __amd64__ + else if (shdr[i].sh_type == SHT_AMD64_UNWIND) + ef->progtab[pb].name = "<>"; +#endif else ef->progtab[pb].name = "<>"; ef->progtab[pb].size = shdr[i].sh_size; @@ -553,6 +563,9 @@ link_elf_load_file(linker_class_t cls, c switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#ifdef __amd64__ + case SHT_AMD64_UNWIND: +#endif ef->nprogtab++; break; case SHT_SYMTAB: @@ -659,6 +672,9 @@ link_elf_load_file(linker_class_t cls, c switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#ifdef __amd64__ + case SHT_AMD64_UNWIND: +#endif alignmask = shdr[i].sh_addralign - 1; mapsize += alignmask; mapsize &= ~alignmask; @@ -721,6 +737,9 @@ link_elf_load_file(linker_class_t cls, c switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: +#ifdef __amd64__ + case SHT_AMD64_UNWIND: +#endif alignmask = shdr[i].sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask; @@ -729,6 +748,10 @@ link_elf_load_file(linker_class_t cls, c ef->shstrtab + shdr[i].sh_name; else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; +#ifdef __amd64__ + else if (shdr[i].sh_type == SHT_AMD64_UNWIND) + ef->progtab[pb].name = "<>"; +#endif else ef->progtab[pb].name = "<>"; if (ef->progtab[pb].name != NULL && @@ -750,7 +773,11 @@ link_elf_load_file(linker_class_t cls, c } ef->progtab[pb].size = shdr[i].sh_size; ef->progtab[pb].sec = i; - if (shdr[i].sh_type == SHT_PROGBITS) { + if (shdr[i].sh_type == SHT_PROGBITS +#ifdef __amd64__ + || shdr[i].sh_type == SHT_AMD64_UNWIND +#endif + ) { error = vn_rdwr(UIO_READ, nd.ni_vp, ef->progtab[pb].addr, shdr[i].sh_size, shdr[i].sh_offset,