08 Jun, 2014

1 commit

  • commit fa81511bb0bbb2b1aace3695ce869da9762624ff upstream.

    Checkin:

    b3b42ac2cbae x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels

    disabled 16-bit segments on 64-bit kernels due to an information
    leak. However, it does seem that people are genuinely using Wine to
    run old 16-bit Windows programs on Linux.

    A proper fix for this ("espfix64") is coming in the upcoming merge
    window, but as a temporary fix, create a sysctl to allow the
    administrator to re-enable support for 16-bit segments.

    It adds a "/proc/sys/abi/ldt16" sysctl that defaults to zero (off). If
    you hit this issue and care about your old Windows program more than
    you care about a kernel stack address information leak, you can do

    echo 1 > /proc/sys/abi/ldt16

    as root (add it to your startup scripts), and you should be ok.

    The sysctl table is only added if you have COMPAT support enabled on
    x86-64, but I assume anybody who runs old windows binaries very much
    does that ;)

    Signed-off-by: H. Peter Anvin
    Link: http://lkml.kernel.org/r/CA%2B55aFw9BPoD10U1LfHbOMpHWZkvJTkMcfCs9s3urPr1YyWBxw@mail.gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Linus Torvalds
     

19 Jun, 2013

1 commit


08 Jun, 2012

1 commit


30 Mar, 2012

1 commit

  • Pull x32 support for x86-64 from Ingo Molnar:
    "This tree introduces the X32 binary format and execution mode for x86:
    32-bit data space binaries using 64-bit instructions and 64-bit kernel
    syscalls.

    This allows applications whose working set fits into a 32 bits address
    space to make use of 64-bit instructions while using a 32-bit address
    space with shorter pointers, more compressed data structures, etc."

    Fix up trivial context conflicts in arch/x86/{Kconfig,vdso/vma.c}

    * 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
    x32: Fix alignment fail in struct compat_siginfo
    x32: Fix stupid ia32/x32 inversion in the siginfo format
    x32: Add ptrace for x32
    x32: Switch to a 64-bit clock_t
    x32: Provide separate is_ia32_task() and is_x32_task() predicates
    x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls
    x86/x32: Fix the binutils auto-detect
    x32: Warn and disable rather than error if binutils too old
    x32: Only clear TIF_X32 flag once
    x32: Make sure TS_COMPAT is cleared for x32 tasks
    fs: Remove missed ->fds_bits from cessation use of fd_set structs internally
    fs: Fix close_on_exec pointer in alloc_fdtable
    x32: Drop non-__vdso weak symbols from the x32 VDSO
    x32: Fix coding style violations in the x32 VDSO code
    x32: Add x32 VDSO support
    x32: Allow x32 to be configured
    x32: If configured, add x32 system calls to system call tables
    x32: Handle process creation
    x32: Signal-related system calls
    x86: Add #ifdef CONFIG_COMPAT to
    ...

    Linus Torvalds
     

24 Mar, 2012

1 commit

  • The motivation for this patchset was that I was looking at a way for a
    qemu-kvm process, to exclude the guest memory from its core dump, which
    can be quite large. There are already a number of filter flags in
    /proc//coredump_filter, however, these allow one to specify 'types'
    of kernel memory, not specific address ranges (which is needed in this
    case).

    Since there are no more vma flags available, the first patch eliminates
    the need for the 'VM_ALWAYSDUMP' flag. The flag is used internally by
    the kernel to mark vdso and vsyscall pages. However, it is simple
    enough to check if a vma covers a vdso or vsyscall page without the need
    for this flag.

    The second patch then replaces the 'VM_ALWAYSDUMP' flag with a new
    'VM_NODUMP' flag, which can be set by userspace using new madvise flags:
    'MADV_DONTDUMP', and unset via 'MADV_DODUMP'. The core dump filters
    continue to work the same as before unless 'MADV_DONTDUMP' is set on the
    region.

    The qemu code which implements this features is at:

    http://people.redhat.com/~jbaron/qemu-dump/qemu-dump.patch

    In my testing the qemu core dump shrunk from 383MB -> 13MB with this
    patch.

    I also believe that the 'MADV_DONTDUMP' flag might be useful for
    security sensitive apps, which might want to select which areas are
    dumped.

    This patch:

    The VM_ALWAYSDUMP flag is currently used by the coredump code to
    indicate that a vma is part of a vsyscall or vdso section. However, we
    can determine if a vma is in one these sections by checking it against
    the gate_vma and checking for a non-NULL return value from
    arch_vma_name(). Thus, freeing a valuable vma bit.

    Signed-off-by: Jason Baron
    Acked-by: Roland McGrath
    Cc: Chris Metcalf
    Cc: Avi Kivity
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jason Baron
     

22 Feb, 2012

1 commit


21 Feb, 2012

1 commit

  • Add support for the x32 VDSO. The x32 VDSO takes advantage of the
    similarity between the x86-64 and the x32 ABIs to contain the same
    content, only the container is different, as the x32 VDSO obviously is
    an x32 shared object.

    Signed-off-by: H. Peter Anvin

    H. J. Lu
     

24 Mar, 2011

3 commits

  • Now that gate vma's are referenced with respect to a particular mm and not a
    particular task it only makes sense to propagate the change to this predicate as
    well.

    Signed-off-by: Stephen Wilson
    Reviewed-by: Michel Lespinasse
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Al Viro

    Stephen Wilson
     
  • Morally, the question of whether an address lies in a gate vma should be asked
    with respect to an mm, not a particular task. Moreover, dropping the dependency
    on task_struct will help make existing and future operations on mm's more
    flexible and convenient.

    Signed-off-by: Stephen Wilson
    Reviewed-by: Michel Lespinasse
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Al Viro

    Stephen Wilson
     
  • Morally, the presence of a gate vma is more an attribute of a particular mm than
    a particular task. Moreover, dropping the dependency on task_struct will help
    make both existing and future operations on mm's more flexible and convenient.

    Signed-off-by: Stephen Wilson
    Reviewed-by: Michel Lespinasse
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Al Viro

    Stephen Wilson
     

19 Jun, 2010

1 commit

  • When initrd is in use and a driver does request_module() in its
    module_init (i.e. __initcall or device_initcall), a modprobe process
    is created with VDSO mapping. But VDSO is inited even in __initcall,
    i.e. on the same level (at the same time), so it may not be inited
    yet (link order matters).

    Move the VDSO initialization code earlier by switching to something
    before rootfs_initcall where initrd is loaded as rootfs. Specifically
    to subsys_initcall. Do it for standard 64-bit path (init_vdso_vars)
    and for compat (sysenter_setup), just in case people have 32-bit
    initrd and ia32 emulation built-in.

    i386 (pure 32-bit) is not affected, since sysenter_setup() is called
    from check_bugs()->identify_boot_cpu() in start_kernel() before
    rest_init()->kernel_thread(kernel_init) where even kernel_init() calls
    do_basic_setup()->do_initcalls().

    What this patch fixes are early modprobe crashes such as:
    Unpacking initramfs...
    Freeing initrd memory: 9324k freed
    modprobe[368]: segfault at 7fff4429c020 ip 00007fef397e160c \
    sp 00007fff442795c0 error 4 in ld-2.11.2.so[7fef397df000+1f000]

    Signed-off-by: Jiri Slaby
    LKML-Reference:
    Signed-off-by: H. Peter Anvin

    Jiri Slaby
     

12 Nov, 2009

1 commit


05 Jun, 2009

1 commit

  • In order to make arch_vma_name() work from inside
    install_special_mapping() we need to set the context.vdso
    before calling it.

    ( This is needed for performance counters to be able to track
    this special executable area. )

    Signed-off-by: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

25 Dec, 2008

1 commit

  • arch_setup_additional_pages currently gets two arguments, the binary
    format descripton and an indication if the process uses an executable
    stack or not. The second argument is not used by anybody, it could
    be removed without replacement.

    What actually does make sense is to pass an indication if the process
    uses the elf interpreter or not. The glibc code will not use anything
    from the vdso if the process does not use the dynamic linker, so for
    statically linked binaries the architecture backend can choose not
    to map the vdso.

    Acked-by: Ingo Molnar
    Signed-off-by: Martin Schwidefsky

    Martin Schwidefsky
     

16 Jul, 2008

1 commit

  • AMD only supports "syscall" from 32-bit compat usermode.
    Intel and Centaur(?) only support "sysenter" from 32-bit compat usermode.

    Set the X86 feature bits accordingly, and set up the vdso in
    accordance with those bits. On the offchance we run on in a 64-bit
    environment which supports neither syscall nor sysenter from 32-bit
    mode, then fall back to the int $0x80 vdso.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: H. Peter Anvin

    Jeremy Fitzhardinge
     

11 Jul, 2008

1 commit


05 May, 2008

1 commit


01 May, 2008

1 commit

  • The kernel prints the compat vdso address regardless of whether compat
    vdso mode is enabled or not, which is confusing. Given that this
    isn't very interesting information anyway, just remove the printk.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: Gerhard Mack
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     

17 Apr, 2008

2 commits

  • Upcoming 64 bit processors from Centaur can use sysenter.

    Signed-off-by: Dave Jones
    Signed-off-by: Jesse Ahrens
    Signed-off-by: Ingo Molnar

    Dave Jones
     
  • We map a VMA for the 32-bit vDSO even when it's disabled, which is stupid.
    For the 32-bit kernel it's the vdso_enabled boot parameter/sysctl
    and for the 64-bit kernel it's the vdso32 boot parameter/syscall32 sysctl.

    When it's disabled, we don't pass AT_SYSINFO_EHDR so processes don't use
    the vDSO for anything, but we still map it. For the non-compat vDSO,
    this means we're always putting an extra VMA somewhere, maybe lousing
    up the control of the address space the user was hoping for.

    Honor the setting by doing nothing in arch_setup_additional_pages.

    [ also see: "x86 vDSO: don't use disabled vDSO for signal trampoline" ]

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

    Roland McGrath
     

30 Jan, 2008

5 commits

  • This switches x86-64's 32-bit ELF support to use the shared
    fs/compat_binfmt_elf.c code instead of our own ia32_binfmt.c.

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

    Roland McGrath
     
  • This changes size-specific register names (eip/rip, esp/rsp, etc.) to
    generic names in the thread and tss structures.

    Signed-off-by: H. Peter Anvin
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    H. Peter Anvin
     
  • This makes x86_64's ia32 emulation support share the sources used in the
    32-bit kernel for the 32-bit vDSO and much of its setup code.

    The 32-bit vDSO mapping now behaves the same on x86_64 as on native 32-bit.
    The abi.syscall32 sysctl on x86_64 now takes the same values that
    vm.vdso_enabled takes on the 32-bit kernel. That is, 1 means a randomized
    vDSO location, 2 means the fixed old address. The CONFIG_COMPAT_VDSO
    option is now available to make this the default setting, the same meaning
    it has for the 32-bit kernel. (This does not affect the 64-bit vDSO.)

    The argument vdso32=[012] can be used on both 32-bit and 64-bit kernels to
    set this paramter at boot time. The vdso=[012] argument still does this
    same thing on the 32-bit kernel.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     
  • This harmonizes the name for the entry point from the 32-bit sysenter
    instruction across 32-bit and 64-bit kernels.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     
  • This moves arch/x86/kernel/sysenter_32.c to arch/x86/vdso/vdso32-setup.c,
    keeping all the code relating only to vDSO magic in the vdso/ subdirectory.
    This is a pure renaming, but it paves the way to consolidating the code for
    dealing with 32-bit vDSOs across CONFIG_X86_32 and CONFIG_IA32_EMULATION.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath