signal: Distinguish between kernel_siginfo and siginfo
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 25 Sep 2018 09:27:20 +0000 (11:27 +0200)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 3 Oct 2018 14:47:43 +0000 (16:47 +0200)
commitae7795bc6187a15ec51cf258abae656a625f9980
tree2456aa85c6b4be1ac58e272393056c0edbee038a
parent4cd2e0e70af6897ca2247fa1ffb1553ca16b4903
signal: Distinguish between kernel_siginfo and siginfo

Linus recently observed that if we did not worry about the padding
member in struct siginfo it is only about 48 bytes, and 48 bytes is
much nicer than 128 bytes for allocating on the stack and copying
around in the kernel.

The obvious thing of only adding the padding when userspace is
including siginfo.h won't work as there are sigframe definitions in
the kernel that embed struct siginfo.

So split siginfo in two; kernel_siginfo and siginfo.  Keeping the
traditional name for the userspace definition.  While the version that
is used internally to the kernel and ultimately will not be padded to
128 bytes is called kernel_siginfo.

The definition of struct kernel_siginfo I have put in include/signal_types.h

A set of buildtime checks has been added to verify the two structures have
the same field offsets.

To make it easy to verify the change kernel_siginfo retains the same
size as siginfo.  The reduction in size comes in a following change.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
27 files changed:
arch/x86/include/asm/compat.h
drivers/usb/core/devio.c
fs/binfmt_elf.c
fs/coredump.c
fs/fcntl.c
fs/signalfd.c
include/linux/binfmts.h
include/linux/compat.h
include/linux/coredump.h
include/linux/lsm_hooks.h
include/linux/posix-timers.h
include/linux/ptrace.h
include/linux/sched.h
include/linux/sched/signal.h
include/linux/security.h
include/linux/signal.h
include/linux/signal_types.h
include/trace/events/signal.h
ipc/mqueue.c
kernel/ptrace.c
kernel/seccomp.c
kernel/signal.c
kernel/time/posix-timers.c
security/apparmor/lsm.c
security/security.c
security/selinux/hooks.c
security/smack/smack_lsm.c