12 Aug, 2016

1 commit


28 Jul, 2016

1 commit

  • Now that the generic changes are in place, this can be enabled on m68k
    with the use of proper user space accessors in the flat_get_addr_from_rp()
    and flat_put_addr_at_rp() handlers as rp actually holds a user space
    address.

    Signed-off-by: Nicolas Pitre
    Signed-off-by: Greg Ungerer

    Nicolas Pitre
     

24 May, 2016

1 commit

  • CONFIG_MIPS32_N32=y but CONFIG_BINFMT_ELF disabled results in the
    following linker errors:

    arch/mips/built-in.o: In function `elf_core_dump':
    binfmt_elfn32.c:(.text+0x23dbc): undefined reference to `elf_core_extra_phdrs'
    binfmt_elfn32.c:(.text+0x246e4): undefined reference to `elf_core_extra_data_size'
    binfmt_elfn32.c:(.text+0x248d0): undefined reference to `elf_core_write_extra_phdrs'
    binfmt_elfn32.c:(.text+0x24ac4): undefined reference to `elf_core_write_extra_data'

    CONFIG_MIPS32_O32=y but CONFIG_BINFMT_ELF disabled results in the following
    linker errors:

    arch/mips/built-in.o: In function `elf_core_dump':
    binfmt_elfo32.c:(.text+0x28a04): undefined reference to `elf_core_extra_phdrs'
    binfmt_elfo32.c:(.text+0x29330): undefined reference to `elf_core_extra_data_size'
    binfmt_elfo32.c:(.text+0x2951c): undefined reference to `elf_core_write_extra_phdrs'
    binfmt_elfo32.c:(.text+0x29710): undefined reference to `elf_core_write_extra_data'

    This is because binfmt_elfn32 and binfmt_elfo32 are using symbols from
    elfcore but for these configurations elfcore will not be built.

    Fixed by making elfcore selectable by a separate config symbol which
    unlike the current mechanism can also be used from other directories
    than kernel/, then having each flavor of ELF that relies on elfcore.o,
    select it in Kconfig, including CONFIG_MIPS32_N32 and CONFIG_MIPS32_O32
    which fixes this issue.

    Link: http://lkml.kernel.org/r/20160520141705.GA1913@linux-mips.org
    Signed-off-by: Ralf Baechle
    Reviewed-by: James Hogan
    Cc: "Maciej W. Rozycki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ralf Baechle
     

15 Apr, 2015

1 commit

  • This fixes the "offset2lib" weakness in ASLR for arm, arm64, mips,
    powerpc, and x86. The problem is that if there is a leak of ASLR from
    the executable (ET_DYN), it means a leak of shared library offset as
    well (mmap), and vice versa. Further details and a PoC of this attack
    is available here:

    http://cybersecurity.upv.es/attacks/offset2lib/offset2lib.html

    With this patch, a PIE linked executable (ET_DYN) has its own ASLR
    region:

    $ ./show_mmaps_pie
    54859ccd6000-54859ccd7000 r-xp ... /tmp/show_mmaps_pie
    54859ced6000-54859ced7000 r--p ... /tmp/show_mmaps_pie
    54859ced7000-54859ced8000 rw-p ... /tmp/show_mmaps_pie
    7f75be764000-7f75be91f000 r-xp ... /lib/x86_64-linux-gnu/libc.so.6
    7f75be91f000-7f75beb1f000 ---p ... /lib/x86_64-linux-gnu/libc.so.6
    7f75beb1f000-7f75beb23000 r--p ... /lib/x86_64-linux-gnu/libc.so.6
    7f75beb23000-7f75beb25000 rw-p ... /lib/x86_64-linux-gnu/libc.so.6
    7f75beb25000-7f75beb2a000 rw-p ...
    7f75beb2a000-7f75beb4d000 r-xp ... /lib64/ld-linux-x86-64.so.2
    7f75bed45000-7f75bed46000 rw-p ...
    7f75bed46000-7f75bed47000 r-xp ...
    7f75bed47000-7f75bed4c000 rw-p ...
    7f75bed4c000-7f75bed4d000 r--p ... /lib64/ld-linux-x86-64.so.2
    7f75bed4d000-7f75bed4e000 rw-p ... /lib64/ld-linux-x86-64.so.2
    7f75bed4e000-7f75bed4f000 rw-p ...
    7fffb3741000-7fffb3762000 rw-p ... [stack]
    7fffb377b000-7fffb377d000 r--p ... [vvar]
    7fffb377d000-7fffb377f000 r-xp ... [vdso]

    The change is to add a call the newly created arch_mmap_rnd() into the
    ELF loader for handling ET_DYN ASLR in a separate region from mmap ASLR,
    as was already done on s390. Removes CONFIG_BINFMT_ELF_RANDOMIZE_PIE,
    which is no longer needed.

    Signed-off-by: Kees Cook
    Reported-by: Hector Marco-Gisbert
    Cc: Russell King
    Reviewed-by: Ingo Molnar
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Alexander Viro
    Cc: Oleg Nesterov
    Cc: Andy Lutomirski
    Cc: "David A. Long"
    Cc: Andrey Ryabinin
    Cc: Arun Chandran
    Cc: Yann Droneaud
    Cc: Min-Hua Chen
    Cc: Paul Burton
    Cc: Alex Smith
    Cc: Markos Chandras
    Cc: Vineeth Vijayan
    Cc: Jeff Bailey
    Cc: Michael Holzheu
    Cc: Ben Hutchings
    Cc: Behan Webster
    Cc: Ismael Ripoll
    Cc: Jan-Simon Mller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

17 Feb, 2015

1 commit

  • The parisc arch has been the only user of HP-UX SOM binaries.

    Support for HP-UX executables was never finished and since we now drop support
    for the HP-UX compat layer anyway, it does not makes sense to keep the
    BINFMT_SOM support.

    Cc: linux-fsdevel@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Signed-off-by: Helge Deller

    Helge Deller
     

24 Nov, 2014

1 commit

  • MIPS is introducing new variants of its O32 ABI which differ in their
    handling of floating point, in order to enable a gradual transition
    towards a world where mips32 binaries can take advantage of new hardware
    features only available when configured for certain FP modes. In order
    to do this ELF binaries are being augmented with a new section that
    indicates, amongst other things, the FP mode requirements of the binary.
    The presence & location of such a section is indicated by a program
    header in the PT_LOPROC ... PT_HIPROC range.

    In order to allow the MIPS architecture code to examine the program
    header & section in question, pass all program headers in this range
    to an architecture-specific arch_elf_pt_proc function. This function
    may return an error if the header is deemed invalid or unsuitable for
    the system, in which case that error will be returned from
    load_elf_binary and upwards through the execve syscall.

    A means is required for the architecture code to make a decision once
    it is known that all such headers have been seen, but before it is too
    late to return from an execve syscall. For this purpose the
    arch_check_elf function is added, and called once, after all PT_LOPROC
    to PT_HIPROC headers have been passed to arch_elf_pt_proc but before
    the code which invoked execve has been lost. This enables the
    architecture code to make a decision based upon all the headers present
    in an ELF binary and its interpreter, as is required to forbid
    conflicting FP ABI requirements between an ELF & its interpreter.

    In order to allow data to be stored throughout the calls to the above
    functions, struct arch_elf_state is introduced.

    Finally a variant of the SET_PERSONALITY macro is introduced which
    accepts a pointer to the struct arch_elf_state, allowing it to act
    based upon state observed from the architecture specific program
    headers.

    Signed-off-by: Paul Burton
    Cc: linux-mips@linux-mips.org
    Cc: Alexander Viro
    Cc: linux-fsdevel@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/7679/
    Signed-off-by: Ralf Baechle

    Paul Burton
     

01 May, 2013

1 commit

  • Add a new configuration option CONFIG_BINFMT_SCRIPT to configure support
    for interpreted scripts starting with "#!"; allow compiling out that
    support, or building it as a module. Embedded systems running exclusively
    compiled binaries could leave this support out, and systems that don't
    need scripts before mounting the root filesystem can build this as a
    module.

    Signed-off-by: Josh Triplett
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josh Triplett
     

06 Oct, 2012

1 commit

  • Adds an expert Kconfig option, CONFIG_COREDUMP, which allows disabling of
    core dump. This saves approximately 2.6k in the compiled kernel, and
    complements CONFIG_ELF_CORE, which now depends on it.

    CONFIG_COREDUMP also disables coredump-related sysctls, except for
    suid_dumpable and related functions, which are necessary for ptrace.

    [akpm@linux-foundation.org: fix binfmt_aout.c build]
    Signed-off-by: Alex Kelly
    Reviewed-by: Josh Triplett
    Acked-by: Serge Hallyn
    Acked-by: Kees Cook
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alex Kelly
     

15 May, 2012

1 commit

  • C6x userspace supports a shared library mechanism called DSBT for systems with
    no MMU. DSBT is similar to FDPIC in allowing shared text segments and private
    copies of data segments without an MMU. Both methods access data using a base
    register and offset. With FDPIC, the caller of an external function sets up the
    base register for the callee. With DSBT, the called function sets up its own
    base register. Other details differ but both userspaces need the same thing
    from the kernel loader: a map of where each ELF segment was loaded. The FDPIC
    loader already provides this, so DSBT just uses it.

    This patch enables BINFMT_ELF_FDPIC by default for C6X and provides the
    necessary architecture hooks for the generic loader.

    Signed-off-by: Mark Salter

    Mark Salter
     

11 Jan, 2012

1 commit

  • Randomization of PIE load address is hard coded in binfmt_elf.c for X86
    and ARM. Create a new Kconfig variable
    (CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE) for this and use it instead. Thus
    architecture specific policy is pushed out of the generic binfmt_elf.c and
    into the architecture Kconfig files.

    X86 and ARM Kconfigs are modified to select the new variable so there is
    no change in behavior. A follow on patch will select it for MIPS too.

    Signed-off-by: David Daney
    Cc: Russell King
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Alexander Viro
    Acked-by: H. Peter Anvin
    Cc: Ralf Baechle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Daney
     

28 Oct, 2010

1 commit

  • The userland ELF tools have been coping with partial-segments core files
    for a few years now. Multiple distro builds are now setting this option.
    It behooves everyone who ever deals with core files to have more info
    dumped in there, especially as more and more people's compilers are
    producing build IDs. Make it the default.

    Anyone using older tools confused by these core files can configure this
    option off, or just change /proc/PID/coredump_filter after boot.

    Signed-off-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     

10 Jan, 2009

1 commit

  • Kernels that don't support ELF coredumps at all surely can't be supporting
    new partial-segment flavored ELF coredumps ... don't make folk answer
    Kconfig questions about that flavor.

    Signed-off-by: David Brownell
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

20 Oct, 2008

1 commit

  • This adds a kconfig option to change the /proc/PID/coredump_filter default.
    Fedora has been carrying a trivial patch to change the hard-wired value for
    this default, since Fedora 8. The default default can't change safely
    because there are old GDB versions out there (all before 6.7) that are
    confused by the core dump files created by the MMF_DUMP_ELF_HEADERS setting.

    Signed-off-by: Roland McGrath
    Cc: Michael Kerrisk
    Cc: Oleg Nesterov
    Cc: Alan Cox
    Cc: Andi Kleen
    Cc: KOSAKI Motohiro
    Cc: Kawai Hidehiro
    Cc: Ingo Molnar
    Cc: David Jones
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     

17 Oct, 2008

1 commit


07 Sep, 2008

2 commits


28 Jul, 2008

1 commit


07 Jun, 2008

1 commit

  • Fix the following compile error:

    CC fs/binfmt_flat.o
    In file included from
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:36:
    /home/bunk/linux/kernel-2.6/git/linux-2.6/include/linux/flat.h:14:22: error: asm/flat.h: No such file or directory
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c: In function 'create_flat_tables':
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:124: error: implicit declaration of function 'flat_stack_align'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:125: error: implicit declaration of function 'flat_argvp_envp_on_stack'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c: In function 'calc_reloc':
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:347: error: implicit declaration of function 'flat_reloc_valid'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c: In function 'load_flat_file':
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:479: error: implicit declaration of function 'flat_old_ram_flag'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:755: error: implicit declaration of function 'flat_set_persistent'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:757: error: implicit declaration of function 'flat_get_relocate_addr'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:765: error: implicit declaration of function 'flat_get_addr_from_rp'
    /home/bunk/linux/kernel-2.6/git/linux-2.6/fs/binfmt_flat.c:781: error: implicit declaration of function 'flat_put_addr_at_rp'

    Reported-by: Adrian Bunk
    Signed-off-by: Adrian Bunk
    Tested-by: David Howells
    Acked-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

29 Apr, 2008

1 commit

  • I have not yet seen anyone saying he has a reasonable use case for using
    BINFMT_FLAT modular on his embedded device.

    Considering that fs/binfmt_flat.c even lacks a MODULE_LICENSE() I really doubt
    there is any, and this patch therefore makes BINFMT_FLAT a bool.

    Signed-off-by: Adrian Bunk
    Acked-by: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

22 Apr, 2008

1 commit


09 Feb, 2008

1 commit

  • Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set.

    Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
    be permitted to go looking for A.OUT libraries to load in such a case. Not
    only that, but under such conditions A.OUT core dumps are not produced either.

    To make this work, this patch also does the following:

    (1) Makes the existence of the contents of linux/a.out.h contingent on
    CONFIG_ARCH_SUPPORTS_AOUT.

    (2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
    core dumping code.

    (3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline. This
    is then included only where needed. This means that this bit of arch
    code will be stored in the appropriate A.OUT binfmt module rather than
    the core kernel.

    (4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not
    needed) and FRV.

    This patch depends on the previous patch to move STACK_TOP[_MAX] out of
    asm/a.out.h and into asm/processor.h as they're required whether or not A.OUT
    format is available.

    [jdike@addtoit.com: uml: re-remove accidentally restored code]
    Signed-off-by: David Howells
    Cc:
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

30 Jan, 2008

1 commit

  • This adds Kconfig and Makefile bits to build fs/compat_binfmt_elf.c,
    just added. Each arch that wants to use this file needs to add a
    "select COMPAT_BINFMT_ELF" line in its Kconfig bits that enable COMPAT.

    Signed-off-by: Roland McGrath
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     

21 May, 2007

1 commit

  • Not really sure where this bogosity came from, but there's certainly
    nothing special about sh that lets us use flat files with the MMU on.

    Kill the dependency, and leave it as !MMU, like it is for all of the
    other nommu-wielding ports.

    Signed-off-by: Paul Mundt

    Paul Mundt
     

08 May, 2007

1 commit

  • This adds support for the Analog Devices Blackfin processor architecture, and
    currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561
    (Dual Core) devices, with a variety of development platforms including those
    avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP,
    BF561-EZKIT), and Bluetechnix! Tinyboards.

    The Blackfin architecture was jointly developed by Intel and Analog Devices
    Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in
    December of 2000. Since then ADI has put this core into its Blackfin
    processor family of devices. The Blackfin core has the advantages of a clean,
    orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC
    (Multiply/Accumulate), state-of-the-art signal processing engine and
    single-instruction, multiple-data (SIMD) multimedia capabilities into a single
    instruction-set architecture.

    The Blackfin architecture, including the instruction set, is described by the
    ADSP-BF53x/BF56x Blackfin Processor Programming Reference
    http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf

    The Blackfin processor is already supported by major releases of gcc, and
    there are binary and source rpms/tarballs for many architectures at:
    http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete
    documentation, including "getting started" guides available at:
    http://docs.blackfin.uclinux.org/ which provides links to the sources and
    patches you will need in order to set up a cross-compiling environment for
    bfin-linux-uclibc

    This patch, as well as the other patches (toolchain, distribution,
    uClibc) are actively supported by Analog Devices Inc, at:
    http://blackfin.uclinux.org/

    We have tested this on LTP, and our test plan (including pass/fails) can
    be found at:
    http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel

    [m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files]
    Signed-off-by: Bryan Wu
    Signed-off-by: Mariusz Kozlowski
    Signed-off-by: Aubrey Li
    Signed-off-by: Jie Zhang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bryan Wu
     

09 Jan, 2006

1 commit


31 Oct, 2005

1 commit

  • Add CONFIG_X86_32 for i386. This allows selecting options that only apply
    to 32-bit systems.

    (X86 && !X86_64) becomes X86_32
    (X86 || X86_64) becomes X86

    Signed-off-by: Brian Gerst
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Brian Gerst
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds