04 Dec, 2020

1 commit

  • Lilith >_> and Claudio Bozzato of Cisco Talos security team reported
    that collect_syscall() improperly casts the syscall registers to 64-bit
    values leaking the uninitialized last 24 bytes on 32-bit platforms, that
    are visible in /proc/self/syscall.

    The cause is that info->data.args are u64 while syscall_get_arguments()
    uses longs, as hinted by the bogus pointer cast in the function.

    Let's just proceed like the other call places, by retrieving the
    registers into an array of longs before assigning them to the caller's
    array. This was successfully tested on x86_64, i386 and ppc32.

    Reference: CVE-2020-28588, TALOS-2020-1211
    Fixes: 631b7abacd02 ("ptrace: Remove maxargs from task_current_syscall()")
    Cc: Greg KH
    Reviewed-by: Kees Cook
    Tested-by: Michael Ellerman (ppc32)
    Signed-off-by: Willy Tarreau
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    Willy Tarreau
     

17 Oct, 2020

1 commit


05 Apr, 2019

1 commit

  • At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
    function call syscall_get_arguments() implemented in x86 was horribly
    written and not optimized for the standard case of passing in 0 and 6 for
    the starting index and the number of system calls to get. When looking at
    all the users of this function, I discovered that all instances pass in only
    0 and 6 for these arguments. Instead of having this function handle
    different cases that are never used, simply rewrite it to return the first 6
    arguments of a system call.

    This should help out the performance of tracing system calls by ptrace,
    ftrace and perf.

    Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org

    Cc: Oleg Nesterov
    Cc: Kees Cook
    Cc: Andy Lutomirski
    Cc: Dominik Brodowski
    Cc: Dave Martin
    Cc: "Dmitry V. Levin"
    Cc: x86@kernel.org
    Cc: linux-snps-arc@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-c6x-dev@linux-c6x.org
    Cc: uclinux-h8-devel@lists.sourceforge.jp
    Cc: linux-hexagon@vger.kernel.org
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-mips@vger.kernel.org
    Cc: nios2-dev@lists.rocketboards.org
    Cc: openrisc@lists.librecores.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: linux-riscv@lists.infradead.org
    Cc: linux-s390@vger.kernel.org
    Cc: linux-sh@vger.kernel.org
    Cc: sparclinux@vger.kernel.org
    Cc: linux-um@lists.infradead.org
    Cc: linux-xtensa@linux-xtensa.org
    Cc: linux-arch@vger.kernel.org
    Acked-by: Paul Burton # MIPS parts
    Acked-by: Max Filippov # For xtensa changes
    Acked-by: Will Deacon # For the arm64 bits
    Reviewed-by: Thomas Gleixner # for x86
    Reviewed-by: Dmitry V. Levin
    Reported-by: Andy Lutomirski
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (Red Hat)
     

04 Apr, 2019

1 commit

  • task_current_syscall() has a single user that passes in 6 for maxargs, which
    is the maximum arguments that can be used to get system calls from
    syscall_get_arguments(). Instead of passing in a number of arguments to
    grab, just get 6 arguments. The args argument even specifies that it's an
    array of 6 items.

    This will also allow changing syscall_get_arguments() to not get a variable
    number of arguments, but always grab 6.

    Linus also suggested not passing in a bunch of arguments to
    task_current_syscall() but to instead pass in a pointer to a structure, and
    just fill the structure. struct seccomp_data has almost all the parameters
    that is needed except for the stack pointer (sp). As seccomp_data is part of
    uapi, and I'm afraid to change it, a new structure was created
    "syscall_info", which includes seccomp_data and adds the "sp" field.

    Link: http://lkml.kernel.org/r/20161107213233.466776454@goodmis.org

    Cc: Andy Lutomirski
    Cc: Alexey Dobriyan
    Cc: Oleg Nesterov
    Cc: Kees Cook
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (Red Hat)
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

24 Mar, 2017

1 commit

  • Commit:

    aa1f1a639621 ("lib/syscall: Pin the task stack in collect_syscall()")

    ... added logic to handle a process stack not existing, but left sp and pc
    uninitialized, which can be later reported via /proc/$pid/syscall for zombie
    processes, potentially exposing kernel memory to userspace.

    Zombie /proc/$pid/syscall before:
    -1 0xffffffff9a060100 0xffff92f42d6ad900

    Zombie /proc/$pid/syscall after:
    -1 0x0 0x0

    Reported-by: Robert Święcki
    Signed-off-by: Kees Cook
    Reviewed-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: stable@vger.kernel.org # v4.9+
    Fixes: aa1f1a639621 ("lib/syscall: Pin the task stack in collect_syscall()")
    Link: http://lkml.kernel.org/r/20170323224616.GA92694@beast
    Signed-off-by: Ingo Molnar

    Kees Cook
     

02 Mar, 2017

1 commit


16 Sep, 2016

1 commit

  • This will avoid a potential read-after-free if collect_syscall()
    (e.g. /proc/PID/syscall) is called on an exiting task.

    Reported-by: Jann Horn
    Signed-off-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/0bfd8e6d4729c97745d3781a29610a33d0a8091d.1474003868.git.luto@kernel.org
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     

04 Apr, 2014

1 commit


08 Mar, 2012

1 commit


27 Jul, 2008

1 commit

  • This adds the new function task_current_syscall() on machines where the
    asm/syscall.h interface is supported (CONFIG_HAVE_ARCH_TRACEHOOK). It's
    exported for modules to use in the future. This function safely samples
    the state of a blocked thread to collect what system call it is blocked
    in, and the six system call argument registers.

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

    Roland McGrath