git: kernel ELF: Reimplement Elf Branding, .note.ABI-tag

Alex Hornung ahornung at gmail.com
Tue May 17 01:28:59 PDT 2011


This commit has a few problems:

a) We don't have a brandinfo entry in the imgact foo for
ELFOSABI_FREEBSD anymore, only ELFOSABI_NONE. I'd appreciate it if the
entry was restored.

b) Not sure why the fallback_brand sysctl was moved, but ok.

c) Some concerns have been expressed (by corecode) regarding accessing a
possibly unmapped page for the ABI note. This was avoided previously
with our elf_check_abi_note() function, but it has been removed. Is
there any reason for this? Just because FreeBSD does it that way doesn't
mean we need to, especially if you haven't synced up other parts such as
the loader. Now it seems we might have a security vulnerability.

Regards,
Alex

On 11/05/11 08:28, John Marino wrote:
> commit 315b8b8b77c1101b25fef36483a8d0474a1befb2
> Author: John Marino <draco at marino.st>
> Date:   Tue May 10 21:17:07 2011 +0200
> 
>     kernel ELF: Reimplement Elf Branding, .note.ABI-tag
>     
>     Static executables built with the GNU gold linker are not recognized as
>     valid ELF binaries, although the same binaries built by ld linker did
>     work.
>     
>     It was suspected that gold was keying off the .note.ABI-tag.  Primitive
>     support for this tag had been added years ago from NetBSD, and later
>     Corecode disabled it except for ELF program headers.
>     
>     I removed all the .note.ABI-tag support that had been added after
>     DragonFly forked from FreeBSD and ported over FreeBSD's branding logic
>     and .note.ABI-tag support.  In particular, the branding logic a lot
>     cleaner now, and will easily support 32-bit binaries on x86_64 should
>     this feature arise in DragonFly in the future.
>     
>     With these changes, gold can now build static executables that are
>     recognized and execute.  The Linuxolator had to be modified to work
>     with the new branding scheme as well (i386 only).
> 
> Summary of changes:
>  sys/cpu/i386/misc/elf_machdep.c         |   44 ++-
>  sys/cpu/x86_64/misc/elf_machdep.c       |   43 ++
>  sys/emulation/linux/i386/linux_sysvec.c |  207 ++++-----
>  sys/kern/imgact_elf.c                   |  714 ++++++++++++++-----------------
>  sys/kern/init_main.c                    |   11 +-
>  sys/kern/kern_exec.c                    |    2 +
>  sys/kern/kern_mib.c                     |    2 -
>  sys/sys/imgact_elf.h                    |  105 ++---
>  sys/sys/proc.h                          |    2 +-
>  sys/sys/systm.h                         |    1 +
>  10 files changed, 564 insertions(+), 567 deletions(-)
> 
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/315b8b8b77c1101b25fef36483a8d0474a1befb2
> 
> 






More information about the Commits mailing list