15 Sep, 2016

1 commit

  • Introduce new flags that defines which ABI to use on creating sigframe.
    Those flags kernel will set according to sigaction syscall ABI,
    which set handler for the signal being delivered.

    So that will drop the dependency on TIF_IA32/TIF_X32 flags on signal deliver.
    Those flags will be used only under CONFIG_COMPAT.

    Similar way ARM uses sa_flags to differ in which mode deliver signal
    for 26-bit applications (look at SA_THIRYTWO).

    Signed-off-by: Dmitry Safonov
    Reviewed-by: Andy Lutomirski
    Cc: 0x7f454c46@gmail.com
    Cc: oleg@redhat.com
    Cc: linux-mm@kvack.org
    Cc: gorcunov@openvz.org
    Cc: xemul@virtuozzo.com
    Link: http://lkml.kernel.org/r/20160905133308.28234-7-dsafonov@virtuozzo.com
    Signed-off-by: Thomas Gleixner

    Dmitry Safonov
     

07 Jul, 2016

1 commit

  • We've converted most timeout related syscalls to hrtimers, but
    sigtimedwait() did not get this treatment.

    Convert it so we get a reasonable accuracy and remove the
    user space exposure to the timer wheel properties.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Frederic Weisbecker
    Cc: Al Viro
    Cc: Arjan van de Ven
    Cc: Chris Mason
    Cc: Cyril Hrubis
    Cc: George Spelvin
    Cc: Josh Triplett
    Cc: Len Brown
    Cc: Linus Torvalds
    Cc: Paul McKenney
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: rt@linutronix.de
    Link: http://lkml.kernel.org/r/20160704094341.787164909@linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

24 May, 2016

1 commit


04 May, 2016

1 commit

  • sigaltstack()'s reported previous state uses a somewhat odd
    convention, but the concept of flag bits is new, and we can do the
    flag bits sensibly. Specifically, let's just report them directly.

    This will allow saving and restoring the sigaltstack state using
    sigaltstack() to work correctly.

    Signed-off-by: Andy Lutomirski
    Cc: Al Viro
    Cc: Amanieu d'Antras
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Michal Hocko
    Cc: Oleg Nesterov
    Cc: Pavel Emelyanov
    Cc: Peter Zijlstra (Intel)
    Cc: Peter Zijlstra
    Cc: Richard Weinberger
    Cc: Sasha Levin
    Cc: Shuah Khan
    Cc: Stas Sergeev
    Cc: Thomas Gleixner
    Cc: Vladimir Davydov
    Cc: linux-api@vger.kernel.org
    Link: http://lkml.kernel.org/r/94b291ec9fd47741a9264851e316e158ded0b00d.1462296606.git.luto@kernel.org
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     

03 May, 2016

2 commits

  • This patch implements the SS_AUTODISARM flag that can be OR-ed with
    SS_ONSTACK when forming ss_flags.

    When this flag is set, sigaltstack will be disabled when entering
    the signal handler; more precisely, after saving sas to uc_stack.
    When leaving the signal handler, the sigaltstack is restored by
    uc_stack.

    When this flag is used, it is safe to switch from sighandler with
    swapcontext(). Without this flag, the subsequent signal will corrupt
    the state of the switched-away sighandler.

    To detect the support of this functionality, one can do:

    err = sigaltstack(SS_DISABLE | SS_AUTODISARM);
    if (err && errno == EINVAL)
    unsupported();

    Signed-off-by: Stas Sergeev
    Cc: Al Viro
    Cc: Aleksa Sarai
    Cc: Amanieu d'Antras
    Cc: Andrea Arcangeli
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Eric W. Biederman
    Cc: Frederic Weisbecker
    Cc: H. Peter Anvin
    Cc: Heinrich Schuchardt
    Cc: Jason Low
    Cc: Josh Triplett
    Cc: Konstantin Khlebnikov
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Palmer Dabbelt
    Cc: Paul Moore
    Cc: Pavel Emelyanov
    Cc: Peter Zijlstra
    Cc: Richard Weinberger
    Cc: Sasha Levin
    Cc: Shuah Khan
    Cc: Tejun Heo
    Cc: Thomas Gleixner
    Cc: Vladimir Davydov
    Cc: linux-api@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Link: http://lkml.kernel.org/r/1460665206-13646-4-git-send-email-stsp@list.ru
    Signed-off-by: Ingo Molnar

    Stas Sergeev
     
  • This patch adds SS_FLAG_BITS - the mask that splits sigaltstack
    mode values and bit-flags. Since there is no bit-flags yet, the
    mask is defined to 0. The flags are added by subsequent patches.
    With every new flag, the mask should have the appropriate bit cleared.

    This makes sure if some flag is tried on a kernel that doesn't
    support it, the -EINVAL error will be returned, because such a
    flag will be treated as an invalid mode rather than the bit-flag.

    That way the existence of the particular features can be probed
    at run-time.

    This change was suggested by Andy Lutomirski:

    https://lkml.org/lkml/2016/3/6/158

    Signed-off-by: Stas Sergeev
    Cc: Al Viro
    Cc: Amanieu d'Antras
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Michal Hocko
    Cc: Oleg Nesterov
    Cc: Pavel Emelyanov
    Cc: Peter Zijlstra (Intel)
    Cc: Peter Zijlstra
    Cc: Richard Weinberger
    Cc: Sasha Levin
    Cc: Shuah Khan
    Cc: Thomas Gleixner
    Cc: Vladimir Davydov
    Cc: linux-api@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Link: http://lkml.kernel.org/r/1460665206-13646-3-git-send-email-stsp@list.ru
    Signed-off-by: Ingo Molnar

    Stas Sergeev
     

23 Mar, 2016

1 commit

  • The value of __ARCH_SI_PREAMBLE_SIZE defines the size (including
    padding) of the part of the struct siginfo that is before the union, and
    it is then used to calculate the needed padding (SI_PAD_SIZE) to make
    the size of struct siginfo equal to 128 (SI_MAX_SIZE) bytes.

    Depending on the target architecture and word width it equals to either
    3 or 4 times sizeof int.

    Since the very beginning we had __ARCH_SI_PREAMBLE_SIZE wrong on the
    parisc architecture for the 64bit kernel build. It's even more
    frustrating, because it can easily be checked at compile time if the
    value was defined correctly.

    This patch adds such a check for the correctness of
    __ARCH_SI_PREAMBLE_SIZE in the hope that it will prevent existing and
    future architectures from running into the same problem.

    I refrained from replacing __ARCH_SI_PREAMBLE_SIZE by offsetof() in
    copy_siginfo() in include/asm-generic/siginfo.h, because a) it doesn't
    make any difference and b) it's used in the Documentation/kmemcheck.txt
    example.

    I ran this patch through the 0-DAY kernel test infrastructure and only
    the parisc architecture triggered as expected. That means that this
    patch should be OK for all major architectures.

    Signed-off-by: Helge Deller
    Cc: Stephen Rothwell
    Cc: Michael Ellerman
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Helge Deller
     

18 Feb, 2016

1 commit

  • A protection key fault is very similar to any other access error.
    There must be a VMA, etc... We even want to take the same action
    (SIGSEGV) that we do with a normal access fault.

    However, we do need to let userspace know that something is
    different. We do this the same way what we did with SEGV_BNDERR
    with Memory Protection eXtensions (MPX): define a new SEGV code:
    SEGV_PKUERR.

    We add a siginfo field: si_pkey that reveals to userspace which
    protection key was set on the PTE that we faulted on. There is
    no other easy way for userspace to figure this out. They could
    parse smaps but that would be a bit cruel.

    We share space with in siginfo with _addr_bnd. #BR faults from
    MPX are completely separate from page faults (#PF) that trigger
    from protection key violations, so we never need both at the same
    time.

    Note that _pkey is a 64-bit value. The current hardware only
    supports 4-bit protection keys. We do this because there is
    _plenty_ of space in _sigfault and it is possible that future
    processors would support more than 4 bits of protection keys.

    The x86 code to actually fill in the siginfo is in the next
    patch.

    Signed-off-by: Dave Hansen
    Reviewed-by: Thomas Gleixner
    Cc: Al Viro
    Cc: Amanieu d'Antras
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dave Hansen
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Palmer Dabbelt
    Cc: Peter Zijlstra
    Cc: Richard Weinberger
    Cc: Rik van Riel
    Cc: Sasha Levin
    Cc: Vegard Nossum
    Cc: Vladimir Davydov
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20160212210212.3A9B83AC@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar

    Dave Hansen
     

06 Feb, 2016

1 commit

  • A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING
    being set.

    Avoid that by making sure we were signaled, like sys_pause() does.

    Signed-off-by: Sasha Levin
    Acked-by: Oleg Nesterov
    Acked-by: Peter Zijlstra (Intel)
    Cc: Dmitry Vyukov
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

21 Nov, 2015

1 commit

  • sigsuspend() is nowhere used except in signal.c itself, so we can mark it
    static do not pollute the global namespace.

    But this patch is more than a boring cleanup patch, it fixes a real issue
    on UserModeLinux. UML has a special console driver to display ttys using
    xterm, or other terminal emulators, on the host side. Vegard reported
    that sometimes UML is unable to spawn a xterm and he's facing the
    following warning:

    WARNING: CPU: 0 PID: 908 at include/linux/thread_info.h:128 sigsuspend+0xab/0xc0()

    It turned out that this warning makes absolutely no sense as the UML
    xterm code calls sigsuspend() on the host side, at least it tries. But
    as the kernel itself offers a sigsuspend() symbol the linker choose this
    one instead of the glibc wrapper. Interestingly this code used to work
    since ever but always blocked signals on the wrong side. Some recent
    kernel change made the WARN_ON() trigger and uncovered the bug.

    It is a wonderful example of how much works by chance on computers. :-)

    Fixes: 68f3f16d9ad0f1 ("new helper: sigsuspend()")
    Signed-off-by: Richard Weinberger
    Reported-by: Vegard Nossum
    Tested-by: Vegard Nossum
    Acked-by: Oleg Nesterov
    Cc: [3.5+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Weinberger
     

07 Nov, 2015

2 commits

  • task_will_free_mem() is wrong in many ways, and in particular the
    SIGNAL_GROUP_COREDUMP check is not reliable: a task can participate in the
    coredumping without SIGNAL_GROUP_COREDUMP bit set.

    change zap_threads() paths to always set SIGNAL_GROUP_COREDUMP even if
    other CLONE_VM processes can't react to SIGKILL. Fortunately, at least
    oom-kill case if fine; it kills all tasks sharing the same mm, so it
    should also kill the process which actually dumps the core.

    The change in prepare_signal() is not strictly necessary, it just ensures
    that the patch does not bring another subtle behavioural change. But it
    reminds us that this SIGNAL_GROUP_EXIT/COREDUMP case needs more changes.

    Signed-off-by: Oleg Nesterov
    Cc: David Rientjes
    Cc: Kyle Walker
    Acked-by: Michal Hocko
    Cc: Stanislav Kozina
    Cc: Tetsuo Handa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • It is hardly possible to enumerate all problems with block_all_signals()
    and unblock_all_signals(). Just for example,

    1. block_all_signals(SIGSTOP/etc) simply can't help if the caller is
    multithreaded. Another thread can dequeue the signal and force the
    group stop.

    2. Even is the caller is single-threaded, it will "stop" anyway. It
    will not sleep, but it will spin in kernel space until SIGCONT or
    SIGKILL.

    And a lot more. In short, this interface doesn't work at all, at least
    the last 10+ years.

    Daniel said:

    Yeah the only times I played around with the DRM_LOCK stuff was when
    old drivers accidentally deadlocked - my impression is that the entire
    DRM_LOCK thing was never really tested properly ;-) Hence I'm all for
    purging where this leaks out of the drm subsystem.

    Signed-off-by: Oleg Nesterov
    Acked-by: Daniel Vetter
    Acked-by: Dave Airlie
    Cc: Richard Weinberger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

07 Aug, 2015

2 commits

  • This function may copy the si_addr_lsb, si_lower and si_upper fields to
    user mode when they haven't been initialized, which can leak kernel
    stack data to user mode.

    Just checking the value of si_code is insufficient because the same
    si_code value is shared between multiple signals. This is solved by
    checking the value of si_signo in addition to si_code.

    Signed-off-by: Amanieu d'Antras
    Cc: Oleg Nesterov
    Cc: Ingo Molnar
    Cc: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amanieu d'Antras
     
  • This function can leak kernel stack data when the user siginfo_t has a
    positive si_code value. The top 16 bits of si_code descibe which fields
    in the siginfo_t union are active, but they are treated inconsistently
    between copy_siginfo_from_user32, copy_siginfo_to_user32 and
    copy_siginfo_to_user.

    copy_siginfo_from_user32 is called from rt_sigqueueinfo and
    rt_tgsigqueueinfo in which the user has full control overthe top 16 bits
    of si_code.

    This fixes the following information leaks:
    x86: 8 bytes leaked when sending a signal from a 32-bit process to
    itself. This leak grows to 16 bytes if the process uses x32.
    (si_code = __SI_CHLD)
    x86: 100 bytes leaked when sending a signal from a 32-bit process to
    a 64-bit process. (si_code = -1)
    sparc: 4 bytes leaked when sending a signal from a 32-bit process to a
    64-bit process. (si_code = any)

    parsic and s390 have similar bugs, but they are not vulnerable because
    rt_[tg]sigqueueinfo have checks that prevent sending a positive si_code
    to a different process. These bugs are also fixed for consistency.

    Signed-off-by: Amanieu d'Antras
    Cc: Oleg Nesterov
    Cc: Ingo Molnar
    Cc: Russell King
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Chris Metcalf
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amanieu d'Antras
     

28 Jun, 2015

1 commit

  • Pull security subsystem updates from James Morris:
    "The main change in this kernel is Casey's generalized LSM stacking
    work, which removes the hard-coding of Capabilities and Yama stacking,
    allowing multiple arbitrary "small" LSMs to be stacked with a default
    monolithic module (e.g. SELinux, Smack, AppArmor).

    See
    https://lwn.net/Articles/636056/

    This will allow smaller, simpler LSMs to be incorporated into the
    mainline kernel and arbitrarily stacked by users. Also, this is a
    useful cleanup of the LSM code in its own right"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (38 commits)
    tpm, tpm_crb: fix le64_to_cpu conversions in crb_acpi_add()
    vTPM: set virtual device before passing to ibmvtpm_reset_crq
    tpm_ibmvtpm: remove unneccessary message level.
    ima: update builtin policies
    ima: extend "mask" policy matching support
    ima: add support for new "euid" policy condition
    ima: fix ima_show_template_data_ascii()
    Smack: freeing an error pointer in smk_write_revoke_subj()
    selinux: fix setting of security labels on NFS
    selinux: Remove unused permission definitions
    selinux: enable genfscon labeling for sysfs and pstore files
    selinux: enable per-file labeling for debugfs files.
    selinux: update netlink socket classes
    signals: don't abuse __flush_signals() in selinux_bprm_committed_creds()
    selinux: Print 'sclass' as string when unrecognized netlink message occurs
    Smack: allow multiple labels in onlycap
    Smack: fix seq operations in smackfs
    ima: pass iint to ima_add_violation()
    ima: wrap event related data to the new ima_event_data structure
    integrity: add validity checks for 'path' parameter
    ...

    Linus Torvalds
     

05 Jun, 2015

1 commit

  • selinux_bprm_committed_creds()->__flush_signals() is not right, we
    shouldn't clear TIF_SIGPENDING unconditionally. There can be other
    reasons for signal_pending(): freezing(), JOBCTL_PENDING_MASK, and
    potentially more.

    Also change this code to check fatal_signal_pending() rather than
    SIGNAL_GROUP_EXIT, it looks a bit better.

    Now we can kill __flush_signals() before it finds another buggy user.

    Note: this code looks racy, we can flush a signal which was sent after
    the task SID has been updated.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Paul Moore

    Oleg Nesterov
     

08 May, 2015

1 commit

  • c56fb6564dcd ("Fix a misaligned load inside ptrace_attach()") makes
    jobctl an "unsigned long". It makes sense to have the masks applied
    to it match that type. This is currently just a cosmetic change, but
    it will prevent the mask from being unexpectedly truncated if we ever
    end up with masks with more bits.

    One instance of "signr" is an int, but I left this alone because the
    mask ensures that it will never overflow.

    Signed-off-by: Palmer Dabbelt
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Chris Metcalf
    Cc: Andrew Morton
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: bobby.prani@gmail.com
    Cc: oleg@redhat.com
    Cc: paulmck@linux.vnet.ibm.com
    Cc: richard@nod.at
    Cc: vdavydov@parallels.com
    Link: http://lkml.kernel.org/r/1430453997-32459-4-git-send-email-palmer@dabbelt.com
    Signed-off-by: Ingo Molnar

    Palmer Dabbelt
     

17 Apr, 2015

1 commit

  • Sending SI_TKILL from rt_[tg]sigqueueinfo was deprecated, so now we issue
    a warning on the first attempt of doing it. We use WARN_ON_ONCE, which is
    not informative and, what is worse, taints the kernel, making the trinity
    syscall fuzzer complain false-positively from time to time.

    It does not look like we need this warning at all, because the behaviour
    changed quite a long time ago (2.6.39), and if an application relies on
    the old API, it gets EPERM anyway and can issue a warning by itself.

    So let us zap the warning in kernel.

    Signed-off-by: Vladimir Davydov
    Acked-by: Oleg Nesterov
    Cc: Richard Weinberger
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov
     

18 Feb, 2015

1 commit

  • Call __set_current_state() instead of assigning the new state directly.
    These interfaces also aid CONFIG_DEBUG_ATOMIC_SLEEP environments, keeping
    track of who changed the state.

    Signed-off-by: Davidlohr Bueso
    Acked-by: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     

13 Feb, 2015

1 commit

  • If an attacker can cause a controlled kernel stack overflow, overwriting
    the restart block is a very juicy exploit target. This is because the
    restart_block is held in the same memory allocation as the kernel stack.

    Moving the restart block to struct task_struct prevents this exploit by
    making the restart_block harder to locate.

    Note that there are other fields in thread_info that are also easy
    targets, at least on some architectures.

    It's also a decent simplification, since the restart code is more or less
    identical on all architectures.

    [james.hogan@imgtec.com: metag: align thread_info::supervisor_stack]
    Signed-off-by: Andy Lutomirski
    Cc: Thomas Gleixner
    Cc: Al Viro
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Kees Cook
    Cc: David Miller
    Acked-by: Richard Weinberger
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Cc: Vineet Gupta
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Haavard Skinnemoen
    Cc: Hans-Christian Egtvedt
    Cc: Steven Miao
    Cc: Mark Salter
    Cc: Aurelien Jacquiot
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Cc: David Howells
    Cc: Richard Kuo
    Cc: "Luck, Tony"
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: Ralf Baechle
    Cc: Jonas Bonn
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Acked-by: Michael Ellerman (powerpc)
    Tested-by: Michael Ellerman (powerpc)
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Chen Liqin
    Cc: Lennox Wu
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Chris Zankel
    Cc: Max Filippov
    Cc: Oleg Nesterov
    Cc: Guenter Roeck
    Signed-off-by: James Hogan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Lutomirski
     

11 Dec, 2014

1 commit

  • Pull x86 MPX support from Thomas Gleixner:
    "This enables support for x86 MPX.

    MPX is a new debug feature for bound checking in user space. It
    requires kernel support to handle the bound tables and decode the
    bound violating instruction in the trap handler"

    * 'x86-mpx-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    asm-generic: Remove asm-generic arch_bprm_mm_init()
    mm: Make arch_unmap()/bprm_mm_init() available to all architectures
    x86: Cleanly separate use of asm-generic/mm_hooks.h
    x86 mpx: Change return type of get_reg_offset()
    fs: Do not include mpx.h in exec.c
    x86, mpx: Add documentation on Intel MPX
    x86, mpx: Cleanup unused bound tables
    x86, mpx: On-demand kernel allocation of bounds tables
    x86, mpx: Decode MPX instruction to get bound violation information
    x86, mpx: Add MPX-specific mmap interface
    x86, mpx: Introduce VM_MPX to indicate that a VMA is MPX specific
    x86, mpx: Add MPX to disabled features
    ia64: Sync struct siginfo with general version
    mips: Sync struct siginfo with general version
    mpx: Extend siginfo structure to include bound violation information
    x86, mpx: Rename cfg_reg_u and status_reg
    x86: mpx: Give bndX registers actual names
    x86: Remove arbitrary instruction size limit in instruction decoder

    Linus Torvalds
     

18 Nov, 2014

1 commit

  • This patch adds new fields about bound violation into siginfo
    structure. si_lower and si_upper are respectively lower bound
    and upper bound when bound violation is caused.

    Signed-off-by: Qiaowei Ren
    Signed-off-by: Dave Hansen
    Cc: linux-mm@kvack.org
    Cc: linux-mips@linux-mips.org
    Cc: Dave Hansen
    Link: http://lkml.kernel.org/r/20141114151819.1908C900@viggo.jf.intel.com
    Signed-off-by: Thomas Gleixner

    Qiaowei Ren
     

30 Oct, 2014

2 commits

  • __cleanup_sighand() frees sighand without RCU grace period. This is
    correct but this looks "obviously buggy" and constantly confuses the
    readers, add the comments to explain how this works.

    Signed-off-by: Oleg Nesterov
    Reviewed-by: Steven Rostedt
    Reviewed-by: Rik van Riel
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Pranith Kumar

    Oleg Nesterov
     
  • The kill_pid_info() can potentially loop indefinitely if tasks are created
    and deleted sufficiently quickly, and if this happens, this function
    will remain in a single RCU read-side critical section indefinitely.
    This commit therefore exits the RCU read-side critical section on each
    pass through the loop. Because a race must happen to retry the loop,
    this should have no performance impact in the common case.

    Reported-by: Dave Jones
    Signed-off-by: Paul E. McKenney
    Acked-by: Oleg Nesterov
    Reviewed-by: Pranith Kumar

    Paul E. McKenney
     

10 Aug, 2014

1 commit

  • Pull arch signal handling cleanup from Richard Weinberger:
    "This patch series moves all remaining archs to the get_signal(),
    signal_setup_done() and sigsp() functions.

    Currently these archs use open coded variants of the said functions.
    Further, unused parameters get removed from get_signal_to_deliver(),
    tracehook_signal_handler() and signal_delivered().

    At the end of the day we save around 500 lines of code."

    * 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc: (43 commits)
    powerpc: Use sigsp()
    openrisc: Use sigsp()
    mn10300: Use sigsp()
    mips: Use sigsp()
    microblaze: Use sigsp()
    metag: Use sigsp()
    m68k: Use sigsp()
    m32r: Use sigsp()
    hexagon: Use sigsp()
    frv: Use sigsp()
    cris: Use sigsp()
    c6x: Use sigsp()
    blackfin: Use sigsp()
    avr32: Use sigsp()
    arm64: Use sigsp()
    arc: Use sigsp()
    sas_ss_flags: Remove nested ternary if
    Rip out get_signal_to_deliver()
    Clean up signal_delivered()
    tracehook_signal_handler: Remove sig, info, ka and regs
    ...

    Linus Torvalds
     

06 Aug, 2014

3 commits


10 Jul, 2014

1 commit

  • The explicit local_irq_save() in __lock_task_sighand() is needed to avoid
    a potential deadlock condition, as noted in a841796f11c90d53 (signal:
    align __lock_task_sighand() irq disabling and RCU). However, someone
    reading the code might be forgiven for concluding that this separate
    local_irq_save() was completely unnecessary. This commit therefore adds
    a comment referencing the shiny new block comment on rcu_read_unlock().

    Reported-by: Oleg Nesterov
    Signed-off-by: Paul E. McKenney
    Acked-by: Oleg Nesterov
    Reviewed-by: Lai Jiangshan

    Paul E. McKenney
     

07 Jun, 2014

9 commits

  • Now that allow_signal() is really trivial we can unify it with
    disallow_signal(). Add the new helper, kernel_sigaction(), and
    reimplement allow_signal/disallow_signal as a trivial wrappers.

    This saves one EXPORT_SYMBOL() and the new helper can have more users.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • disallow_signal() simply sets SIG_IGN, this is not enough and
    recalc_sigpending() is simply pointless because in can never change the
    state of TIF_SIGPENDING.

    If we ignore a signal, we also need to do flush_sigqueue_mask() for the
    case when this signal is pending, this way recalc_sigpending() can
    actually clear TIF_SIGPENDING and we do not "leak" the allocated
    siginfo's.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • allow_signal() does sigdelset(current->blocked) due to historic reason,
    previously it could be called by a daemonize()'ed kthread, and
    daemonize() played with current->blocked.

    Now that daemonize() has gone away we can remove sigdelset() and
    recalc_sigpending(). If a user really wants to unblock a signal, it
    must use sigprocmask() or set_current_block() explicitely.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Move the declaration/definition of allow_signal/disallow_signal to
    signal.h/signal.c. The new place is more logical and allows to use the
    static helpers in signal.c (see the next changes).

    While at it, make them return void and remove the valid_signal() check.
    Nobody checks the returned value, and in-kernel users must not pass the
    wrong signal number.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • The usage of "task_struct *t" and "current" in do_sigaction() looks really
    annoying and chaotic. Initially "t" is used as a cached value of current
    but not consistently, then it is reused as a loop variable and we have to
    use "current" again.

    Clean up this mess and also convert the code to use for_each_thread().

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • "rm_from_queue_full" looks ugly and misleading, especially now that
    rm_from_queue() has gone away. Rename it to flush_sigqueue_mask(), this
    matches flush_sigqueue() we already have.

    Also remove the obsolete comment which explains the difference with
    rm_from_queue() we already killed.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • rm_from_queue() doesn't make sense. The only caller, prepare_signal(),
    can use rm_from_queue_full() with the same effect.

    While at it, change prepare_signal() to use for_each_thread() instead of
    do/while_each_thread.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Cosmetic, but siginitset(0) looks a bit strange, sigemptyset() is what
    do_sigtimedwait() needs.

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Al Viro
    Cc: David Woodhouse
    Cc: Frederic Weisbecker
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: Mathieu Desnoyers
    Cc: Richard Weinberger
    Cc: Steven Rostedt
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • __wake_up_bit() checks waitqueue_active() and thus the caller needs mb()
    as wake_up_bit() documents, fix task_clear_jobctl_trapping().

    Signed-off-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

05 Jun, 2014

1 commit

  • sys_sgetmask and sys_ssetmask are obsolete system calls no longer
    supported in libc.

    This patch replaces architecture related __ARCH_WANT_SYS_SGETMAX by expert
    mode configuration.That option is enabled by default for those
    architectures.

    Signed-off-by: Fabian Frederick
    Cc: Steven Miao
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: Ralf Baechle
    Cc: Koichi Yasutake
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: "David S. Miller"
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Greg Ungerer
    Cc: Heiko Carstens
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

08 Apr, 2014

1 commit