Define a sa_flags bit, SA_UNSUPPORTED, which will never be supported in the uapi. The purpose of this flag bit is to allow userspace to distinguish an old kernel that does not clear unknown sa_flags bits from a kernel that supports every flag bit. In other words, if userspace does something like: act.sa_flags |= SA_UNSUPPORTED; sigaction(SIGSEGV, &act, 0); sigaction(SIGSEGV, 0, &oldact); and finds that SA_UNSUPPORTED remains set in oldact.sa_flags, it means that the kernel cannot be trusted to have cleared unknown flag bits from sa_flags, so no assumptions about flag bit support can be made.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -14,6 +14,12 @@ · 13 unmodified lines | ||
| 14 | 14 | * SA_RESTART flag to get restarting signals (which were the default long ago) |
| 15 | 15 | * SA_NODEFER prevents the current signal from being masked in the handler. |
| 16 | 16 | * SA_RESETHAND clears the handler when the signal is delivered. |
| 17 | + * SA_UNSUPPORTED is a flag bit that will never be supported. Kernels from | |
| 18 | + * before the introduction of SA_UNSUPPORTED did not clear unknown bits from | |
| 19 | + * sa_flags when read using the oldact argument to sigaction and rt_sigaction, | |
| 20 | + * so this bit allows flag bit support to be detected from userspace while | |
| 21 | + * allowing an old kernel to be distinguished from a kernel that supports every | |
| 22 | + * flag bit. | |
| 17 | 23 | * |
| 18 | 24 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single |
| 19 | 25 | * Unix names RESETHAND and NODEFER respectively. |
| @@ -34,6 +40,7 @@ · 14 unmodified lines | ||
| 34 | 40 | /* 0x00000080 used on parisc */ |
| 35 | 41 | /* 0x00000100 used on sparc */ |
| 36 | 42 | /* 0x00000200 used on sparc */ |
| 43 | +#define SA_UNSUPPORTED 0x00000400 | |
| 37 | 44 | /* 0x00010000 used on mips */ |
| 38 | 45 | /* 0x01000000 used on x86 */ |
| 39 | 46 | /* 0x02000000 used on x86 */ |