24 Sep, 2009

40 commits

  • * 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6: (21 commits)
    HWPOISON: Enable error_remove_page on btrfs
    HWPOISON: Add simple debugfs interface to inject hwpoison on arbitary PFNs
    HWPOISON: Add madvise() based injector for hardware poisoned pages v4
    HWPOISON: Enable error_remove_page for NFS
    HWPOISON: Enable .remove_error_page for migration aware file systems
    HWPOISON: The high level memory error handler in the VM v7
    HWPOISON: Add PR_MCE_KILL prctl to control early kill behaviour per process
    HWPOISON: shmem: call set_page_dirty() with locked page
    HWPOISON: Define a new error_remove_page address space op for async truncation
    HWPOISON: Add invalidate_inode_page
    HWPOISON: Refactor truncate to allow direct truncating of page v2
    HWPOISON: check and isolate corrupted free pages v2
    HWPOISON: Handle hardware poisoned pages in try_to_unmap
    HWPOISON: Use bitmask/action code for try_to_unmap behaviour
    HWPOISON: x86: Add VM_FAULT_HWPOISON handling to x86 page fault handler v2
    HWPOISON: Add poison check to page fault handling
    HWPOISON: Add basic support for poisoned pages in fault handler v3
    HWPOISON: Add new SIGBUS error codes for hardware poison signals
    HWPOISON: Add support for poison swap entries v2
    HWPOISON: Export some rmap vma locking to outside world
    ...

    Linus Torvalds
     
  • drivers/usb/serial/sierra.c: In function 'sierra_suspend':
    drivers/usb/serial/sierra.c:936: error: 'struct usb_device' has no member named 'auto_pm'

    Repairs

    commit e6929a9020acbeb04d9a3ad9a88234c15be808fd
    Author: Oliver Neukum
    Date: Fri Sep 4 23:19:53 2009 +0200

    USB: support for autosuspend in sierra while online

    Cc: Greg KH
    Cc: Oliver Neukum
    Cc: Elina Pasheva
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • This brings Alpha AGP platforms in sync with the change to struct
    agp_memory (unsigned long *memory => struct page **pages).

    Only compile tested (I don't have titan/marvel hardware), but this change
    looks pretty straightforward, so hopefully it's ok.

    Signed-off-by: Ivan Kokshaysky
    Cc: Richard Henderson
    Cc: Dave Airlie
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ivan Kokshaysky
     
  • Because the binfmt is not different between threads in the same process,
    it can be moved from task_struct to mm_struct. And binfmt moudle is
    handled per mm_struct instead of task_struct.

    Signed-off-by: Hiroshi Shimamoto
    Acked-by: Oleg Nesterov
    Cc: Rusty Russell
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hiroshi Shimamoto
     
  • When unaligned accesses are required for uncompressing a kernel (such as
    for LZO decompression on ARM in a patch that follows), including
    causes issues as it brings in a lot of things that are
    not available in the decompression environment.

    linux/kernel.h brings at least:
    extern int console_printk[];
    extern const char hex_asc[];
    which causes errors at link-time as they are not available when
    compiling the pre-boot environement. There are also a few others:

    arch/arm/boot/compressed/misc.o: In function `valid_user_regs':
    arch/arm/include/asm/ptrace.h:158: undefined reference to `elf_hwcap'
    arch/arm/boot/compressed/misc.o: In function `console_silent':
    include/linux/kernel.h:292: undefined reference to `console_printk'
    arch/arm/boot/compressed/misc.o: In function `console_verbose':
    include/linux/kernel.h:297: undefined reference to `console_printk'
    arch/arm/boot/compressed/misc.o: In function `pack_hex_byte':
    include/linux/kernel.h:360: undefined reference to `hex_asc'
    arch/arm/boot/compressed/misc.o: In function `hweight_long':
    include/linux/bitops.h:45: undefined reference to `hweight32'
    arch/arm/boot/compressed/misc.o: In function `__cmpxchg_local_generic':
    include/asm-generic/cmpxchg-local.h:21: undefined reference to `wrong_size_cmpxchg'
    include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
    arch/arm/boot/compressed/misc.o: In function `__xchg':
    arch/arm/include/asm/system.h:309: undefined reference to `__bad_xchg'

    However, those files apparently use nothing from , all
    they need is the declaration of types such as u32 or u64, so
    should be enough

    Signed-off-by: Albin Tonnerre
    Cc: Sam Ravnborg
    Cc: Russell King
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Phillip Lougher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Albin Tonnerre
     
  • If the lzma/gzip decompressors are called with insufficient input data
    (len > 0 & fill = NULL), they will attempt to call the fill function to
    obtain more data, leading to a kernel oops.

    Signed-off-by: Phillip Lougher
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Phillip Lougher
     
  • In this case, the calls to request_mem_region, ioremap, and
    release_mem_region all have a consistent length argument, len, but since
    in other files (res->end - res->start) + 1, equivalent to
    resource_size(res), is used for a resource-typed structure res, one could
    consider whether the same should be done here.

    The problem was found using the following semantic patch:
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @@
    struct resource *res;
    @@

    - (res->end - res->start) + 1
    + resource_size(res)

    @@
    struct resource *res;
    @@

    - res->end - res->start
    + BAD(resource_size(res))
    //

    Signed-off-by: Julia Lawall
    Acked-by: Florian Fainelli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     
  • romfs_iget returns an ERR_PTR value in an error case instead of NULL.

    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @match exists@
    expression x, E;
    statement S1, S2;
    @@

    x = romfs_iget(...)
    ... when != x = E
    (
    * if (x == NULL || ...) S1 else S2
    |
    * if (x == NULL && ...) S1 else S2
    )
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     
  • The allocation may fail.

    Signed-off-by: Roel Kluin
    Acked-by: Jack Steiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roel Kluin
     
  • Signed-off-by: Alexey Dobriyan
    Cc: Jack Steiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • ->ioctx_lock and ->ioctx_list are used only under CONFIG_AIO.

    Signed-off-by: Alexey Dobriyan
    Cc: Zach Brown
    Cc: Benjamin LaHaise
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • id_reg.if_mode might be unitialized when (*mrq)->error is nonzero. move
    dev_dbg() inside the if so that we are sure we can use id_reg values.

    Signed-off-by: Jiri Slaby
    Cc: Alex Dubov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Slaby
     
  • unsigned block cannot be less than 0.

    Signed-off-by: Roel Kluin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roel Kluin
     
  • Module edac_core.ko uses call_rcu() callbacks in edac_device.c, edac_mc.c
    and edac_pci.c.

    They all use a wait_for_completion() scheme, but this scheme it not 100%
    safe on multiple CPUs. See the _rcu_barrier() implementation which
    explains why extra precausion is needed.

    The patch adds a comment about rcu_barrier() and as a precausion calls
    rcu_barrier(). A maintainer needs to look at removing the
    wait_for_completion code.

    [dougthompson@xmission.com: remove the wait_for_completion code]
    Signed-off-by Jesper Dangaard Brouer
    Signed-off-by: Doug Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesper Dangaard Brouer
     
  • A driver for the Intel 3200 and 3210 memory controllers. It has only had
    light testing so far, and currently makes no attempt to decode error
    addresses at anything finer than csrow granularity.

    Signed-off-by: Jason Uhlenkott
    Signed-off-by: Doug Thompson
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jason Uhlenkott
     
  • Use the function resource_size, which reduces the chance of introducing
    off-by-one errors in calculating the resource size.

    The semantic patch that makes this change is as follows:
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @@
    struct resource *res;
    @@

    - (res->end - res->start) + 1
    + resource_size(res)
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Doug Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     
  • Add support for the Freescale MPC83xx memory controller to the existing
    driver for the Freescale MPC85xx memory controller. The only difference
    between the two processors are in the CS_BNDS register parsing code, which
    has been changed so it will work on both processors.

    The L2 cache controller does not exist on the MPC83xx, but the OF
    subsystem will not use the driver if the device is not present in the OF
    device tree.

    I had to change the nr_pages calculation to make the math work out. I
    checked it on my board and did the math by hand for a 64GB 85xx using 64K
    pages. In both cases, nr_pages * PAGE_SIZE comes out to the correct
    value.

    Signed-off-by: Ira W. Snyder
    Signed-off-by: Doug Thompson
    Cc: Kumar Gala
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ira W. Snyder
     
  • Based on Kumar's new compatible types patch, add P2020 into MPC85xx EDAC
    compatible lists so that EDAC can recognize P2020 meomry controller and L2
    cache controller and export the relevant fields to sysfs.

    EDAC MPC85xx DDR3 support is needed if DDR3 memory stick is installed on a
    P2020DS board so that EDAC core can recognize DDR3 memory type.

    Signed-off-by: Yang Shi
    Acked-by: Dave Jiang
    Signed-off-by: Doug Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yang Shi
     
  • The forward decls for some kernel types are only needed by the code behind
    __KERNEL__, so don't bleed these types to userspace.

    Signed-off-by: Mike Frysinger
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     
  • CLONE_PARENT was used to implement an older threading model. For
    consistency with the CLONE_THREAD check in copy_pid_ns(), disable
    CLONE_PARENT with CLONE_NEWPID, at least until the required semantics of
    pid namespaces are clear.

    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Roland McGrath
    Acked-by: Serge Hallyn
    Cc: Oren Laadan
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • When global or container-init processes use CLONE_PARENT, they create a
    multi-rooted process tree. Besides siblings of global init remain as
    zombies on exit since they are not reaped by their parent (swapper). So
    prevent global and container-inits from creating siblings.

    Signed-off-by: Sukadev Bhattiprolu
    Acked-by: Eric W. Biederman
    Acked-by: Roland McGrath
    Cc: Oren Laadan
    Cc: Oleg Nesterov
    Cc: Serge Hallyn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • It's unused.

    It isn't needed -- read or write flag is already passed and sysctl
    shouldn't care about the rest.

    It _was_ used in two places at arch/frv for some reason.

    Signed-off-by: Alexey Dobriyan
    Cc: David Howells
    Cc: "Eric W. Biederman"
    Cc: Al Viro
    Cc: Ralf Baechle
    Cc: Martin Schwidefsky
    Cc: Ingo Molnar
    Cc: "David S. Miller"
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Signed-off-by: Joe Perches
    Cc: David Daney
    Cc: Herbert Xu
    Cc: Matt Mackall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • The on-chip OTP may be written at runtime, so enable support for it in the
    driver. However, since writing should really be done only on development
    systems, don't bend over backwards to make sure the simple software lock
    is per-fd -- per-device is OK.

    Signed-off-by: Mike Frysinger
    Signed-off-by: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     
  • This driver memory maps the UV Hub RTC.

    Signed-off-by: Dimitri Sivanich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dimitri Sivanich
     
  • If DownLoad.ProductCode == MAX_PRODUCT, that would be a problem when we do
    RIOBootTable[DownLoad.ProductCode] a couple lines down.

    Found by smatch (http://repo.or.cz/w/smatch.git).

    Signed-off-by: Dan Carpenter
    Cc: Jiri Slaby
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     
  • The periodic interrupt from drivers/char/hpet.c does not work correctly,
    both when using the periodic capability of the hardware and while
    emulating the periodic interrupt (when hardware does not support periodic
    mode).

    With timers capable of periodic interrupts, the comparator field is first
    set with the period value followed by set of hidden accumulator, which has
    the side effect of overwriting the comparator value. This results in
    wrong periodicity for the interrupts. For, periodic interrupts to work,
    following steps are necessary, in that order.

    * Set config with Tn_VAL_SET_CNF bit

    * Write to hidden accumulator, the value written is the time when the
    first interrupt should be generated

    * Write compartor with period interval for subsequent interrupts
    (http://www.intel.com/hardwaredesign/hpetspec_1.pdf )

    When emulating periodic timer with timers not capable of periodic
    interrupt, driver is adding the period to counter value instead of
    comparator value, which causes slow drift when using this emulation.

    Also, driver seems to add hpetp->hp_delta both while setting up periodic
    interrupt and while emulating periodic interrupts with timers not capable
    of doing periodic interrupts. This hp_delta will result in slower than
    expected interrupt rate and should not be used while setting the interval.

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Nils Carlson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nils Carlson
     
  • Check whether index is within bounds before grabbing the element.

    Signed-off-by: Roel Kluin
    Cc: Kay Sievers
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roel Kluin
     
  • There are two useless lines in fs/char_dev.c.

    In register_chrdev there is a loop to change all '/' into '!' in the
    kernel object name.
    This code is useless as the same substitution is in kobject_set_name_vargs in
    lib/kobject.c:
    228 /* ewww... some of these buggers have '/' in the name ... */
    229 while ((s = strchr(kobj->name, '/')))
    230 s[0] = '!';

    kobject_set_name_vargs is called by kobject_set_name.
    kobject_set_name is called just above the useless loop.

    [hidave.darkstar@gmail.com: fix warning, remove the unused char *s]
    Signed-off-by: Renzo Davoli
    Cc: Al Viro
    Signed-off-by: Dave Young
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Renzo Davoli
     
  • In read_zero, we check for access_ok() once for the count bytes. It is
    unnecessarily checked again in clear_user. Use __clear_user, which does
    not check for access_ok().

    Signed-off-by: Nikanth Karthikesan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nikanth Karthikesan
     
  • There is a common macro now for testing mixed pointer/errno values, so use
    that rather than handling the casts ourself.

    Signed-off-by: Mike Frysinger
    Acked-by: David McCullough
    Acked-by: Greg Ungerer
    Cc: David Howells
    Cc: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     
  • Ignore the loader's PT_GNU_STACK when calculating the stack size, and only
    consider the executable's PT_GNU_STACK, assuming the executable has one.

    Currently the behaviour is to take the largest stack size and use that,
    but that means you can't reduce the stack size in the executable. The
    loader's stack size should probably only be used when executing the loader
    directly.

    WARNING: This patch is slightly dangerous - it may render a system
    inoperable if the loader's stack size is larger than that of important
    executables, and the system relies unknowingly on this increasing the size
    of the stack.

    Signed-off-by: David Howells
    Signed-off-by: Mike Frysinger
    Acked-by: Paul Mundt
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Introduce a helper function elf_note_info_init() to help fill_note_info()
    to do initializations, also fix the potential memory leaks.

    [akpm@linux-foundation.org: remove NUM_NOTES]
    Signed-off-by: WANG Cong
    Cc: Alexander Viro
    Cc: David Howells
    Cc: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amerigo Wang
     
  • __fatal_signal_pending inlines to one instruction on x86, probably two
    instructions on other machines. It takes two longer x86 instructions just
    to call it and test its return value, not to mention the function itself.

    On my random x86_64 config, this saved 70 bytes of text (59 of those being
    __fatal_signal_pending itself).

    Signed-off-by: Roland McGrath
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     
  • In order to direct the SIGIO signal to a particular thread of a
    multi-threaded application we cannot, like suggested by the manpage, put a
    TID into the regular fcntl(F_SETOWN) call. It will still be send to the
    whole process of which that thread is part.

    Since people do want to properly direct SIGIO we introduce F_SETOWN_EX.

    The need to direct SIGIO comes from self-monitoring profiling such as with
    perf-counters. Perf-counters uses SIGIO to notify that new sample data is
    available. If the signal is delivered to the same task that generated the
    new sample it can augment that data by inspecting the task's user-space
    state right after it returns from the kernel. This is esp. convenient
    for interpreted or virtual machine driven environments.

    Both F_SETOWN_EX and F_GETOWN_EX take a pointer to a struct f_owner_ex
    as argument:

    struct f_owner_ex {
    int type;
    pid_t pid;
    };

    Where type is one of F_OWNER_TID, F_OWNER_PID or F_OWNER_GID.

    Signed-off-by: Peter Zijlstra
    Reviewed-by: Oleg Nesterov
    Tested-by: stephane eranian
    Cc: Michael Kerrisk
    Cc: Roland McGrath
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • group_send_sig_info()->check_kill_permission() assumes that current is the
    sender and uses current_cred().

    This is not true in send_sigio_to_task() case. From the security pov the
    sender is not current, but the task which did fcntl(F_SETOWN), that is why
    we have sigio_perm() which uses the right creds to check.

    Fortunately, send_sigio() always sends either SEND_SIG_PRIV or
    SI_FROMKERNEL() signal, so check_kill_permission() does nothing. But
    still it would be tidier to avoid this bogus security check and save a
    couple of cycles.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: stephane eranian
    Cc: Ingo Molnar
    Cc: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Introduce do_send_sig_info() and convert group_send_sig_info(),
    send_sig_info(), do_send_specific() to use this helper.

    Hopefully it will have more users soon, it allows to specify
    specific/group behaviour via "bool group" argument.

    Shaves 80 bytes from .text.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: stephane eranian
    Cc: Ingo Molnar
    Cc: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • sys_delete_module() can set MODULE_STATE_GOING after
    search_binary_handler() does try_module_get(). In this case
    set_binfmt()->try_module_get() fails but since none of the callers
    check the returned error, the task will run with the wrong old
    ->binfmt.

    The proper fix should change all ->load_binary() methods, but we can
    rely on fact that the caller must hold a reference to binfmt->module
    and use __module_get() which never fails.

    Signed-off-by: Oleg Nesterov
    Acked-by: Rusty Russell
    Cc: Hiroshi Shimamoto
    Cc: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Allow core_pattern pipes to wait for user space to complete

    One of the things that user space processes like to do is look at metadata
    for a crashing process in their /proc/ directory. this is racy
    however, since do_coredump in the kernel doesn't wait for the user space
    process to complete before it reaps the crashing process. This patch
    corrects that. Allowing the kernel to wait for the user space process to
    complete before cleaning up the crashing process. This is a bit tricky to
    do for a few reasons:

    1) The user space process isn't our child, so we can't sys_wait4 on it
    2) We need to close the pipe before waiting for the user process to complete,
    since the user process may rely on an EOF condition

    I've discussed several solutions with Oleg Nesterov off-list about this,
    and this is the one we've come up with. We add ourselves as a pipe reader
    (to prevent premature cleanup of the pipe_inode_info), and remove
    ourselves as a writer (to provide an EOF condition to the writer in user
    space), then we iterate until the user space process exits (which we
    detect by pipe->readers == 1, hence the > 1 check in the loop). When we
    exit the loop, we restore the proper reader/writer values, then we return
    and let filp_close in do_coredump clean up the pipe data properly.

    Signed-off-by: Neil Horman
    Reported-by: Earl Chew
    Cc: Oleg Nesterov
    Cc: Andi Kleen
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman
     
  • Introduce core pipe limiting sysctl.

    Since we can dump cores to pipe, rather than directly to the filesystem,
    we create a condition in which a user can create a very high load on the
    system simply by running bad applications.

    If the pipe reader specified in core_pattern is poorly written, we can
    have lots of ourstandig resources and processes in the system.

    This sysctl introduces an ability to limit that resource consumption.
    core_pipe_limit defines how many in-flight dumps may be run in parallel,
    dumps beyond this value are skipped and a note is made in the kernel log.
    A special value of 0 in core_pipe_limit denotes unlimited core dumps may
    be handled (this is the default value).

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Neil Horman
    Reported-by: Earl Chew
    Cc: Oleg Nesterov
    Cc: Andi Kleen
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman