14 Jul, 2008

11 commits

  • Enable security modules to distinguish reading of process state via
    proc from full ptrace access by renaming ptrace_may_attach to
    ptrace_may_access and adding a mode argument indicating whether only
    read access or full attach access is requested. This allows security
    modules to permit access to reading process state without granting
    full ptrace access. The base DAC/capability checking remains unchanged.

    Read access to /proc/pid/mem continues to apply a full ptrace attach
    check since check_mem_permission() already requires the current task
    to already be ptracing the target. The other ptrace checks within
    proc for elements like environ, maps, and fds are changed to pass the
    read mode instead of attach.

    In the SELinux case, we model such reading of process state as a
    reading of a proc file labeled with the target process' label. This
    enables SELinux policy to permit such reading of process state without
    permitting control or manipulation of the target process, as there are
    a number of cases where programs probe for such information via proc
    but do not need to be able to control the target (e.g. procps,
    lsof, PolicyKit, ConsoleKit). At present we have to choose between
    allowing full ptrace in policy (more permissive than required/desired)
    or breaking functionality (or in some cases just silencing the denials
    via dontaudit rules but this can hide genuine attacks).

    This version of the patch incorporates comments from Casey Schaufler
    (change/replace existing ptrace_may_attach interface, pass access
    mode), and Chris Wright (provide greater consistency in the checking).

    Note that like their predecessors __ptrace_may_attach and
    ptrace_may_attach, the __ptrace_may_access and ptrace_may_access
    interfaces use different return value conventions from each other (0
    or -errno vs. 1 or 0). I retained this difference to avoid any
    changes to the caller logic but made the difference clearer by
    changing the latter interface to return a bool rather than an int and
    by adding a comment about it to ptrace.h for any future callers.

    Signed-off-by: Stephen Smalley
    Acked-by: Chris Wright
    Signed-off-by: James Morris

    Stephen Smalley
     
  • Remove inherit field from inode_security_struct, per Stephen Smalley:
    "Let's just drop inherit altogether - dead field."

    Signed-off-by: James Morris

    James Morris
     
  • reorder inode_security_struct to remove padding on 64 bit builds

    size reduced from 72 to 64 bytes increasing objects per slab to 64.

    Signed-off-by: Richard Kennedy
    Signed-off-by: James Morris

    Richard Kennedy
     
  • Formatting and syntax changes

    whitespace, tabs to spaces, trailing space
    put open { on same line as struct def
    remove unneeded {} after if statements
    change printk("Lu") to printk("llu")
    convert asm/uaccess.h to linux/uaacess.h includes
    remove unnecessary asm/bug.h includes
    convert all users of simple_strtol to strict_strtol

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     
  • Fix a sleeping function called from invalid context bug by moving allocation
    to the callers prior to taking the policy rdlock.

    Signed-off-by: Stephen Smalley
    Signed-off-by: James Morris

    Stephen Smalley
     
  • Introduce SELinux support for deferred mapping of security contexts in
    the SID table upon policy reload, and use this support for inode
    security contexts when the context is not yet valid under the current
    policy. Only processes with CAP_MAC_ADMIN + mac_admin permission in
    policy can set undefined security contexts on inodes. Inodes with
    such undefined contexts are treated as having the unlabeled context
    until the context becomes valid upon a policy reload that defines the
    context. Context invalidation upon policy reload also uses this
    support to save the context information in the SID table and later
    recover it upon a subsequent policy reload that defines the context
    again.

    This support is to enable package managers and similar programs to set
    down file contexts unknown to the system policy at the time the file
    is created in order to better support placing loadable policy modules
    in packages and to support build systems that need to create images of
    different distro releases with different policies w/o requiring all of
    the contexts to be defined or legal in the build host policy.

    With this patch applied, the following sequence is possible, although
    in practice it is recommended that this permission only be allowed to
    specific program domains such as the package manager.

    # rmdir baz
    # rm bar
    # touch bar
    # chcon -t foo_exec_t bar # foo_exec_t is not yet defined
    chcon: failed to change context of `bar' to `system_u:object_r:foo_exec_t': Invalid argument
    # mkdir -Z system_u:object_r:foo_exec_t baz
    mkdir: failed to set default file creation context to `system_u:object_r:foo_exec_t': Invalid argument
    # cat setundefined.te
    policy_module(setundefined, 1.0)
    require {
    type unconfined_t;
    type unlabeled_t;
    }
    files_type(unlabeled_t)
    allow unconfined_t self:capability2 mac_admin;
    # make -f /usr/share/selinux/devel/Makefile setundefined.pp
    # semodule -i setundefined.pp
    # chcon -t foo_exec_t bar # foo_exec_t is not yet defined
    # mkdir -Z system_u:object_r:foo_exec_t baz
    # ls -Zd bar baz
    -rw-r--r-- root root system_u:object_r:unlabeled_t bar
    drwxr-xr-x root root system_u:object_r:unlabeled_t baz
    # cat foo.te
    policy_module(foo, 1.0)
    type foo_exec_t;
    files_type(foo_exec_t)
    # make -f /usr/share/selinux/devel/Makefile foo.pp
    # semodule -i foo.pp # defines foo_exec_t
    # ls -Zd bar baz
    -rw-r--r-- root root user_u:object_r:foo_exec_t bar
    drwxr-xr-x root root system_u:object_r:foo_exec_t baz
    # semodule -r foo
    # ls -Zd bar baz
    -rw-r--r-- root root system_u:object_r:unlabeled_t bar
    drwxr-xr-x root root system_u:object_r:unlabeled_t baz
    # semodule -i foo.pp
    # ls -Zd bar baz
    -rw-r--r-- root root user_u:object_r:foo_exec_t bar
    drwxr-xr-x root root system_u:object_r:foo_exec_t baz
    # semodule -r setundefined foo
    # chcon -t foo_exec_t bar # no longer defined and not allowed
    chcon: failed to change context of `bar' to `system_u:object_r:foo_exec_t': Invalid argument
    # rmdir baz
    # mkdir -Z system_u:object_r:foo_exec_t baz
    mkdir: failed to set default file creation context to `system_u:object_r:foo_exec_t': Invalid argument

    Signed-off-by: Stephen Smalley
    Signed-off-by: James Morris

    Stephen Smalley
     
  • Linus Torvalds
     
  • # cat devices.list
    c 1:3 r
    # echo 'c 1:3 w' > sub/devices.allow
    # cat sub/devices.list
    c 1:3 w

    As illustrated, the parent group has no write permission to /dev/null, so
    it's child should not be allowed to add this write permission.

    Signed-off-by: Li Zefan
    Acked-by: Serge Hallyn
    Cc: Serge Hallyn
    Cc: Paul Menage
    Cc: Pavel Emelyanov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     
  • # echo "b $((0x7fffffff)):$((0x80000000)) rwm" > devices.allow
    # cat devices.list
    b 214748364:-21474836 rwm

    though a major/minor number of 0x800000000 is meaningless, we
    should not cast it to a negative value.

    Signed-off-by: Li Zefan
    Acked-by: Serge Hallyn
    Cc: Serge Hallyn
    Cc: Paul Menage
    Cc: Pavel Emelyanov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     
  • Signed-off-by: Jiri Pirko
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Pirko
     
  • …l/git/tip/linux-2.6-tip

    * 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    cpusets, hotplug, scheduler: fix scheduler domain breakage

    Linus Torvalds
     

13 Jul, 2008

14 commits

  • Commit f18f982ab ("sched: CPU hotplug events must not destroy scheduler
    domains created by the cpusets") introduced a hotplug-related problem as
    described below:

    Upon CPU_DOWN_PREPARE,

    update_sched_domains() -> detach_destroy_domains(&cpu_online_map)

    does the following:

    /*
    * Force a reinitialization of the sched domains hierarchy. The domains
    * and groups cannot be updated in place without racing with the balancing
    * code, so we temporarily attach all running cpus to the NULL domain
    * which will prevent rebalancing while the sched domains are recalculated.
    */

    The sched-domains should be rebuilt when a CPU_DOWN ops. has been
    completed, effectively either upon CPU_DEAD{_FROZEN} (upon success) or
    CPU_DOWN_FAILED{_FROZEN} (upon failure -- restore the things to their
    initial state). That's what update_sched_domains() also does but only
    for !CPUSETS case.

    With f18f982ab, sched-domains' reinitialization is delegated to
    CPUSETS code:

    cpuset_handle_cpuhp() -> common_cpu_mem_hotplug_unplug() ->
    rebuild_sched_domains()

    Being called for CPU_UP_PREPARE and if its callback is called after
    update_sched_domains()), it just negates all the work done by
    update_sched_domains() -- i.e. a soon-to-be-offline cpu is included in
    the sched-domains and that makes it visible for the load-balancer
    while the CPU_DOWN ops. is in progress.

    __migrate_live_tasks() moves the tasks off a 'dead' cpu (it's already
    "offline" when this function is called).

    try_to_wake_up() is called for one of these tasks from another CPU ->
    the load-balancer (wake_idle()) picks up a "dead" CPU and places the
    task on it. Then e.g. BUG_ON(rq->nr_running) detects this a bit later
    -> oops.

    Signed-off-by: Dmitry Adamushko
    Tested-by: Vegard Nossum
    Cc: Paul Menage
    Cc: Max Krasnyansky
    Cc: Paul Jackson
    Cc: Peter Zijlstra
    Cc: miaox@cn.fujitsu.com
    Cc: rostedt@goodmis.org
    Cc: Linus Torvalds
    Signed-off-by: Ingo Molnar

    Dmitry Adamushko
     
  • …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:
    x86: fix ldt limit for 64 bit

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
    [SCSI] bsg: fix oops on remove
    [SCSI] fusion: default MSI to disabled for SPI and FC controllers
    [SCSI] ipr: Fix HDIO_GET_IDENTITY oops for SATA devices
    [SCSI] mptspi: fix oops in mptspi_dv_renegotiate_work()
    [SCSI] erase invalid data returned by device

    Linus Torvalds
     
  • The current definition of wksidarr works fine on little endian arches
    (since cpu_to_le32 is a no-op there), but on big-endian arches, it fails
    to compile with this error:

    error: braced-group within expression allowed only inside a function

    The problem is that this static declaration has cpu_to_le32 embedded
    within it, and that expands into a function macro. We need to use
    __constant_cpu_to_le32() instead.

    Signed-off-by: Jeff Layton
    Cc: Steven French
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Layton
     
  • Try this:

    mount a share with unix extensions
    create a file on it
    umount the share

    You'll get the following message in the ring buffer:

    VFS: Busy inodes after unmount of cifs. Self-destruct in 5 seconds. Have a
    nice day...

    ...the problem is that cifs_get_inode_info_unix is creating and hashing
    a new inode even when it's going to return error anyway. The first
    lookup when creating a file returns an error so we end up leaking this
    inode before we do the actual create. This appears to be a regression
    caused by commit 0e4bbde94fdc33f5b3d793166b21bf768ca3e098.

    The following patch seems to fix it for me, and fixes a minor
    formatting nit as well.

    Signed-off-by: Jeff Layton
    Acked-by: Steven French
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Layton
     
  • Fix FRV irqs_disabled() to return an int, not an unsigned long to avoid
    this warning:

    kernel/sched.c: In function '__might_sleep':
    kernel/sched.c:8198: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Cc: Philippe Elie
    Cc: John Levon
    Cc: Maynard Johnson
    Cc: Richard Purdie
    Cc: Daniel Hansel
    Cc: Jason Yeh
    Cc: Andrew Morton
    Signed-off-by: Robert Richter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert Richter
     
  • Add the rtc8564 chip entry

    Signed-off-by: Jon Smirl
    Signed-off-by: Alessandro Zummo
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jon Smirl
     
  • Fix chip naming from fm3031-rtc to fm3031

    Signed-off-by: Alessandro Zummo
    Cc: Sergey Lapin
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alessandro Zummo
     
  • Cortland Setlow pointed out a bug in ov7670.c where the result from
    ov7670_read() was just being checked for !0, rather than
    Signed-off-by: Andres Salomon
    Acked-by: Jonathan Corbet
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andres Salomon
     
  • I had 8250.nr_uarts=16 in the boot line of a test kernel and I had a weird
    mysterious crash in sysfs. After taking an in-depth look I realized that
    CONFIG_SERIAL_8250_NR_UARTS was set to 4 and I was walking off the end of
    the serial8250_ports array.

    Ouch!!!

    Don't let this happen to someone else.

    Signed-off-by: Eric W. Biederman
    Acked-by: Alan Cox
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     
  • This patch is a bugfix for how defio handles multiple processes manipulating
    the same framebuffer.

    Thanks to Bernard Blackham for identifying this bug.

    It occurs when two applications mmap the same framebuffer and concurrently
    write to the same page. Normally, this doesn't occur since only a single
    process mmaps the framebuffer. The symptom of the bug is that the mapping
    applications will hang. The cause is that defio incorrectly tries to add the
    same page twice to the pagelist. The solution I have is to walk the pagelist
    and check for a duplicate before adding. Since I needed to walk the pagelist,
    I now also keep the pagelist in sorted order.

    Signed-off-by: Jaya Kumar
    Cc: Bernard Blackham
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jaya Kumar
     
  • Coverity CID: 1356 RESOURCE_LEAK

    I found a very old patch for this that was Acked but did not get applied
    https://lists.linux-foundation.org/pipermail/kernel-janitors/2006-September/016362.html

    There looks to be a small leak in isdn_writebuf_stub() in isdn_common.c, when
    copy_from_user() returns an un-copied data length (length != 0). The below
    patch should be a minimally invasive fix.

    Signed-off-by: Darren Jenkins
    Acked-by: Karsten Keil
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Darren Jenkins
     
  • Coverity CID: 2172 RESOURCE_LEAK

    When pool_allocate() tries to enlarge a packet, if it can not allocate enough
    memory, it returns NULL without first freeing the old packet.

    This patch just frees the packet first.

    Signed-off-by: Darren Jenkins
    Acked-by: Jiri Kosina
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Darren Jenkins
     

12 Jul, 2008

8 commits

  • If you do a modremove of any sas driver, you run into an oops on
    shutdown when the host is removed (coming from the host bsg device).
    The root cause seems to be that there's a use after free of the
    bsg_class_device: In bsg_kref_release_function, this is used (to do a
    put_device(bcg->parent) after bcg->release has been called. In sas (and
    possibly many other things) bcd->release frees the queue which contains
    the bsg_class_device, so we get a put_device on unreferenced memory.
    Fix this by taking a copy of the pointer to the parent before releasing
    bsg.

    Acked-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    James Bottomley
     
  • There's a fault on the FC controllers that makes them not respond
    correctly to MSI. The SPI controllers are fine, but are likely to be
    onboard on older motherboards which don't handle MSI correctly, so
    default both these cases to disabled. Enable by setting the module
    parameter mpt_msi_enable=1.

    For the SAS case, enable MSI by default, but it can be disabled by
    setting the module parameter mpt_msi_enable=0.

    Cc: "Prakash, Sathya"
    Signed-off-by: James Bottomley

    James Bottomley
     
  • Fix size of LDT entries. On x86-64, ldt_desc is a double-sized descriptor.

    Signed-off-by: Michael Karcher
    Signed-off-by: Ingo Molnar

    Michael Karcher
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
    [PATCH] IPMI: return correct value from ipmi_write

    Linus Torvalds
     
  • This patch corrects the handling of write operations to the IPMI watchdog
    to work as intended by returning the number of characters actually
    processed. Without this patch, an "echo V >/dev/watchdog" enables the
    watchdog if IPMI is providing the watchdog function.

    Signed-off-by: Mark Rustad
    Signed-off-by: Corey Minyard
    Signed-off-by: Wim Van Sebroeck

    Mark Rustad
     
  • Currently, ipr does not support HDIO_GET_IDENTITY to SATA devices.
    An oops occurs if userspace attempts to send the command. Since hald
    issues the command, ensure we fail the ioctl in ipr. This is a
    temporary solution to the oops. Once the ipr libata EH conversion
    is upstream, ipr will fully support HDIO_GET_IDENTITY.

    Tested-by: Milton Miller
    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     
  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
    libata-acpi: don't call sleeping function from invalid context
    Added Targa Visionary 1000 IDE adapter to pata_sis.c
    libata-acpi: filter out DIPM enable

    Linus Torvalds
     
  • When we release the iclog, we do an atomic_dec_and_lock to determine if
    we are the last reference and need to trigger update of log headers and
    writeout. However, in xlog_state_get_iclog_space() we also need to
    check if we have the last reference count there. If we do, we release
    the log buffer, otherwise we decrement the reference count.

    But the compare and decrement in xlog_state_get_iclog_space() is not
    atomic, so both places can see a reference count of 2 and neither will
    release the iclog. That leads to a filesystem hang.

    Close the race by replacing the atomic_read() and atomic_dec() pair with
    atomic_add_unless() to ensure that they are executed atomically.

    Signed-off-by: Dave Chinner
    Reviewed-by: Tim Shimmin
    Tested-by: Eric Sandeen
    Signed-off-by: Linus Torvalds

    Dave Chinner
     

11 Jul, 2008

7 commits

  • The problem is introduced by commit
    664d080c41463570b95717b5ad86e79dc1be0877.

    acpi_evaluate_integer is a sleeping function,
    and it should not be called with spin_lock_irqsave.
    https://bugzilla.redhat.com/show_bug.cgi?id=451399

    Signed-off-by: Zhang Rui
    Signed-off-by: Jeff Garzik

    Zhang Rui
     
  • This enables short 40-wire detection for my laptop thus
    enabling UDMA/100.

    Signed-off-by: Jeff Garzik

    Kai Krakow
     
  • Some BIOSen enable DIPM via _GTF which causes command timeouts under
    certain configuration. This didn't occur on 2.6.25 because 2.6.25
    defaulted to SRST, so _GTF wasn't executed during boot probe, so ahci
    host reset disabled DIPM and as _GTF wasn't executed after SRST, DIPM
    wasn't enabled. On 2.6.26, hardreset is used during probe and after
    probe _GTF is executed enabling DIPM and thus the failures.

    This patch could theoretically disable DIPM on machines which used to
    have it enabled on 2.6.25 but AFAIK ahci is currently the only driver
    which uses SATA ACPI hierarchy (_SDD) and as the host reset would have
    always disabled DIPM, this shouldn't happen.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • The IRQ rate reported back by the RTC is incorrect when HPET is enabled.

    Newer hardware that has HPET to emulate the legacy RTC device gets this value
    wrong since after it sets the rate, it returns before setting the variable
    used to report the IRQ rate back to users of the device -- so the set rate and
    the reported rate get out of sync.

    Signed-off-by: Paul Gortmaker
    Cc: Ingo Molnar
    Cc: David Brownell
    Cc: Thomas Gleixner
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Gortmaker
     
  • This patch was created by

    git grep -E -l 'Rus(el|s?e)l King' | xargs -r -t perl -p -i -e 's/Rus(el|s?e)l King/Russell King/g'

    Signed-off-by: Uwe Kleine-König
    Most-Definitely-Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     
  • Fix RapidIO device reference counting.

    Signed-of-by: Eugene Surovegin
    Cc: Matt Porter
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eugene Surovegin
     
  • This patch adds Intel TPM TIS device HID: ICO0102

    Signed-off-by: Marcin Obara
    Acked-by: Marcel Selhorst
    Acked-by: Rajiv Andrade
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Obara