linux/arch
Peter Collingbourne 23acdc76f1 signal: clear non-uapi flag bits when passing/returning sa_flags
Previously we were not clearing non-uapi flag bits in
sigaction.sa_flags when storing the userspace-provided sa_flags or
when returning them via oldact. Start doing so.

This allows userspace to detect missing support for flag bits and
allows the kernel to use non-uapi bits internally, as we are already
doing in arch/x86 for two flag bits. Now that this change is in
place, we no longer need the code in arch/x86 that was hiding these
bits from userspace, so remove it.

This is technically a userspace-visible behavior change for sigaction, as
the unknown bits returned via oldact.sa_flags are no longer set. However,
we are free to define the behavior for unknown bits exactly because
their behavior is currently undefined, so for now we can define the
meaning of each of them to be "clear the bit in oldact.sa_flags unless
the bit becomes known in the future". Furthermore, this behavior is
consistent with OpenBSD [1], illumos [2] and XNU [3] (FreeBSD [4] and
NetBSD [5] fail the syscall if unknown bits are set). So there is some
precedent for this behavior in other kernels, and in particular in XNU,
which is probably the most popular kernel among those that I looked at,
which means that this change is less likely to be a compatibility issue.

Link: [1] f634a6a4b5/sys/kern/kern_sig.c (L278)
Link: [2] 76f19f5fdc/usr/src/uts/common/syscall/sigaction.c (L86)
Link: [3] a449c6a3b8/bsd/kern/kern_sig.c (L480)
Link: [4] eded70c370/sys/kern/kern_sig.c (L699)
Link: [5] 3365779bec/sys/kern/sys_sig.c (L473)
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Link: https://linux-review.googlesource.com/id/I35aab6f5be932505d90f3b3450c083b4db1eca86
Link: https://lkml.kernel.org/r/878dbcb5f47bc9b11881c81f745c0bef5c23f97f.1605235762.git.pcc@google.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2020-11-23 10:31:05 -06:00
..
alpha arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
arc ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline 2020-11-02 11:45:09 -08:00
arm signal: clear non-uapi flag bits when passing/returning sa_flags 2020-11-23 10:31:05 -06:00
arm64 arm64 fixes for -rc3 2020-11-06 12:42:49 -08:00
c6x arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
csky treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
h8300 arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
hexagon arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
ia64 arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
m68k arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
microblaze treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
mips arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
nds32 arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
nios2 arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
openrisc arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
parisc signal: clear non-uapi flag bits when passing/returning sa_flags 2020-11-23 10:31:05 -06:00
powerpc arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
riscv RISC-V: Fix the VDSO symbol generaton for binutils-2.35+ 2020-11-06 00:03:48 -08:00
s390 arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
sh treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
sparc arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
um arch/um: partially revert the conversion to __section() macro 2020-10-26 15:39:37 -07:00
x86 signal: clear non-uapi flag bits when passing/returning sa_flags 2020-11-23 10:31:05 -06:00
xtensa arch: move SA_* definitions to generic headers 2020-11-23 10:31:05 -06:00
.gitignore
Kconfig Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-22 09:59:21 -07:00