03 Feb, 2014

1 commit

  • We have two APIs for compatiblity timespec/val, with confusingly
    similar names. compat_(get|put)_time(val|spec) *do* handle the case
    where COMPAT_USE_64BIT_TIME is set, whereas
    (get|put)_compat_time(val|spec) do not. This is an accident waiting
    to happen.

    Clean it up by favoring the full-service version; the limited version
    is replaced with double-underscore versions static to kernel/compat.c.

    A common pattern is to convert a struct timespec to kernel format in
    an allocation on the user stack. Unfortunately it is open-coded in
    several places. Since this allocation isn't actually needed if
    COMPAT_USE_64BIT_TIME is true (since user format == kernel format)
    encapsulate that whole pattern into the function
    compat_convert_timespec(). An equivalent function should be written
    for struct timeval if it is needed in the future.

    Finally, get rid of compat_(get|put)_timeval_convert(): each was only
    used once, and the latter was not even doing what the function said
    (no conversion actually was being done.) Moving the conversion into
    compat_sys_settimeofday() itself makes the code much more similar to
    sys_settimeofday() itself.

    v3: Remove unused compat_convert_timeval().

    v2: Drop bogus "const" in the destination argument for
    compat_convert_time*().

    Cc: Mauro Carvalho Chehab
    Cc: Alexander Viro
    Cc: Hans Verkuil
    Cc: Andrew Morton
    Cc: Heiko Carstens
    Cc: Manfred Spraul
    Cc: Mateusz Guzik
    Cc: Rafael Aquini
    Cc: Davidlohr Bueso
    Cc: Stephen Rothwell
    Cc: Dan Carpenter
    Cc: Arnd Bergmann
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Linus Torvalds
    Cc: Catalin Marinas
    Cc: Will Deacon
    Tested-by: H.J. Lu
    Signed-off-by: H. Peter Anvin

    H. Peter Anvin
     

24 Feb, 2013

1 commit

  • Pull signal handling cleanups from Al Viro:
    "This is the first pile; another one will come a bit later and will
    contain SYSCALL_DEFINE-related patches.

    - a bunch of signal-related syscalls (both native and compat)
    unified.

    - a bunch of compat syscalls switched to COMPAT_SYSCALL_DEFINE
    (fixing several potential problems with missing argument
    validation, while we are at it)

    - a lot of now-pointless wrappers killed

    - a couple of architectures (cris and hexagon) forgot to save
    altstack settings into sigframe, even though they used the
    (uninitialized) values in sigreturn; fixed.

    - microblaze fixes for delivery of multiple signals arriving at once

    - saner set of helpers for signal delivery introduced, several
    architectures switched to using those."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (143 commits)
    x86: convert to ksignal
    sparc: convert to ksignal
    arm: switch to struct ksignal * passing
    alpha: pass k_sigaction and siginfo_t using ksignal pointer
    burying unused conditionals
    make do_sigaltstack() static
    arm64: switch to generic old sigaction() (compat-only)
    arm64: switch to generic compat rt_sigaction()
    arm64: switch compat to generic old sigsuspend
    arm64: switch to generic compat rt_sigqueueinfo()
    arm64: switch to generic compat rt_sigpending()
    arm64: switch to generic compat rt_sigprocmask()
    arm64: switch to generic sigaltstack
    sparc: switch to generic old sigsuspend
    sparc: COMPAT_SYSCALL_DEFINE does all sign-extension as well as SYSCALL_DEFINE
    sparc: kill sign-extending wrappers for native syscalls
    kill sparc32_open()
    sparc: switch to use of generic old sigaction
    sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE
    mips: switch to generic sys_fork() and sys_clone()
    ...

    Linus Torvalds
     

19 Feb, 2013

1 commit

  • This reverts commit ec0c4274e33c0373e476b73e01995c53128f1257.

    get_robust_list() is in use and a removal would break existing user
    space. With the permission checks in place it's not longer a security
    hole. Remove the deprecation warnings.

    Signed-off-by: Thomas Gleixner
    Cc: Cyrill Gorcunov
    Cc: Richard Weinberger
    Cc: akpm@linux-foundation.org
    Cc: paul.gortmaker@windriver.com
    Cc: davej@redhat.com
    Cc: keescook@chromium.org
    Cc: stable@vger.kernel.org
    Cc: ebiederm@xmission.com

    Thomas Gleixner
     

04 Feb, 2013

1 commit


29 Mar, 2012

2 commits

  • Notify get_robust_list users that the syscall is going away.

    Suggested-by: Thomas Gleixner
    Signed-off-by: Kees Cook
    Cc: Randy Dunlap
    Cc: Darren Hart
    Cc: Peter Zijlstra
    Cc: Jiri Kosina
    Cc: Eric W. Biederman
    Cc: David Howells
    Cc: Serge E. Hallyn
    Cc: kernel-hardening@lists.openwall.com
    Cc: spender@grsecurity.net
    Link: http://lkml.kernel.org/r/20120323190855.GA27213@www.outflux.net
    Signed-off-by: Thomas Gleixner

    Kees Cook
     
  • It was possible to extract the robust list head address from a setuid
    process if it had used set_robust_list(), allowing an ASLR info leak. This
    changes the permission checks to be the same as those used for similar
    info that comes out of /proc.

    Running a setuid program that uses robust futexes would have had:
    cred->euid != pcred->euid
    cred->euid == pcred->uid
    so the old permissions check would allow it. I'm not aware of any setuid
    programs that use robust futexes, so this is just a preventative measure.

    (This patch is based on changes from grsecurity.)

    Signed-off-by: Kees Cook
    Cc: Darren Hart
    Cc: Peter Zijlstra
    Cc: Jiri Kosina
    Cc: Eric W. Biederman
    Cc: David Howells
    Cc: Serge E. Hallyn
    Cc: kernel-hardening@lists.openwall.com
    Cc: spender@grsecurity.net
    Link: http://lkml.kernel.org/r/20120319231253.GA20893@www.outflux.net
    Signed-off-by: Thomas Gleixner

    Kees Cook
     

24 Mar, 2011

1 commit

  • CAP_IPC_OWNER and CAP_IPC_LOCK can be checked against current_user_ns(),
    because the resource comes from current's own ipc namespace.

    setuid/setgid are to uids in own namespace, so again checks can be against
    current_user_ns().

    Changelog:
    Jan 11: Use task_ns_capable() in place of sched_capable().
    Jan 11: Use nsown_capable() as suggested by Bastian Blank.
    Jan 11: Clarify (hopefully) some logic in futex and sched.c
    Feb 15: use ns_capable for ipc, not nsown_capable
    Feb 23: let copy_ipcs handle setting ipc_ns->user_ns
    Feb 23: pass ns down rather than taking it from current

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Serge E. Hallyn
    Acked-by: "Eric W. Biederman"
    Acked-by: Daniel Lezcano
    Acked-by: David Howells
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn