linux/arch
Peter Collingbourne 62daaaec31 UPSTREAM: 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>
(cherry picked from commit 23acdc76f1)
Bug: 135772972
Change-Id: I35aab6f5be932505d90f3b3450c083b4db1eca86
2021-01-22 10:05:52 -08:00
..
alpha UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-01-19 18:27:26 +01:00
arm UPSTREAM: signal: clear non-uapi flag bits when passing/returning sa_flags 2021-01-22 10:05:52 -08:00
arm64 FROMLIST: arm64/mm: add speculative page fault 2021-01-22 18:02:00 +00:00
c6x Revert "Revert "uaccess: add infrastructure for kernel builds with set_fs()"" 2020-10-28 15:08:39 +01:00
csky Merge 5.10.7 into android12-5.10 2021-01-13 10:29:42 +01:00
h8300 UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
hexagon local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
ia64 UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
m68k UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
microblaze local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
mips UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
nds32 local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
nios2 sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
openrisc sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
parisc UPSTREAM: signal: clear non-uapi flag bits when passing/returning sa_flags 2021-01-22 10:05:52 -08:00
powerpc UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
riscv This is the 5.10.9 stable release 2021-01-19 18:49:54 +01:00
s390 UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
sh Merge 5.10.7 into android12-5.10 2021-01-13 10:29:42 +01:00
sparc UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
um Merge 5.10.5 into android12-5.10 2021-01-10 12:19:03 +01:00
x86 UPSTREAM: signal: clear non-uapi flag bits when passing/returning sa_flags 2021-01-22 10:05:52 -08:00
xtensa UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
.gitignore
Kconfig UPSTREAM: kasan: allow VMAP_STACK for HW_TAGS mode 2021-01-19 21:47:31 -08:00