1. 26 Jan, 2009 18 commits
    • Vegard Nossum's avatar
      inotify: clean up inotify_read and fix locking problems · 3632dee2
      Vegard Nossum authored
      If userspace supplies an invalid pointer to a read() of an inotify
      instance, the inotify device's event list mutex is unlocked twice.
      This causes an unbalance which effectively leaves the data structure
      unprotected, and we can trigger oopses by accessing the inotify
      instance from different tasks concurrently.
      
      The best fix (contributed largely by Linus) is a total rewrite
      of the function in question:
      
      On Thu, Jan 22, 2009 at 7:05 AM, Linus Torvalds wrote:
      > The thing to notice is that:
      >
      >  - locking is done in just one place, and there is no question about it
      >   not having an unlock.
      >
      >  - that whole double-while(1)-loop thing is gone.
      >
      >  - use multiple functions to make nesting and error handling sane
      >
      >  - do error testing after doing the things you always need to do, ie do
      >   this:
      >
      >        mutex_lock(..)
      >        ret = function_call();
      >        mutex_unlock(..)
      >
      >        .. test ret here ..
      >
      >   instead of doing conditional exits with unlocking or freeing.
      >
      > So if the code is written in this way, it may still be buggy, but at least
      > it's not buggy because of subtle "forgot to unlock" or "forgot to free"
      > issues.
      >
      > This _always_ unlocks if it locked, and it always frees if it got a
      > non-error kevent.
      
      Cc: John McCutchan <ttb@tentacle.dhs.org>
      Cc: Robert Love <rlove@google.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3632dee2
    • Linus Torvalds's avatar
      Fix annoying DRM_ERROR() string warning · aeb565df
      Linus Torvalds authored
      Use '%zu' to print out a size_t variable, not '%d'.  Another case of the
      "let's keep at least Linus' defconfig compile warningless" rule.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aeb565df
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse · 2d07d4d1
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
        fuse: fix poll notify
        fuse: destroy bdi on umount
        fuse: fuse_fill_super error handling cleanup
        fuse: fix missing fput on error
        fuse: fix NULL deref in fuse_file_alloc()
      2d07d4d1
    • Linus Torvalds's avatar
      Merge branch 'core-fixes-for-linus' of... · 3386c05b
      Linus Torvalds authored
      Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
        debugobjects: add and use INIT_WORK_ON_STACK
        rcu: remove duplicate CONFIG_RCU_CPU_STALL_DETECTOR
        relay: fix lock imbalance in relay_late_setup_files
        oprofile: fix uninitialized use of struct op_entry
        rcu: move Kconfig menu
        softlock: fix false panic which can occur if softlockup_thresh is reduced
        rcu: add __cpuinit to rcu_init_percpu_data()
      3386c05b
    • Linus Torvalds's avatar
      Merge branch 'timers-fixes-for-linus' of... · 1e70c7f7
      Linus Torvalds authored
      Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
        hrtimers: fix inconsistent lock state on resume in hres_timers_resume
        time-sched.c: tick_nohz_update_jiffies should be static
        locking, hpet: annotate false positive warning
        kernel/fork.c: unused variable 'ret'
        itimers: remove the per-cpu-ish-ness
      1e70c7f7
    • Linus Torvalds's avatar
      Merge branch 'x86-fixes-for-linus' of... · 810ee58d
      Linus Torvalds authored
      Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (29 commits)
        xen: unitialised return value in xenbus_write_transaction
        x86: fix section mismatch warning
        x86: unmask CPUID levels on Intel CPUs, fix
        x86: work around PAGE_KERNEL_WC not getting WC in iomap_atomic_prot_pfn.
        x86: use standard PIT frequency
        xen: handle highmem pages correctly when shrinking a domain
        x86, mm: fix pte_free()
        xen: actually release memory when shrinking domain
        x86: unmask CPUID levels on Intel CPUs
        x86: add MSR_IA32_MISC_ENABLE bits to <asm/msr-index.h>
        x86: fix PTE corruption issue while mapping RAM using /dev/mem
        x86: mtrr fix debug boot parameter
        x86: fix page attribute corruption with cpa()
        Revert "x86: signal: change type of paramter for sys_rt_sigreturn()"
        x86: use early clobbers in usercopy*.c
        x86: remove kernel_physical_mapping_init() from init section
        fix: crash: IP: __bitmap_intersects+0x48/0x73
        cpufreq: use work_on_cpu in acpi-cpufreq.c for drv_read and drv_write
        work_on_cpu: Use our own workqueue.
        work_on_cpu: don't try to get_online_cpus() in work_on_cpu.
        ...
      810ee58d
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6 · 2927fcea
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
        drivers/ide/palm_bk3710.c buildfix
        ide: fix Falcon IDE breakage
        ide: fix IDE PMAC breakage
      2927fcea
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs · 36f392d0
      Linus Torvalds authored
      * 'for-linus' of git://oss.sgi.com/xfs/xfs:
        Long btree pointers are still 64 bit on disk
        [XFS] Remove the rest of the macro-to-function indirections.
        xfs: sanity check attr fork size
        xfs: fix bad_features2 fixups for the root filesystem
        xfs: add a lock class for group/project dquots
        xfs: lockdep annotations for xfs_dqlock2
        xfs: add a separate lock class for the per-mount list of dquots
        xfs: use mnt_want_write in compat_attrmulti ioctl
        xfs: fix dentry aliasing issues in open_by_handle
      36f392d0
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 · 6c31e7ee
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
        ASoC: Add missing comma to SND_SOC_DAPM_SWITCH_E in soc-dapm.h
        ALSA: hda: Add STAC92HD83XXX_PWR_REF quirk
        ALSA: hda: revert change to 92hd83xxx power mapping
        ALSA: hda - Add model entry for HP dv4
        ALSA: hda: 83xxx port 0xe DAC selection
        ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
        sound: virtuoso: document HDAV1.3 driver status
        sound: virtuoso: add newline
        sound: virtuoso: enable UART on Xonar HDAV1.3
        sound: Remove removed OSS kernel parameters from doc
        ALSA: hda: fix invalid power mapping masks
        ASoC: atmel_pcm: Remove non-existant header
        ALSA: hda - add quirks for some 82801H variants to use ALC883_MITAC
        ALSA: hda - Fix (yet more) STAC925x issues
      6c31e7ee
    • Miklos Szeredi's avatar
      fuse: fix poll notify · f6d47a17
      Miklos Szeredi authored
      Move fuse_copy_finish() to before calling fuse_notify_poll_wakeup().
      This is not a big issue because fuse_notify_poll_wakeup() should be
      atomic, but it's cleaner this way, and later uses of notification will
      need to be able to finish the copying before performing some actions.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      f6d47a17
    • Miklos Szeredi's avatar
      fuse: destroy bdi on umount · 26c36791
      Miklos Szeredi authored
      If a fuse filesystem is unmounted but the device file descriptor
      remains open and a new mount reuses the old device number, then the
      mount fails with EEXIST and the following warning is printed in the
      kernel log:
      
        WARNING: at fs/sysfs/dir.c:462 sysfs_add_one+0x35/0x3d()
        sysfs: duplicate filename '0:15' can not be created
      
      The cause is that the bdi belonging to the fuse filesystem was
      destoryed only after the device file was released.  Fix this by
      calling bdi_destroy() from fuse_put_super() instead.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@kernel.org
      26c36791
    • Miklos Szeredi's avatar
      fuse: fuse_fill_super error handling cleanup · c2b8f006
      Miklos Szeredi authored
      Clean up error handling for the whole of fuse_fill_super() function.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      c2b8f006
    • Miklos Szeredi's avatar
      fuse: fix missing fput on error · 3ddf1e7f
      Miklos Szeredi authored
      Fix the leaking file reference if allocation or initialization of
      fuse_conn failed.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@kernel.org
      3ddf1e7f
    • Dan Carpenter's avatar
      fuse: fix NULL deref in fuse_file_alloc() · bb875b38
      Dan Carpenter authored
      ff is set to NULL and then dereferenced on line 65.  Compile tested only.
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@kernel.org
      bb875b38
    • Ian Campbell's avatar
      xen: unitialised return value in xenbus_write_transaction · e88a0faa
      Ian Campbell authored
      The return value of xenbus_write_transaction can be uninitialised in
      the success case leading to the userspace xenstore utilities failing.
      Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e88a0faa
    • Rakib Mullick's avatar
      x86: fix section mismatch warning · 659d2618
      Rakib Mullick authored
      Here function vmi_activate calls a init function activate_vmi , which
      causes the following section mismatch warnings:
      
        LD      arch/x86/kernel/built-in.o
      WARNING: arch/x86/kernel/built-in.o(.text+0x13ba9): Section mismatch
      in reference from the function vmi_activate() to the function
      .init.text:vmi_time_init()
      The function vmi_activate() references
      the function __init vmi_time_init().
      This is often because vmi_activate lacks a __init
      annotation or the annotation of vmi_time_init is wrong.
      
      WARNING: arch/x86/kernel/built-in.o(.text+0x13bd1): Section mismatch
      in reference from the function vmi_activate() to the function
      .devinit.text:vmi_time_bsp_init()
      The function vmi_activate() references
      the function __devinit vmi_time_bsp_init().
      This is often because vmi_activate lacks a __devinit
      annotation or the annotation of vmi_time_bsp_init is wrong.
      
      WARNING: arch/x86/kernel/built-in.o(.text+0x13bdb): Section mismatch
      in reference from the function vmi_activate() to the function
      .devinit.text:vmi_time_ap_init()
      The function vmi_activate() references
      the function __devinit vmi_time_ap_init().
      This is often because vmi_activate lacks a __devinit
      annotation or the annotation of vmi_time_ap_init is wrong.
      
      Fix it by marking vmi_activate() as __init too.
      Signed-off-by: default avatarRakib Mullick <rakib.mullick@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      659d2618
    • Ingo Molnar's avatar
      x86: unmask CPUID levels on Intel CPUs, fix · 99fb4d34
      Ingo Molnar authored
      Impact: fix boot hang on pre-model-15 Intel CPUs
      
      rdmsrl_safe() does not work in very early bootup code yet, because we
      dont have the pagefault handler installed yet so exception section
      does not get parsed. rdmsr_safe() will just crash and hang the bootup.
      
      So limit the MSR_IA32_MISC_ENABLE MSR read to those CPU types that
      support it.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      99fb4d34
    • Eric Anholt's avatar
      x86: work around PAGE_KERNEL_WC not getting WC in iomap_atomic_prot_pfn. · ef5fa0ab
      Eric Anholt authored
      In the absence of PAT, PAGE_KERNEL_WC ends up mapping to a memory type that
      gets UC behavior even in the presence of a WC MTRR covering the area in
      question.  By swapping to PAGE_KERNEL_UC_MINUS, we can get the actual
      behavior the caller wanted (WC if you can manage it, UC otherwise).
      
      This recovers the 40% performance improvement of using WC in the DRM
      to upload vertex data.
      Signed-off-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      ef5fa0ab
  2. 25 Jan, 2009 1 commit
    • Ingo Molnar's avatar
      x86: use standard PIT frequency · e1b4d114
      Ingo Molnar authored
      the RDC and ELAN platforms use slighly different PIT clocks, resulting in
      a timex.h hack that changes PIT_TICK_RATE during build time. But if a
      tester enables any of these platform support .config options, the PIT
      will be miscalibrated on standard PC platforms.
      
      So use one frequency - in a subsequent patch we'll add a quirk to allow
      x86 platforms to define different PIT frequencies.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e1b4d114
  3. 23 Jan, 2009 8 commits
  4. 22 Jan, 2009 7 commits
  5. 21 Jan, 2009 6 commits
    • H. Peter Anvin's avatar
      x86: add MSR_IA32_MISC_ENABLE bits to <asm/msr-index.h> · bdf21a49
      H. Peter Anvin authored
      Impact: None (new bit definitions currently unused)
      
      Add bit definitions for the MSR_IA32_MISC_ENABLE MSRs to
      <asm/msr-index.h>.
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      bdf21a49
    • Suresh Siddha's avatar
      x86: fix PTE corruption issue while mapping RAM using /dev/mem · 95971342
      Suresh Siddha authored
      Beschorner Daniel reported:
      > hwinfo problem since 2.6.28, showing this in the oops:
      >	Corrupted page table at address 7fd04de3ec00
      
      Also, PaX Team reported a regression with this commit:
      
      >	commit 9542ada8
      >	Author: Suresh Siddha <suresh.b.siddha@intel.com>
      >	Date:   Wed Sep 24 08:53:33 2008 -0700
      >
      >	    x86: track memtype for RAM in page struct
      
      This commit breaks mapping any RAM page through /dev/mem, as the
      reserve_memtype() was not initializing the return attribute type and as such
      corrupting the PTE entry that was setup with the return attribute type.
      
      Because of this bug, application mapping this RAM page through /dev/mem
      will die with "Corrupted page table at address xxxx" message in the kernel
      log and also the kernel identity mapping which maps the underlying RAM
      page gets converted to UC.
      
      Fix this by initializing the return attribute type before calling
      reserve_ram_pages_type()
      Reported-by: default avatarPaX Team <pageexec@freemail.hu>
      Reported-and-tested-by: default avatarBeschorner Daniel <Daniel.Beschorner@facton.com>
      Tested-and-Acked-by: default avatarPaX Team <pageexec@freemail.hu>
      Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
      Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      95971342
    • Thomas Renninger's avatar
      x86: mtrr fix debug boot parameter · 731f1872
      Thomas Renninger authored
      while looking at:
      
        http://bugzilla.kernel.org/show_bug.cgi?id=11541
      
      I realized that the mtrr.show param cannot work, because
      the code is processed much too early.
      
      This patch:
       - Declares mtrr.show as early_param
       - Stays consistent with the previous param (which I doubt
         that it ever worked), so mtrr.show=1 would still work
       - Declares mtrr_show as initdata
      Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
      Acked-by: default avatarJan Beulich <jbeulich@novell.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      731f1872
    • Suresh Siddha's avatar
      x86: fix page attribute corruption with cpa() · a1e46212
      Suresh Siddha authored
      Impact: fix sporadic slowdowns and warning messages
      
      This patch fixes a performance issue reported by Linus on his
      Nehalem system. While Linus reverted the PAT patch (commit
      58dab916) which exposed the issue,
      existing cpa() code can potentially still cause wrong(page attribute
      corruption) behavior.
      
      This patch also fixes the "WARNING: at arch/x86/mm/pageattr.c:560" that
      various people reported.
      
      In 64bit kernel, kernel identity mapping might have holes depending
      on the available memory and how e820 reports the address range
      covering the RAM, ACPI, PCI reserved regions. If there is a 2MB/1GB hole
      in the address range that is not listed by e820 entries, kernel identity
      mapping will have a corresponding hole in its 1-1 identity mapping.
      
      If cpa() happens on the kernel identity mapping which falls into these holes,
      existing code fails like this:
      
      	__change_page_attr_set_clr()
      		__change_page_attr()
      			returns 0 because of if (!kpte). But doesn't
      			set cpa->numpages and cpa->pfn.
      		cpa_process_alias()
      			uses uninitialized cpa->pfn (random value)
      			which can potentially lead to changing the page
      			attribute of kernel text/data, kernel identity
      			mapping of RAM pages etc. oops!
      
      This bug was easily exposed by another PAT patch which was doing
      cpa() more often on kernel identity mapping holes (physical range between
      max_low_pfn_mapped and 4GB), where in here it was setting the
      cache disable attribute(PCD) for kernel identity mappings aswell.
      
      Fix cpa() to handle the kernel identity mapping holes. Retain
      the WARN() for cpa() calls to other not present address ranges
      (kernel-text/data, ioremap() addresses)
      Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
      Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a1e46212
    • Ingo Molnar's avatar
      Revert "x86: signal: change type of paramter for sys_rt_sigreturn()" · 552b8aa4
      Ingo Molnar authored
      This reverts commit 4217458d.
      
      Justin Madru bisected this commit, it was causing weird Firefox
      crashes.
      
      The reason is that GCC mis-optimizes (re-uses) the on-stack parameters of
      the calling frame, which corrupts the syscall return pt_regs state and
      thus corrupts user-space register state.
      
      So we go back to the slightly less clean but more optimization-safe
      method of getting to pt_regs. Also add a comment to explain this.
      
      Resolves: http://bugzilla.kernel.org/show_bug.cgi?id=12505Reported-and-bisected-by: default avatarJustin Madru <jdm64@gawab.com>
      Tested-by: default avatarJustin Madru <jdm64@gawab.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      552b8aa4
    • Andi Kleen's avatar
      x86: use early clobbers in usercopy*.c · e0a96129
      Andi Kleen authored
      Impact: fix rare (but currently harmless) miscompile with certain configs and gcc versions
      
      Hugh Dickins noticed that strncpy_from_user() was miscompiled
      in some circumstances with gcc 4.3.
      
      Thanks to Hugh's excellent analysis it was easy to track down.
      
      Hugh writes:
      
      > Try building an x86_64 defconfig 2.6.29-rc1 kernel tree,
      > except not quite defconfig, switch CONFIG_PREEMPT_NONE=y
      > and CONFIG_PREEMPT_VOLUNTARY off (because it expands a
      > might_fault() there, which hides the issue): using a
      > gcc 4.3.2 (I've checked both openSUSE 11.1 and Fedora 10).
      >
      > It generates the following:
      >
      > 0000000000000000 <__strncpy_from_user>:
      >    0:   48 89 d1                mov    %rdx,%rcx
      >    3:   48 85 c9                test   %rcx,%rcx
      >    6:   74 0e                   je     16 <__strncpy_from_user+0x16>
      >    8:   ac                      lods   %ds:(%rsi),%al
      >    9:   aa                      stos   %al,%es:(%rdi)
      >    a:   84 c0                   test   %al,%al
      >    c:   74 05                   je     13 <__strncpy_from_user+0x13>
      >    e:   48 ff c9                dec    %rcx
      >   11:   75 f5                   jne    8 <__strncpy_from_user+0x8>
      >   13:   48 29 c9                sub    %rcx,%rcx
      >   16:   48 89 c8                mov    %rcx,%rax
      >   19:   c3                      retq
      >
      > Observe that "sub %rcx,%rcx; mov %rcx,%rax", whereas gcc 4.2.1
      > (and many other configs) say "sub %rcx,%rdx; mov %rdx,%rax".
      > Isn't it returning 0 when it ought to be returning strlen?
      
      The asm constraints for the strncpy_from_user() result were missing an
      early clobber, which tells gcc that the last output arguments
      are written before all input arguments are read.
      
      Also add more early clobbers in the rest of the file and fix 32-bit
      usercopy.c in the same way.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      [ since this API is rarely used and no in-kernel user relies on a 'len'
        return value (they only rely on negative return values) this miscompile
        was never noticed in the field. But it's worth fixing it nevertheless. ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e0a96129