15 Sep, 2016

1 commit

  • Killed PR_REG_SIZE and PR_REG_PTR macro as we can get regset size
    from regset view.
    I wish I could also kill PRSTATUS_SIZE nicely.

    Suggested-by: Oleg Nesterov
    Signed-off-by: Dmitry Safonov
    Cc: 0x7f454c46@gmail.com
    Cc: linux-mm@kvack.org
    Cc: luto@kernel.org
    Cc: gorcunov@openvz.org
    Cc: xemul@virtuozzo.com
    Link: http://lkml.kernel.org/r/20160905133308.28234-5-dsafonov@virtuozzo.com
    Signed-off-by: Thomas Gleixner

    Dmitry Safonov
     

01 Sep, 2016

1 commit

  • We used to delay switching to the new credentials until after we had
    mapped the executable (and possible elf interpreter). That was kind of
    odd to begin with, since the new executable will actually then _run_
    with the new creds, but whatever.

    The bigger problem was that we also want to make sure that we turn off
    prof events and tracing before we start mapping the new executable
    state. So while this is a cleanup, it's also a fix for a possible
    information leak.

    Reported-by: Robert Święcki
    Tested-by: Peter Zijlstra
    Acked-by: David Howells
    Acked-by: Oleg Nesterov
    Acked-by: Andy Lutomirski
    Acked-by: Eric W. Biederman
    Cc: Willy Tarreau
    Cc: Kees Cook
    Cc: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Aug, 2016

1 commit

  • A double-bug exists in the bss calculation code, where an overflow can
    happen in the "last_bss - elf_bss" calculation, but vm_brk internally
    aligns the argument, underflowing it, wrapping back around safe. We
    shouldn't depend on these bugs staying in sync, so this cleans up the
    bss padding handling to avoid the overflow.

    This moves the bss padzero() before the last_bss > elf_bss case, since
    the zero-filling of the ELF_PAGE should have nothing to do with the
    relationship of last_bss and elf_bss: any trailing portion should be
    zeroed, and a zero size is already handled by padzero().

    Then it handles the math on elf_bss vs last_bss correctly. These need
    to both be ELF_PAGE aligned to get the comparison correct, since that's
    the expected granularity of the mappings. Since elf_bss already had
    alignment-based padding happen in padzero(), the "start" of the new
    vm_brk() should be moved forward as done in the original code. However,
    since the "end" of the vm_brk() area will already become PAGE_ALIGNed in
    vm_brk() then last_bss should get aligned here to avoid hiding it as a
    side-effect.

    Additionally makes a cosmetic change to the initial last_bss calculation
    so it's easier to read in comparison to the load_addr calculation above
    it (i.e. the only difference is p_filesz vs p_memsz).

    Link: http://lkml.kernel.org/r/1468014494-25291-2-git-send-email-keescook@chromium.org
    Signed-off-by: Kees Cook
    Reported-by: Hector Marco-Gisbert
    Cc: Ismael Ripoll Ripoll
    Cc: Alexander Viro
    Cc: "Kirill A. Shutemov"
    Cc: Oleg Nesterov
    Cc: Chen Gang
    Cc: Michal Hocko
    Cc: Konstantin Khlebnikov
    Cc: Andrea Arcangeli
    Cc: Andrey Ryabinin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

08 Jun, 2016

1 commit

  • The offset in the core file used to be tracked with ->written field of
    the coredump_params structure. The field was retired in favour of
    file->f_pos.

    However, ->f_pos is not maintained for pipes which leads to breakage.

    Restore explicit tracking of the offset in coredump_params. Introduce
    ->pos field for this purpose since ->written was already reused.

    Fixes: a00839395103 ("get rid of coredump_params->written").

    Reported-by: Zbigniew Jędrzejewski-Szmek
    Signed-off-by: Mateusz Guzik
    Reviewed-by: Omar Sandoval
    Signed-off-by: Al Viro

    Mateusz Guzik
     

28 May, 2016

1 commit

  • The do_brk() and vm_brk() return value was "unsigned long" and returned
    the starting address on success, and an error value on failure. The
    reasons are entirely historical, and go back to it basically behaving
    like the mmap() interface does.

    However, nobody actually wanted that interface, and it causes totally
    pointless IS_ERR_VALUE() confusion.

    What every single caller actually wants is just the simpler integer
    return of zero for success and negative error number on failure.

    So just convert to that much clearer and more common calling convention,
    and get rid of all the IS_ERR_VALUE() uses wrt vm_brk().

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

24 May, 2016

1 commit

  • load_elf_library doesn't handle vm_brk failure although nothing really
    indicates it cannot do that because the function is allowed to fail due
    to vm_mmap failures already. This might be not a problem now but later
    patch will make vm_brk killable (resp. mmap_sem for write waiting will
    become killable) and so the failure will be more probable.

    Signed-off-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Cc: Alexander Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

19 May, 2016

1 commit

  • Pull misc vfs cleanups from Al Viro:
    "Assorted cleanups and fixes all over the place"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    coredump: only charge written data against RLIMIT_CORE
    coredump: get rid of coredump_params->written
    ecryptfs_lookup(): try either only encrypted or plaintext name
    ecryptfs: avoid multiple aliases for directories
    bpf: reject invalid names right in ->lookup()
    __d_alloc(): treat NULL name as QSTR("/", 1)
    mtd: switch ubi_open_volume_path() to vfs_stat()
    mtd: switch open_mtd_by_chdev() to use of vfs_stat()

    Linus Torvalds
     

13 May, 2016

1 commit


05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

28 Feb, 2016

1 commit

  • Replace calls to get_random_int() followed by a cast to (unsigned long)
    with calls to get_random_long(). Also address shifting bug which, in
    case of x86 removed entropy mask for mmap_rnd_bits values > 31 bits.

    Signed-off-by: Daniel Cashman
    Acked-by: Kees Cook
    Cc: "Theodore Ts'o"
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: David S. Miller
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: H. Peter Anvin
    Cc: Al Viro
    Cc: Nick Kralevich
    Cc: Jeff Vander Stoep
    Cc: Mark Salyzyn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Cashman
     

20 Jan, 2016

1 commit

  • Also pass any interpreter's file header to `arch_check_elf' so that any
    architecture handler can have a look at it if needed.

    Signed-off-by: Maciej W. Rozycki
    Acked-by: Andrew Morton
    Acked-by: Al Viro
    Cc: Matthew Fortune
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/11478/
    Signed-off-by: Ralf Baechle

    Maciej W. Rozycki
     

12 Nov, 2015

1 commit

  • Pull vfs update from Al Viro:

    - misc stable fixes

    - trivial kernel-doc and comment fixups

    - remove never-used block_page_mkwrite() wrapper function, and rename
    the function that is _actually_ used to not have double underscores.

    * 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: 9p: cache.h: Add #define of include guard
    vfs: remove stale comment in inode_operations
    vfs: remove unused wrapper block_page_mkwrite()
    binfmt_elf: Correct `arch_check_elf's description
    fs: fix writeback.c kernel-doc warnings
    fs: fix inode.c kernel-doc warning
    fs/pipe.c: return error code rather than 0 in pipe_write()
    fs/pipe.c: preserve alloc_file() error code
    binfmt_elf: Don't clobber passed executable's file header
    FS-Cache: Handle a write to the page immediately beyond the EOF marker
    cachefiles: perform test on s_blocksize when opening cache file.
    FS-Cache: Don't override netfs's primary_index if registering failed
    FS-Cache: Increase reference of parent after registering, netfs success
    debugfs: fix refcount imbalance in start_creating

    Linus Torvalds
     

11 Nov, 2015

2 commits

  • Correct `arch_check_elf's description, mistakenly copied and pasted from
    `arch_elf_pt_proc'.

    Signed-off-by: Maciej W. Rozycki
    Signed-off-by: Al Viro

    Maciej W. Rozycki
     
  • Do not clobber the buffer space passed from `search_binary_handler' and
    originally preloaded by `prepare_binprm' with the executable's file
    header by overwriting it with its interpreter's file header. Instead
    keep the buffer space intact and directly use the data structure locally
    allocated for the interpreter's file header, fixing a bug introduced in
    2.1.14 with loadable module support (linux-mips.org commit beb11695
    [Import of Linux/MIPS 2.1.14], predating kernel.org repo's history).
    Adjust the amount of data read from the interpreter's file accordingly.

    This was not an issue before loadable module support, because back then
    `load_elf_binary' was executed only once for a given ELF executable,
    whether the function succeeded or failed.

    With loadable module support supported and enabled, upon a failure of
    `load_elf_binary' -- which may for example be caused by architecture
    code rejecting an executable due to a missing hardware feature requested
    in the file header -- a module load is attempted and then the function
    reexecuted by `search_binary_handler'. With the executable's file
    header replaced with its interpreter's file header the executable can
    then be erroneously accepted in this subsequent attempt.

    Cc: stable@vger.kernel.org # all the way back
    Signed-off-by: Maciej W. Rozycki
    Signed-off-by: Al Viro

    Maciej W. Rozycki
     

10 Nov, 2015

1 commit

  • Add two new flags to the existing coredump mechanism for ELF files to
    allow us to explicitly filter DAX mappings. This is desirable because
    DAX mappings, like hugetlb mappings, have the potential to be very
    large.

    Update the coredump_filter documentation in
    Documentation/filesystems/proc.txt so that it addresses the new DAX
    coredump flags. Also update the documented default value of
    coredump_filter to be consistent with the core(5) man page. The
    documentation being updated talks about bit 4, Dump ELF headers, which
    is enabled if CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is turned on in the
    kernel config. This kernel config option defaults to "y" if both ELF
    binaries and coredump are enabled.

    Signed-off-by: Ross Zwisler
    Acked-by: Jeff Moyer
    Signed-off-by: Dan Williams

    Ross Zwisler
     

05 Jul, 2015

1 commit

  • Pull more vfs updates from Al Viro:
    "Assorted VFS fixes and related cleanups (IMO the most interesting in
    that part are f_path-related things and Eric's descriptor-related
    stuff). UFS regression fixes (it got broken last cycle). 9P fixes.
    fs-cache series, DAX patches, Jan's file_remove_suid() work"

    [ I'd say this is much more than "fixes and related cleanups". The
    file_table locking rule change by Eric Dumazet is a rather big and
    fundamental update even if the patch isn't huge. - Linus ]

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (49 commits)
    9p: cope with bogus responses from server in p9_client_{read,write}
    p9_client_write(): avoid double p9_free_req()
    9p: forgetting to cancel request on interrupted zero-copy RPC
    dax: bdev_direct_access() may sleep
    block: Add support for DAX reads/writes to block devices
    dax: Use copy_from_iter_nocache
    dax: Add block size note to documentation
    fs/file.c: __fget() and dup2() atomicity rules
    fs/file.c: don't acquire files->file_lock in fd_install()
    fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation
    vfs: avoid creation of inode number 0 in get_next_ino
    namei: make set_root_rcu() return void
    make simple_positive() public
    ufs: use dir_pages instead of ufs_dir_pages()
    pagemap.h: move dir_pages() over there
    remove the pointless include of lglock.h
    fs: cleanup slight list_entry abuse
    xfs: Correctly lock inode when removing suid and file capabilities
    fs: Call security_ops->inode_killpriv on truncate
    fs: Provide function telling whether file_remove_privs() will do anything
    ...

    Linus Torvalds
     

24 Jun, 2015

1 commit


29 May, 2015

1 commit


15 Apr, 2015

3 commits

  • The arch_randomize_brk() function is used on several architectures,
    even those that don't support ET_DYN ASLR. To avoid bulky extern/#define
    tricks, consolidate the support under CONFIG_ARCH_HAS_ELF_RANDOMIZE for
    the architectures that support it, while still handling CONFIG_COMPAT_BRK.

    Signed-off-by: Kees Cook
    Cc: 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
     
  • 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
     
  • With CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE enabled, and a normal top-down
    address allocation strategy, load_elf_binary() will attempt to map a PIE
    binary into an address range immediately below mm->mmap_base.

    Unfortunately, load_elf_ binary() does not take account of the need to
    allocate sufficient space for the entire binary which means that, while
    the first PT_LOAD segment is mapped below mm->mmap_base, the subsequent
    PT_LOAD segment(s) end up being mapped above mm->mmap_base into the are
    that is supposed to be the "gap" between the stack and the binary.

    Since the size of the "gap" on x86_64 is only guaranteed to be 128MB this
    means that binaries with large data segments > 128MB can end up mapping
    part of their data segment over their stack resulting in corruption of the
    stack (and the data segment once the binary starts to run).

    Any PIE binary with a data segment > 128MB is vulnerable to this although
    address randomization means that the actual gap between the stack and the
    end of the binary is normally greater than 128MB. The larger the data
    segment of the binary the higher the probability of failure.

    Fix this by calculating the total size of the binary in the same way as
    load_elf_interp().

    Signed-off-by: Michael Davidson
    Cc: Alexander Viro
    Cc: Jiri Kosina
    Cc: Kees Cook
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Davidson
     

19 Feb, 2015

1 commit

  • The issue is that the stack for processes is not properly randomized on
    64 bit architectures due to an integer overflow.

    The affected function is randomize_stack_top() in file
    "fs/binfmt_elf.c":

    static unsigned long randomize_stack_top(unsigned long stack_top)
    {
    unsigned int random_variable = 0;

    if ((current->flags & PF_RANDOMIZE) &&
    !(current->personality & ADDR_NO_RANDOMIZE)) {
    random_variable = get_random_int() & STACK_RND_MASK;
    random_variable <<
    Signed-off-by: Ismael Ripoll
    [ Rebased, fixed 80 char bugs, cleaned up commit message, added test example and CVE ]
    Signed-off-by: Kees Cook
    Cc:
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: Al Viro
    Fixes: CVE-2015-1593
    Link: http://lkml.kernel.org/r/20150214173350.GA18393@www.outflux.net
    Signed-off-by: Borislav Petkov

    Hector Marco-Gisbert
     

12 Dec, 2014

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is an unusually large pull request for MIPS - in parts because
    lots of patches missed the 3.18 deadline but primarily because some
    folks opened the flood gates.

    - Retire the MIPS-specific phys_t with the generic phys_addr_t.
    - Improvments for the backtrace code used by oprofile.
    - Better backtraces on SMP systems.
    - Cleanups for the Octeon platform code.
    - Cleanups and fixes for the Loongson platform code.
    - Cleanups and fixes to the firmware library.
    - Switch ATH79 platform to use the firmware library.
    - Grand overhault to the SEAD3 and Malta interrupt code.
    - Move the GIC interrupt code to drivers/irqchip
    - Lots of GIC cleanups and updates to the GIC code to use modern IRQ
    infrastructures and features of the kernel.
    - OF documentation updates for the GIC bindings
    - Move GIC clocksource driver to drivers/clocksource
    - Merge GIC clocksource driver with clockevent driver.
    - Further updates to bring the GIC clocksource driver up to date.
    - R3000 TLB code cleanups
    - Improvments to the Loongson 3 platform code.
    - Convert pr_warning to pr_warn.
    - Merge a bunch of small lantiq and ralink fixes that have been
    staged/lingering inside the openwrt tree for a while.
    - Update archhelp for IP22/IP32
    - Fix a number of issues for Loongson 1B.
    - New clocksource and clockevent driver for Loongson 1B.
    - Further work on clk handling for Loongson 1B.
    - Platform work for Broadcom BMIPS.
    - Error handling cleanups for TurboChannel.
    - Fixes and optimization to the microMIPS support.
    - Option to disable the FTLB.
    - Dump more relevant information on machine check exception
    - Change binfmt to allow arch to examine PT_*PROC headers
    - Support for new style FPU register model in O32
    - VDSO randomization.
    - BCM47xx cleanups
    - BCM47xx reimplement the way the kernel accesses NVRAM information.
    - Random cleanups
    - Add support for ATH25 platforms
    - Remove pointless locking code in some PCI platforms.
    - Some improvments to EVA support
    - Minor Alchemy cleanup"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (185 commits)
    MIPS: Add MFHC0 and MTHC0 instructions to uasm.
    MIPS: Cosmetic cleanups of page table headers.
    MIPS: Add CP0 macros for extended EntryLo registers
    MIPS: Remove now unused definition of phys_t.
    MIPS: Replace use of phys_t with phys_addr_t.
    MIPS: Replace MIPS-specific 64BIT_PHYS_ADDR with generic PHYS_ADDR_T_64BIT
    PCMCIA: Alchemy Don't select 64BIT_PHYS_ADDR in Kconfig.
    MIPS: lib: memset: Clean up some MIPS{EL,EB} ifdefery
    MIPS: iomap: Use __mem_{read,write}{b,w,l} for MMIO
    MIPS: fix indentation.
    MAINTAINERS: Add entry for BMIPS multiplatform kernel
    MIPS: Enable VDSO randomization
    MIPS: Remove a temporary hack for debugging cache flushes in SMTC configuration
    MIPS: Remove declaration of obsolete arch_init_clk_ops()
    MIPS: atomic.h: Reformat to fit in 79 columns
    MIPS: Apply `.insn' to fixup labels throughout
    MIPS: Fix microMIPS LL/SC immediate offsets
    MIPS: Kconfig: Only allow 32-bit microMIPS builds
    MIPS: signal.c: Fix an invalid cast in ISA mode bit handling
    MIPS: mm: Only build one microassembler that is suitable
    ...

    Linus Torvalds
     

11 Dec, 2014

1 commit

  • vma_dump_size() has been used several times on actual dumper and it is
    supposed to return the same value for the same vma. But vma_dump_size()
    could return different values for same vma.

    The known problem case is concurrent shared memory removal. If a vma is
    used for a shared memory and that shared memory is removed between
    writing program header and dumping vma memory, this will result in a
    dump file which is internally consistent.

    To fix the problem, we set baseline to get dump size and store the size
    into vma_filesz and always use the same vma dump size which is stored in
    vma_filsz. The consistnecy with reality is not actually guranteed, but
    it's tolerable since that is fully consistent with base line.

    Signed-off-by: Jungseung Lee
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jungseung Lee
     

24 Nov, 2014

3 commits

  • 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
     
  • Load the program headers of an ELF interpreter early enough in
    load_elf_binary that they can be examined before it's too late to return
    an error from an exec syscall. This patch does not perform any such
    checking, it merely lays the groundwork for a further patch to do so.

    No functional change is intended.

    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/7675/
    Signed-off-by: Ralf Baechle

    Paul Burton
     
  • load_elf_binary & load_elf_interp both load program headers from an ELF
    executable in the same way, duplicating the code. This patch introduces
    a helper function (load_elf_phdrs) which performs this common task &
    calls it from both load_elf_binary & load_elf_interp. In addition to
    reducing code duplication, this is part of preparing to load the ELF
    interpreter headers earlier such that they can be examined before it's
    too late to return an error from an exec syscall.

    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/7676/
    Signed-off-by: Ralf Baechle

    Paul Burton
     

09 Oct, 2014

1 commit


05 Jun, 2014

2 commits

  • Pull x86 cdso updates from Peter Anvin:
    "Vdso cleanups and improvements largely from Andy Lutomirski. This
    makes the vdso a lot less ''special''"

    * 'x86/vdso' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/vdso, build: Make LE access macros clearer, host-safe
    x86/vdso, build: Fix cross-compilation from big-endian architectures
    x86/vdso, build: When vdso2c fails, unlink the output
    x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
    x86, mm: Replace arch_vma_name with vm_ops->name for vsyscalls
    x86, mm: Improve _install_special_mapping and fix x86 vdso naming
    mm, fs: Add vm_ops->name as an alternative to arch_vma_name
    x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
    x86, vdso: Remove vestiges of VDSO_PRELINK and some outdated comments
    x86, vdso: Move the vvar and hpet mappings next to the 64-bit vDSO
    x86, vdso: Move the 32-bit vdso special pages after the text
    x86, vdso: Reimplement vdso.so preparation in build-time C
    x86, vdso: Move syscall and sysenter setup into kernel/cpu/common.c
    x86, vdso: Clean up 32-bit vs 64-bit vdso params
    x86, mm: Ensure correct alignment of the fixmap

    Linus Torvalds
     
  • Fix coccinelle warnings.

    Signed-off-by: Fabian Frederick
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

21 May, 2014

1 commit

  • arch_vma_name sucks. It's a silly hack, and it's annoying to
    implement correctly. In fact, AFAICS, even the straightforward x86
    implementation is incorrect (I suspect that it breaks if the vdso
    mapping is split or gets remapped).

    This adds a new vm_ops->name operation that can replace it. The
    followup patches will remove all uses of arch_vma_name on x86,
    fixing a couple of annoyances in the process.

    Signed-off-by: Andy Lutomirski
    Link: http://lkml.kernel.org/r/2eee21791bb36a0a408c5c2bdb382a9e6a41ca4a.1400538962.git.luto@amacapital.net
    Signed-off-by: H. Peter Anvin

    Andy Lutomirski
     

08 Apr, 2014

1 commit

  • load_elf_binary() sets current->mm->def_flags = def_flags and def_flags
    is always zero. Not only this looks strange, this is unnecessary
    because mm_init() has already set ->def_flags = 0.

    Signed-off-by: Alex Thorlton
    Suggested-by: Oleg Nesterov
    Cc: Gerald Schaefer
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Christian Borntraeger
    Cc: Paolo Bonzini
    Cc: "Kirill A. Shutemov"
    Cc: Mel Gorman
    Acked-by: Rik van Riel
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Andrea Arcangeli
    Cc: Oleg Nesterov
    Cc: "Eric W. Biederman"
    Cc: Alexander Viro
    Cc: Johannes Weiner
    Cc: David Rientjes
    Cc: Paolo Bonzini
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alex Thorlton
     

04 Apr, 2014

1 commit

  • uselib hasn't been used since libc5; glibc does not use it. Support
    turning it off.

    When disabled, also omit the load_elf_library implementation from
    binfmt_elf.c, which only uselib invokes.

    bloat-o-meter:
    add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-785 (-785)
    function old new delta
    padzero 39 36 -3
    uselib_flags 20 - -20
    sys_uselib 168 - -168
    SyS_uselib 168 - -168
    load_elf_library 426 - -426

    The new CONFIG_USELIB defaults to `y'.

    Signed-off-by: Josh Triplett
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josh Triplett
     

24 Jan, 2014

1 commit


09 Nov, 2013

6 commits