18 Dec, 2014

1 commit

  • It turns out that there's a lurking ABI issue. GCC, when
    compiling this in a 32-bit program:

    struct user_desc desc = {
    .entry_number = idx,
    .base_addr = base,
    .limit = 0xfffff,
    .seg_32bit = 1,
    .contents = 0, /* Data, grow-up */
    .read_exec_only = 0,
    .limit_in_pages = 1,
    .seg_not_present = 0,
    .useable = 0,
    };

    will leave .lm uninitialized. This means that anything in the
    kernel that reads user_desc.lm for 32-bit tasks is unreliable.

    Revert the .lm check in set_thread_area(). The value never did
    anything in the first place.

    Fixes: 0e58af4e1d21 ("x86/tls: Disallow unusual TLS segments")
    Signed-off-by: Andy Lutomirski
    Acked-by: Thomas Gleixner
    Cc: stable@vger.kernel.org # Only if 0e58af4e1d21 is backported
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/d7875b60e28c512f6a6fc0baf5714d58e7eaadbb.1418856405.git.luto@amacapital.net
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     

14 Dec, 2014

2 commits

  • Users have no business installing custom code segments into the
    GDT, and segments that are not present but are otherwise valid
    are a historical source of interesting attacks.

    For completeness, block attempts to set the L bit. (Prior to
    this patch, the L bit would have been silently dropped.)

    This is an ABI break. I've checked glibc, musl, and Wine, and
    none of them look like they'll have any trouble.

    Note to stable maintainers: this is a hardening patch that fixes
    no known bugs. Given the possibility of ABI issues, this
    probably shouldn't be backported quickly.

    Signed-off-by: Andy Lutomirski
    Acked-by: H. Peter Anvin
    Cc: stable@vger.kernel.org # optional
    Cc: Konrad Rzeszutek Wilk
    Cc: Linus Torvalds
    Cc: security@kernel.org
    Cc: Willy Tarreau
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     
  • Installing a 16-bit RW data segment into the GDT defeats espfix.
    AFAICT this will not affect glibc, Wine, or dosemu at all.

    Signed-off-by: Andy Lutomirski
    Acked-by: H. Peter Anvin
    Cc: stable@vger.kernel.org
    Cc: Konrad Rzeszutek Wilk
    Cc: Linus Torvalds
    Cc: security@kernel.org
    Cc: Willy Tarreau
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     

04 Mar, 2013

1 commit


30 Mar, 2012

1 commit

  • Pull x86 updates from Ingo Molnar.

    This touches some non-x86 files due to the sanitized INLINE_SPIN_UNLOCK
    config usage.

    Fixed up trivial conflicts due to just header include changes (removing
    headers due to cpu_idle() merge clashing with the split).

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/apic/amd: Be more verbose about LVT offset assignments
    x86, tls: Off by one limit check
    x86/ioapic: Add io_apic_ops driver layer to allow interception
    x86/olpc: Add debugfs interface for EC commands
    x86: Merge the x86_32 and x86_64 cpu_idle() functions
    x86/kconfig: Remove CONFIG_TR=y from the defconfigs
    x86: Stop recursive fault in print_context_stack after stack overflow
    x86/io_apic: Move and reenable irq only when CONFIG_GENERIC_PENDING_IRQ=y
    x86/apic: Add separate apic_id_valid() functions for selected apic drivers
    locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
    x86/kconfig: Update defconfigs
    x86: Fix excessive MSR print out when show_msr is not specified

    Linus Torvalds
     

29 Mar, 2012

2 commits


22 Jul, 2008

1 commit


11 Apr, 2008

1 commit

  • The prevent_tail_call() macro works around the problem of the compiler
    clobbering argument words on the stack, which for asmlinkage functions
    is the caller's (user's) struct pt_regs. The tail/sibling-call
    optimization is not the only way that the compiler can decide to use
    stack argument words as scratch space, which we have to prevent.
    Other optimizations can do it too.

    Until we have new compiler support to make "asmlinkage" binding on the
    compiler's own use of the stack argument frame, we have work around all
    the manifestations of this issue that crop up.

    More cases seem to be prevented by also keeping the incoming argument
    variables live at the end of the function. This makes their original
    stack slots attractive places to leave those variables, so the compiler
    tends not clobber them for something else. It's still no guarantee, but
    it handles some observed cases that prevent_tail_call() did not.

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

    Roland McGrath
     

01 Mar, 2008

1 commit

  • Fix a kernel bug (vmware boot problem) reported by Tomasz Grobelny,
    which occurs with certain .config variants and gccs.

    The x86 TLS cleanup in commit efd1ca52d04d2f6df337a3332cee56cd60e6d4c4
    made the sys_set_thread_area and sys_get_thread_area functions ripe for
    tail call optimization. If the compiler chooses to use it for them, it
    can clobber the user trap frame because these are asmlinkage functions.

    Reported-by: Tomasz Grobelny
    Signed-off-by: Roland McGrath
    Signed-off-by: Ingo Molnar

    Roland McGrath
     

30 Jan, 2008

6 commits

  • This adds accessor functions in the user_regset style for the TLS data.

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

    Roland McGrath
     
  • This cleans up the TLS code to use struct desc_struct and to separate the
    encoding and installation magic from the interface wrappers.

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

    Roland McGrath
     
  • This patch makes get_desc_base() receive a struct desc_struct,
    and then uses its internal fields to compute the base address.
    This is done at both i386 and x86_64, and then it is moved
    to common header

    Signed-off-by: Glauber de Oliveira Costa
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Glauber de Oliveira Costa
     
  • This patch introduces fill_ldt(), which populates a ldt descriptor
    from a user_desc in once, instead of relying in the LDT_entry_a and
    LDT_entry_b macros

    Signed-off-by: Glauber de Oliveira Costa
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Glauber de Oliveira Costa
     
  • This consolidates the four different places that implemented the same
    encoding magic for the GDT-slot 32-bit TLS support. The old tls32.c was
    renamed and is now only slightly modified to be the shared implementation.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Zachary Amsden
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     
  • This renames arch/x86/ia32/tls32.c to arch/x86/kernel/tls.c, which does
    nothing now but paves the way to consolidate this code for 32-bit too.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Zachary Amsden
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath