1. 11 Feb, 2009 2 commits
    • Ingo Molnar's avatar
      stackprotector: fix multi-word cross-builds · ebd9026d
      Ingo Molnar authored
      Stackprotector builds were failing if CROSS_COMPILER was more than
      a single world (such as when distcc was used) - because the check
      scripts used $1 instead of $*.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ebd9026d
    • Tejun Heo's avatar
      x86: fix x86_32 stack protector bugs · 5c79d2a5
      Tejun Heo authored
      Impact: fix x86_32 stack protector
      
      Brian Gerst found out that %gs was being initialized to stack_canary
      instead of stack_canary - 20, which basically gave the same canary
      value for all threads.  Fixing this also exposed the following bugs.
      
      * cpu_idle() didn't call boot_init_stack_canary()
      
      * stack canary switching in switch_to() was being done too late making
        the initial run of a new thread use the old stack canary value.
      
      Fix all of them and while at it update comment in cpu_idle() about
      calling boot_init_stack_canary().
      Reported-by: default avatarBrian Gerst <brgerst@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5c79d2a5
  2. 09 Feb, 2009 20 commits
    • Tejun Heo's avatar
      x86: implement x86_32 stack protector · 60a5317f
      Tejun Heo authored
      Impact: stack protector for x86_32
      
      Implement stack protector for x86_32.  GDT entry 28 is used for it.
      It's set to point to stack_canary-20 and have the length of 24 bytes.
      CONFIG_CC_STACKPROTECTOR turns off CONFIG_X86_32_LAZY_GS and sets %gs
      to the stack canary segment on entry.  As %gs is otherwise unused by
      the kernel, the canary can be anywhere.  It's defined as a percpu
      variable.
      
      x86_32 exception handlers take register frame on stack directly as
      struct pt_regs.  With -fstack-protector turned on, gcc copies the
      whole structure after the stack canary and (of course) doesn't copy
      back on return thus losing all changed.  For now, -fno-stack-protector
      is added to all files which contain those functions.  We definitely
      need something better.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      60a5317f
    • Tejun Heo's avatar
      x86: make lazy %gs optional on x86_32 · ccbeed3a
      Tejun Heo authored
      Impact: pt_regs changed, lazy gs handling made optional, add slight
              overhead to SAVE_ALL, simplifies error_code path a bit
      
      On x86_32, %gs hasn't been used by kernel and handled lazily.  pt_regs
      doesn't have place for it and gs is saved/loaded only when necessary.
      In preparation for stack protector support, this patch makes lazy %gs
      handling optional by doing the followings.
      
      * Add CONFIG_X86_32_LAZY_GS and place for gs in pt_regs.
      
      * Save and restore %gs along with other registers in entry_32.S unless
        LAZY_GS.  Note that this unfortunately adds "pushl $0" on SAVE_ALL
        even when LAZY_GS.  However, it adds no overhead to common exit path
        and simplifies entry path with error code.
      
      * Define different user_gs accessors depending on LAZY_GS and add
        lazy_save_gs() and lazy_load_gs() which are noop if !LAZY_GS.  The
        lazy_*_gs() ops are used to save, load and clear %gs lazily.
      
      * Define ELF_CORE_COPY_KERNEL_REGS() which always read %gs directly.
      
      xen and lguest changes need to be verified.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ccbeed3a
    • Tejun Heo's avatar
      x86: add %gs accessors for x86_32 · d9a89a26
      Tejun Heo authored
      Impact: cleanup
      
      On x86_32, %gs is handled lazily.  It's not saved and restored on
      kernel entry/exit but only when necessary which usually is during task
      switch but there are few other places.  Currently, it's done by
      calling savesegment() and loadsegment() explicitly.  Define
      get_user_gs(), set_user_gs() and task_user_gs() and use them instead.
      
      While at it, clean up register access macros in signal.c.
      
      This cleans up code a bit and will help future changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d9a89a26
    • Tejun Heo's avatar
      x86: use asm .macro instead of cpp #define in entry_32.S · f0d96110
      Tejun Heo authored
      Impact: cleanup
      
      Use .macro instead of cpp #define where approriate.  This cleans up
      code and will ease future changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f0d96110
    • Tejun Heo's avatar
      x86: no stack protector for vdso · d627ded5
      Tejun Heo authored
      Impact: avoid crash on vsyscall
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d627ded5
    • Tejun Heo's avatar
      stackprotector: update make rules · 5d707e9c
      Tejun Heo authored
      Impact: no default -fno-stack-protector if stackp is enabled, cleanup
      
      Stackprotector make rules had the following problems.
      
      * cc support test and warning are scattered across makefile and
        kernel/panic.c.
      
      * -fno-stack-protector was always added regardless of configuration.
      
      Update such that cc support test and warning are contained in makefile
      and -fno-stack-protector is added iff stackp is turned off.  While at
      it, prepare for 32bit support.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5d707e9c
    • Tejun Heo's avatar
      x86: stackprotector.h misc update · 76397f72
      Tejun Heo authored
      Impact: misc udpate
      
      * wrap content with CONFIG_CC_STACK_PROTECTOR so that other arch files
        can include it directly
      
      * add missing includes
      
      This will help future changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      76397f72
    • Tejun Heo's avatar
      elf: add ELF_CORE_COPY_KERNEL_REGS() · 6cd61c0b
      Tejun Heo authored
      ELF core dump is used for both user land core dump and kernel crash
      dump.  Depending on architecture, register might need to be accessed
      differently for userland and kernel.  Allow architectures to define
      ELF_CORE_COPY_KERNEL_REGS() and use different operation for kernel
      register dump.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6cd61c0b
    • Ingo Molnar's avatar
      Merge branch 'x86/urgent' into core/percpu · 92e2d508
      Ingo Molnar authored
      Conflicts:
      	arch/x86/kernel/acpi/boot.c
      92e2d508
    • Ingo Molnar's avatar
      Merge branch 'x86/uaccess' into core/percpu · 5d96218b
      Ingo Molnar authored
      5d96218b
    • Tejun Heo's avatar
      x86: fix math_emu register frame access · d315760f
      Tejun Heo authored
      do_device_not_available() is the handler for #NM and it declares that
      it takes a unsigned long and calls math_emu(), which takes a long
      argument and surprisingly expects the stack frame starting at the zero
      argument would match struct math_emu_info, which isn't true regardless
      of configuration in the current code.
      
      This patch makes do_device_not_available() take struct pt_regs like
      other exception handlers and initialize struct math_emu_info with
      pointer to it and pass pointer to the math_emu_info to math_emulate()
      like normal C functions do.  This way, unless gcc makes a copy of
      struct pt_regs in do_device_not_available(), the register frame is
      correctly accessed regardless of kernel configuration or compiler
      used.
      
      This doesn't fix all math_emu problems but it at least gets it
      somewhat working.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d315760f
    • Ingo Molnar's avatar
      Merge commit 'v2.6.29-rc4' into core/percpu · 249d51b5
      Ingo Molnar authored
      Conflicts:
      	arch/x86/mach-voyager/voyager_smp.c
      	arch/x86/mm/fault.c
      249d51b5
    • Tejun Heo's avatar
      x86: math_emu info cleanup · ae6af41f
      Tejun Heo authored
      Impact: cleanup
      
      * Come on, struct info?  s/struct info/struct math_emu_info/
      
      * Use struct pt_regs and kernel_vm86_regs instead of defining its own
        register frame structure.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ae6af41f
    • Tejun Heo's avatar
      x86: include correct %gs in a.out core dump · 914c3d63
      Tejun Heo authored
      Impact: dump the correct %gs into a.out core dump
      
      aout_dump_thread() read %gs but didn't include it in core dump.  Fix
      it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      914c3d63
    • Alok Kataria's avatar
      x86, vmi: put a missing paravirt_release_pmd in pgd_dtor · 55a8ba4b
      Alok Kataria authored
      Commit 6194ba6f ("x86: don't special-case
      pmd allocations as much") made changes to the way we handle pmd allocations,
      and while doing that it dropped a call to  paravirt_release_pd on the
      pgd page from the pgd_dtor code path.
      
      As a result of this missing release, the hypervisor is now unaware of the
      pgd page being freed, and as a result it ends up tracking this page as a
      page table page.
      
      After this the guest may start using the same page for other purposes, and
      depending on what use the page is put to, it may result in various performance
      and/or functional issues ( hangs, reboots).
      
      Since this release is only required for VMI, I now release the pgd page from
      the (vmi)_pgd_free hook.
      Signed-off-by: default avatarAlok N Kataria <akataria@vmware.com>
      Acked-by: default avatarJeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: <stable@kernel.org>
      55a8ba4b
    • Yinghai Lu's avatar
      x86: find nr_irqs_gsi with mp_ioapic_routing · 3f4a739c
      Yinghai Lu authored
      Impact: find right nr_irqs_gsi on some systems.
      
      One test-system has gap between gsi's:
      
      [    0.000000] ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
      [    0.000000] IOAPIC[0]: apic_id 4, version 0, address 0xfec00000, GSI 0-23
      [    0.000000] ACPI: IOAPIC (id[0x05] address[0xfeafd000] gsi_base[48])
      [    0.000000] IOAPIC[1]: apic_id 5, version 0, address 0xfeafd000, GSI 48-54
      [    0.000000] ACPI: IOAPIC (id[0x06] address[0xfeafc000] gsi_base[56])
      [    0.000000] IOAPIC[2]: apic_id 6, version 0, address 0xfeafc000, GSI 56-62
      ...
      [    0.000000] nr_irqs_gsi: 38
      
      So nr_irqs_gsi is not right. some irq for MSI will overwrite with io_apic.
      
      need to get that with acpi_probe_gsi when acpi io_apic is used
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3f4a739c
    • Pallipadi, Venkatesh's avatar
      x86: add clflush before monitor for Intel 7400 series · e736ad54
      Pallipadi, Venkatesh authored
      For Intel 7400 series CPUs, the recommendation is to use a clflush on the
      monitored address just before monitor and mwait pair [1].
      
      This clflush makes sure that there are no false wakeups from mwait when the
      monitored address was recently written to.
      
      [1] "MONITOR/MWAIT Recommendations for Intel Xeon Processor 7400 series"
          section in specification update document of 7400 series
          http://download.intel.com/design/xeon/specupdt/32033601.pdfSigned-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e736ad54
    • Brian Gerst's avatar
      x86: fix abuse of per_cpu_offset · 44581a28
      Brian Gerst authored
      Impact: bug fix
      
      Don't use per_cpu_offset() to determine if it valid to access a
      per-cpu variable for a given cpu number.  It is not a valid assumption
      on x86-64 anymore. Use cpu_possible() instead.
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      44581a28
    • Brian Gerst's avatar
      x86: use linker to offset symbols by __per_cpu_load · 2add8e23
      Brian Gerst authored
      Impact: cleanup and bug fix
      
      Use the linker to create symbols for certain per-cpu variables
      that are offset by __per_cpu_load.  This allows the removal of
      the runtime fixup of the GDT pointer, which fixes a bug with
      resume reported by Jiri Slaby.
      Reported-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Acked-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2add8e23
    • Brian Gerst's avatar
      percpu: make PER_CPU_BASE_SECTION overridable by arches · d3770449
      Brian Gerst authored
      Impact: bug fix
      
      IA-64 needs to put percpu data in the seperate section even on UP.
      Fixes regression caused by "percpu: refactor percpu.h"
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Acked-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d3770449
  3. 08 Feb, 2009 10 commits
  4. 07 Feb, 2009 8 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 · e83102ca
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
        PCI PM: make the PM core more careful with drivers using the new PM framework
        PCI PM: Read power state from device after trying to change it on resume
        PCI PM: Do not disable and enable bridges during suspend-resume
        PCI: PCIe portdrv: Simplify suspend and resume
        PCI PM: Fix saving of device state in pci_legacy_suspend
        PCI PM: Check if the state has been saved before trying to restore it
        PCI PM: Fix handling of devices without drivers
        PCI: return error on failure to read PCI ROMs
        PCI: properly clean up ASPM link state on device remove
      e83102ca
    • Rusty Russell's avatar
      module: remove over-zealous check in __module_get() · 7f9a50a5
      Rusty Russell authored
      Impact: fix spurious BUG_ON() triggered under load
      
      module_refcount() isn't reliable outside stop_machine(), as demonstrated
      by Karsten Keil <kkeil@suse.de>, networking can trigger it under load
      (an inc on one cpu and dec on another while module_refcount() is tallying
       can give false results, for example).
      
      Almost noone should be using __module_get, but that's another issue.
      
      Cc: Karsten Keil <kkeil@suse.de>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7f9a50a5
    • Linus Torvalds's avatar
      Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 · f12b12a8
      Linus Torvalds authored
      * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (30 commits)
        ACPI: Kconfig text - Fix the ACPI_CONTAINER module name according to the real module name.
        eeepc-laptop: fix oops when changing backlight brightness during eeepc-laptop init
        ACPICA: Fix table entry truncation calculation
        ACPI: Enable bit 11 in _PDC to advertise hw coord
        ACPI: struct device - replace bus_id with dev_name(), dev_set_name()
        ACPI: add missing KERN_* constants to printks
        ACPI: dock: Don't eval _STA on every show_docked sysfs read
        ACPI: disable ACPI cleanly when bad RSDP found
        ACPI: delete CPU_IDLE=n code
        ACPI: cpufreq: Remove deprecated /proc/acpi/processor/../performance proc entries
        ACPI: make some IO ports off-limits to AML
        ACPICA: add debug dump of BIOS _OSI strings
        ACPI: proc_dir_entry 'video/VGA' already registered
        ACPI: Skip the first two elements in the _BCL package
        ACPI: remove BM_RLD access from idle entry path
        ACPI: remove locking from PM1x_STS register reads
        eeepc-laptop: use netlink interface
        eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop
        eeepc-laptop: Check return values from rfkill_register
        eeepc-laptop: Add support for extended hotkeys
        ...
      f12b12a8
    • Len Brown's avatar
      Merge branches 'release', 'asus', 'bugzilla-12450', 'cpuidle', 'debug', 'ec',... · 2d29c6a0
      Len Brown authored
      Merge branches 'release', 'asus', 'bugzilla-12450', 'cpuidle', 'debug', 'ec', 'misc', 'printk' and 'processor' into release
      2d29c6a0
    • Thierry Vignaud's avatar
    • Darren Salt's avatar
      eeepc-laptop: fix oops when changing backlight brightness during eeepc-laptop init · 7695fb04
      Darren Salt authored
      I got the following oops while changing the backlight brightness during
      startup.  When it happens, it prevents use of the hotkeys, Fn-Fx, and the
      lid button.
      
      It's a clear use-before-init, as I verified by testing with an
      appropriately-placed "else printk".
      
      BUG: unable to handle kernel NULL pointer dereference at 00000000
      *pde = 00000000
      Oops: 0002 [#1] PREEMPT SMP
      Pid: 160, comm: kacpi_notify Not tainted (2.6.28.1-eee901 #4) 901
      EIP: 0060:[<c0264e68>]  [<c0264e68>] eeepc_hotk_notify+26/da
      EFLAGS: 00010246 CPU: 1
      Using defaults from ksymoops -t elf32-i386 -a i386
      EAX: 00000009 EBX: 00000000 ECX: 00000009 EDX: f70dbf64
      ESI: 00000029 EDI: f7335188 EBP: c02112c9 ESP: f70dbf80
       DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
       f70731e0 f73acd50 c02164ac f7335180 f70aa040 c02112e6 f733518c c012b62f
       f70aa044 f70aa040 c012bdba f70aa04c 00000000 c012be6e 00000000 f70bdf80
       c012e198 f70dbfc4 f70dbfc4 f70aa040 c012bdba 00000000 c012e0c9 c012e091
      Call Trace:
       [<c02164ac>] ? acpi_ev_notify_dispatch+4c/55
       [<c02112e6>] ? acpi_os_execute_deferred+1d/25
       [<c012b62f>] ? run_workqueue+71/f1
       [<c012bdba>] ? worker_thread+0/bf
       [<c012be6e>] ? worker_thread+b4/bf
       [<c012e198>] ? autoremove_wake_function+0/2b
       [<c012bdba>] ? worker_thread+0/bf
       [<c012e0c9>] ? kthread+38/5f
       [<c012e091>] ? kthread+0/5f
       [<c0103abf>] ? kernel_thread_helper+7/10
      Code: 00 00 00 00 c3 83 3d 60 5c 50 c0 00 56 89 d6 53 0f 84 c4 00 00 00 8d 42
      e0 83 f8 0f 77 0f 8b 1d 68 5c 50 c0 89 d8 e8 a9 fa ff ff <89> 03 8b 1d 60 5c
      50 c0 89 f2 83 e2 7f 0f b7 4c 53 10 8d 41 01
      Signed-off-by: default avatarDarren Salt <linux@youmustbejoking.demon.co.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      7695fb04
    • Myron Stowe's avatar
      ACPICA: Fix table entry truncation calculation · 386e4a83
      Myron Stowe authored
      During early boot, ACPI RSDT/XSDT table entries are gathered into the
      'initial_tables[]' array.  This array is currently statically defined (see
      ./drivers/acpi/tables.c).  When there are more table entries than can be
      held in the 'initial_tables[]' array, the message "Truncating N table
      entries!" is output.  As currently implemented, this message will always
      erroneously calculate N as 0.
      
      This patch fixes the calculation that determines how many table entries
      will be missing (truncated).
      
      This modification may be used under either the GPL or the BSD-style
      license used for Intel ACPI CA code.
      Signed-off-by: default avatarMyron Stowe <myron.stowe@hp.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      386e4a83
    • Pallipadi, Venkatesh's avatar
      ACPI: Enable bit 11 in _PDC to advertise hw coord · d96f94c6
      Pallipadi, Venkatesh authored
      Bit 11 in intel PDC definitions is meant for OS capability to handle
      hardware coordination of P-states. In Linux we have always supported
      hwardware coordination of P-states. Just let the BIOSes know that we
      support it, by setting this bit.
      
      Some BIOSes use this bit to choose between hardware or software coordination
      and without this change below, BIOSes switch to software coordination, which
      is not very optimal in terms of power consumption and extra wakeups from idle.
      Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      d96f94c6