19 Jun, 2007

1 commit


07 Jun, 2007

1 commit

  • This patch should get a few birds. It prevents sigaction calls from
    clearing TIF_SIGPENDING in other threads, which could leak -ERESTART*.
    And It fixes ptrace_stop not to clear it, which done at the syscall exit
    stop could leak -ERESTART*. It probably removes the harm from signalfd,
    at least assuming it never calls dequeue_signal on kernel threads that
    might have used block_all_signals.

    Signed-off-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Satoru Takeuchi
    Signed-off-by: Linus Torvalds

    Roland McGrath
     

24 May, 2007

1 commit

  • Steve Hawkes discovered a problem where recalc_sigpending_tsk was called in
    do_sigaction but no signal_wake_up call was made, preventing later signals
    from waking up blocked threads with TIF_SIGPENDING already set.

    In fact, the few other calls to recalc_sigpending_tsk outside the signals
    code are also subject to this problem in other race conditions.

    This change makes recalc_sigpending_tsk private to the signals code. It
    changes the outside calls, as well as do_sigaction, to use the new
    recalc_sigpending_and_wake instead.

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

    Roland McGrath
     

12 May, 2007

1 commit


11 May, 2007

2 commits

  • This patch series implements the new signalfd() system call.

    I took part of the original Linus code (and you know how badly it can be
    broken :), and I added even more breakage ;) Signals are fetched from the same
    signal queue used by the process, so signalfd will compete with standard
    kernel delivery in dequeue_signal(). If you want to reliably fetch signals on
    the signalfd file, you need to block them with sigprocmask(SIG_BLOCK). This
    seems to be working fine on my Dual Opteron machine. I made a quick test
    program for it:

    http://www.xmailserver.org/signafd-test.c

    The signalfd() system call implements signal delivery into a file descriptor
    receiver. The signalfd file descriptor if created with the following API:

    int signalfd(int ufd, const sigset_t *mask, size_t masksize);

    The "ufd" parameter allows to change an existing signalfd sigmask, w/out going
    to close/create cycle (Linus idea). Use "ufd" == -1 if you want a brand new
    signalfd file.

    The "mask" allows to specify the signal mask of signals that we are interested
    in. The "masksize" parameter is the size of "mask".

    The signalfd fd supports the poll(2) and read(2) system calls. The poll(2)
    will return POLLIN when signals are available to be dequeued. As a direct
    consequence of supporting the Linux poll subsystem, the signalfd fd can use
    used together with epoll(2) too.

    The read(2) system call will return a "struct signalfd_siginfo" structure in
    the userspace supplied buffer. The return value is the number of bytes copied
    in the supplied buffer, or -1 in case of error. The read(2) call can also
    return 0, in case the sighand structure to which the signalfd was attached,
    has been orphaned. The O_NONBLOCK flag is also supported, and read(2) will
    return -EAGAIN in case no signal is available.

    If the size of the buffer passed to read(2) is lower than sizeof(struct
    signalfd_siginfo), -EINVAL is returned. A read from the signalfd can also
    return -ERESTARTSYS in case a signal hits the process. The format of the
    struct signalfd_siginfo is, and the valid fields depends of the (->code &
    __SI_MASK) value, in the same way a struct siginfo would:

    struct signalfd_siginfo {
    __u32 signo; /* si_signo */
    __s32 err; /* si_errno */
    __s32 code; /* si_code */
    __u32 pid; /* si_pid */
    __u32 uid; /* si_uid */
    __s32 fd; /* si_fd */
    __u32 tid; /* si_fd */
    __u32 band; /* si_band */
    __u32 overrun; /* si_overrun */
    __u32 trapno; /* si_trapno */
    __s32 status; /* si_status */
    __s32 svint; /* si_int */
    __u64 svptr; /* si_ptr */
    __u64 utime; /* si_utime */
    __u64 stime; /* si_stime */
    __u64 addr; /* si_addr */
    };

    [akpm@linux-foundation.org: fix signalfd_copyinfo() on i386]
    Signed-off-by: Davide Libenzi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davide Libenzi
     
  • When auditing syscalls that send signals, log the pid and security
    context for each target process. Optimize the data collection by
    adding a counter for signal-related rules, and avoiding allocating an
    aux struct unless we have more than one target process. For process
    groups, collect pid/context data in blocks of 16. Move the
    audit_signal_info() hook up in check_kill_permission() so we audit
    attempts where permission is denied.

    Signed-off-by: Amy Griffis
    Signed-off-by: Al Viro

    Amy Griffis
     

10 May, 2007

3 commits

  • Currently kernel threads use sigprocmask(SIG_BLOCK) to protect against
    signals. This doesn't prevent the signal delivery, this only blocks
    signal_wake_up(). Every "killall -33 kthreadd" means a "struct siginfo"
    leak.

    Change kthreadd_setup() to set all handlers to SIG_IGN instead of blocking
    them (make a new helper ignore_signals() for that). If the kernel thread
    needs some signal, it should use allow_signal() anyway, and in that case it
    should not use CLONE_SIGHAND.

    Note that we can't change daemonize() (should die!) in the same way,
    because it can be used along with CLONE_SIGHAND. This means that
    allow_signal() still should unblock the signal to work correctly with
    daemonize()ed threads.

    However, disallow_signal() doesn't block the signal any longer but ignores
    it.

    NOTE: with or without this patch the kernel threads are not protected from
    handle_stop_signal(), this seems harmless, but not good.

    Signed-off-by: Oleg Nesterov
    Acked-by: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • We already depend on fact that all sub-threads have ->exit_signal == -1, no
    need to set it in zap_other_threads().

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • This patch moves the sig_kernel_* and related macros from kernel/signal.c
    to linux/signal.h, and cleans them up slightly. I need the sig_kernel_*
    macros for default signal behavior in the utrace code, and want to avoid
    duplication or overhead to share the knowledge.

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

    Roland McGrath
     

09 May, 2007

1 commit


08 May, 2007

1 commit

  • This patch provides a new macro

    KMEM_CACHE(, )

    to simplify slab creation. KMEM_CACHE creates a slab with the name of the
    struct, with the size of the struct and with the alignment of the struct.
    Additional slab flags may be specified if necessary.

    Example

    struct test_slab {
    int a,b,c;
    struct list_head;
    } __cacheline_aligned_in_smp;

    test_slab_cache = KMEM_CACHE(test_slab, SLAB_PANIC)

    will create a new slab named "test_slab" of the size sizeof(struct
    test_slab) and aligned to the alignment of test slab. If it fails then we
    panic.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

27 Feb, 2007

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits)
    [PARISC] Use symbolic last syscall in __NR_Linux_syscalls
    [PARISC] Add missing statfs64 and fstatfs64 syscalls
    Revert "[PARISC] Optimize TLB flush on SMP systems"
    [PARISC] Compat signal fixes for 64-bit parisc
    [PARISC] Reorder syscalls to match unistd.h
    Revert "[PATCH] make kernel/signal.c:kill_proc_info() static"
    [PARISC] fix sys_rt_sigqueueinfo
    [PARISC] fix section mismatch warnings in harmony sound driver
    [PARISC] do not export get_register/set_register
    [PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code
    [PARISC] convert to use CONFIG_64BIT instead of __LP64__
    [PARISC] use CONFIG_64BIT instead of __LP64__
    [PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro
    [PARISC] more ENTRY(), ENDPROC(), END() conversions
    [PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc
    [PARISC] Fixes /proc/cpuinfo cache output on B160L
    [PARISC] implement standard ENTRY(), END() and ENDPROC()
    [PARISC] kill ENTRY_SYS_CPUS
    [PARISC] clean up debugging printks in smp.c
    [PARISC] factor syscall_restart code out of do_signal
    ...

    Fix conflict in include/linux/sched.h due to kill_proc_info() being made
    publicly available to PARISC again.

    Linus Torvalds
     

17 Feb, 2007

2 commits


13 Feb, 2007

3 commits

  • Now that I have changed all of the in-tree users remove the old version of
    these functions. This should make it clear to any out of tree users that they
    should be using kill_pgrp kill_pgrp_info or __kill_pgrp_info instead.

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

    Eric W. Biederman
     
  • Every call to is_orphaned_pgrp passed in process_group(current) which is racy
    with respect to another thread changing our process group. It didn't bite us
    because we were dealing with integers and the worse we would get would be a
    stale answer.

    In switching the checks to use struct pid to be a little more efficient and
    prepare the way for pid namespaces this race became apparent.

    So I simplified the calls to the more specialized is_current_pgrp_orphaned so
    I didn't have to worry about making logic changes to avoid the race.

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

    Eric W. Biederman
     
  • The goal is to remove users of the old signal helper functions so they can be
    removed.

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

    Eric W. Biederman
     

12 Feb, 2007

2 commits


14 Dec, 2006

1 commit

  • Currently, if a task is stopped (ie. it's in the TASK_STOPPED state), it
    is considered by the freezer as unfreezeable. However, there may be a race
    between the freezer and the delivery of the continuation signal to the task
    resulting in the task running after we have finished freezing the other
    tasks. This, in turn, may lead to undesirable effects up to and including
    data corruption.

    To prevent this from happening we first need to make the freezer consider
    stopped tasks as freezeable. For this purpose we need to make freezeable()
    stop returning 0 for these tasks and we need to force them to enter the
    refrigerator. However, if there's no continuation signal in the meantime,
    the stopped tasks should remain stopped after all processes have been
    thawed, so we need to send an additional SIGSTOP to each of them before
    waking it up.

    Also, a stopped task that has just been woken up should first check if
    there's a freezing request for it and go to the refrigerator if that's the
    case.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

09 Dec, 2006

2 commits

  • Add a per pid_namespace child-reaper. This is needed so processes are reaped
    within the same pid space and do not spill over to the parent pid space. Its
    also needed so containers preserve existing semantic that pid == 1 would reap
    orphaned children.

    This is based on Eric Biederman's patch: http://lkml.org/lkml/2006/2/6/285

    Signed-off-by: Sukadev Bhattiprolu
    Signed-off-by: Cedric Le Goater
    Cc: Kirill Korotaev
    Cc: Eric W. Biederman
    Cc: Herbert Poetzl
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • Replace occurences of task->signal->session by a new process_session() helper
    routine.

    It will be useful for pid namespaces to abstract the session pid number.

    Signed-off-by: Cedric Le Goater
    Cc: Kirill Korotaev
    Cc: Eric W. Biederman
    Cc: Herbert Poetzl
    Cc: Sukadev Bhattiprolu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cedric Le Goater
     

08 Dec, 2006

3 commits

  • Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Move process freezing functions from include/linux/sched.h to freezer.h, so
    that modifications to the freezer or the kernel configuration don't require
    recompiling just about everything.

    [akpm@osdl.org: fix ueagle driver]
    Signed-off-by: Nigel Cunningham
    Cc: "Rafael J. Wysocki"
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nigel Cunningham
     
  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

05 Nov, 2006

1 commit

  • The previous commit (45c18b0bb579b5c1b89f8c99f1b6ffa4c586ba08, aka "Fix
    unlikely (but possible) race condition on task->user access") fixed a
    potential oops due to __sigqueue_alloc() getting its "user" pointer out
    of sync with switch_user(), and accessing a user pointer that had been
    de-allocated on another CPU.

    It still left another (much less serious) problem, where a concurrent
    __sigqueue_alloc and swich_user could cause sigqueue_alloc to do signal
    pending reference counting for a _different_ user than the one it then
    actually ended up using. No oops, but we'd end up with the wrong signal
    accounting.

    Another case of Oleg's eagle-eyes picking up the problem.

    This is trivially fixed by just making sure we load whichever "user"
    structure we decide to use (it doesn't matter _which_ one we pick, we
    just need to pick one) just once.

    Acked-by: Oleg Nesterov
    Cc: Andrew Morton
    Cc: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

02 Oct, 2006

2 commits

  • The problem with remembering a user space process by its pid is that it is
    possible that the process will exit, pid wrap around will occur.
    Converting to a struct pid avoid that problem, and paves the way for
    implementing a pid namespace.

    Also since usb is the only user of kill_proc_info_as_uid rename
    kill_proc_info_as_uid to kill_pid_info_as_uid and have the new version take
    a struct pid.

    Signed-off-by: Eric W. Biederman
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     
  • Currently the signal functions all either take a task or a pid_t argument.
    This patch implements variants that take a struct pid *. After all of the
    users have been update it is my intention to remove the variants that take a
    pid_t as using pid_t can be more work (an extra hash table lookup) and
    difficult to get right in the presence of multiple pid namespaces.

    There are two kinds of functions introduced in this patch. The are the
    general use functions kill_pgrp and kill_pid which take a priv argument that
    is ultimately used to create the appropriate siginfo information, Then there
    are _kill_pgrp_info, kill_pgrp_info, kill_pid_info the internal implementation
    helpers that take an explicit siginfo.

    The distinction is made because filling out an explcit siginfo is tricky, and
    will be even more tricky when pid namespaces are introduced.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

30 Sep, 2006

1 commit

  • This tightens up __dequeue_signal a little. It also avoids doing
    recalc_sigpending twice in a row, instead doing it once in dequeue_signal.

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

    Roland McGrath
     

27 Sep, 2006

1 commit

  • Move the fallback arch_vma_name() to a sensible place (kernel/signal.c).

    Currently it's in fs/proc/task_mmu.c, a file that is dependent on both
    CONFIG_PROC_FS and CONFIG_MMU being enabled, but it's used from
    kernel/signal.c from where it is called unconditionally.

    [akpm@osdl.org: build fix]
    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

03 Aug, 2006

1 commit

  • Suresh points out that commit b0423a0d9cc836b2c3d796623cd19236bfedfe63
    broke the semantics of a synchronous signal like SIGSEGV occurring
    recursively inside its own handler handler (or, indeed, any other
    context when the signal was blocked).

    That was unintentional, and this fixes things up by reinstating the old
    semantics, but without reverting the cleanups.

    Cc: Paul E. McKenney
    Acked-by: Suresh Siddha
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

01 Jul, 2006

3 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial:
    Remove obsolete #include
    remove obsolete swsusp_encrypt
    arch/arm26/Kconfig typos
    Documentation/IPMI typos
    Kconfig: Typos in net/sched/Kconfig
    v9fs: do not include linux/version.h
    Documentation/DocBook/mtdnand.tmpl: typo fixes
    typo fixes: specfic -> specific
    typo fixes in Documentation/networking/pktgen.txt
    typo fixes: occuring -> occurring
    typo fixes: infomation -> information
    typo fixes: disadvantadge -> disadvantage
    typo fixes: aquire -> acquire
    typo fixes: mecanism -> mechanism
    typo fixes: bandwith -> bandwidth
    fix a typo in the RTC_CLASS help text
    smb is no longer maintained

    Manually merged trivial conflict in arch/um/kernel/vmlinux.lds.S

    Linus Torvalds
     
  • This patch adds a call to the extended security_task_kill hook introduced by
    the prior patch to the kill_proc_info_as_uid function so that these signals
    can be properly mediated by security modules. It also updates the existing
    hook call in check_kill_permission.

    Signed-off-by: David Quigley
    Signed-off-by: James Morris
    Cc: Stephen Smalley
    Cc: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Quigley
     
  • Signed-off-by: Jörn Engel
    Signed-off-by: Adrian Bunk

    Jörn Engel
     

27 Jun, 2006

1 commit

  • With this patch zap_process() sets SIGNAL_GROUP_EXIT while sending SIGKILL to
    the thread group. This means that a TASK_TRACED task

    1. Will be awakened by signal_wake_up(1)

    2. Can't sleep again via ptrace_notify()

    3. Can't go to do_signal_stop() after return
    from ptrace_stop() in get_signal_to_deliver()

    So we can remove all ptrace related stuff from coredump path.

    Signed-off-by: Oleg Nesterov
    Cc: "Eric W. Biederman"
    Cc: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

20 Jun, 2006

1 commit


14 Apr, 2006

1 commit

  • This reverts most of commit 30e0fca6c1d7d26f3f2daa4dd2b12c51dadc778a.
    It broke the case of non-leader MT exec when ptraced.
    I think the bug it was intended to fix was already addressed by commit
    788e05a67c343fa22f2ae1d3ca264e7f15c25eaf.

    Signed-off-by: Roland McGrath
    Acked-by: Oleg Nesterov
    Signed-off-by: Linus Torvalds

    Roland McGrath
     

11 Apr, 2006

1 commit


02 Apr, 2006

1 commit


01 Apr, 2006

1 commit

  • strace /bin/bash misbehaves after resume; this fixes it.

    (akpm: it's scary calling refrigerator() in state TASK_TRACED, but it seems to
    do the right thing).

    Signed-off-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pavel Machek