diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2021-05-04 18:25:22 +0200 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2021-07-23 20:15:31 +0200 |
commit | 50ae81305c7a3ee802f0a1988503ce913c79cd6e (patch) | |
tree | 8564c815a010b129d6af244f1570ad55f763757f /arch/arm64/kernel | |
parent | signal: Remove the generic __ARCH_SI_TRAPNO support (diff) | |
download | linux-50ae81305c7a3ee802f0a1988503ce913c79cd6e.tar.xz linux-50ae81305c7a3ee802f0a1988503ce913c79cd6e.zip |
signal: Verify the alignment and size of siginfo_t
Update the static assertions about siginfo_t to also describe
it's alignment and size.
While investigating if it was possible to add a 64bit field into
siginfo_t[1] it became apparent that the alignment of siginfo_t
is as much a part of the ABI as the size of the structure.
If the alignment changes siginfo_t when embedded in another structure
can move to a different offset. Which is not acceptable from an ABI
structure.
So document that fact and add static assertions to notify developers
if they change change the alignment by accident.
[1] https://lkml.kernel.org/r/YJEZdhe6JGFNYlum@elver.google.com
Acked-by: Marco Elver <elver@google.com>
v1: https://lkml.kernel.org/r/20210505141101.11519-4-ebiederm@xmission.co
Link: https://lkml.kernel.org/r/875yxaxmyl.fsf_-_@disp2133
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r-- | arch/arm64/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/signal32.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 4413b6a4e32a..d3721e01441b 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -1011,6 +1011,8 @@ static_assert(NSIGBUS == 5); static_assert(NSIGTRAP == 6); static_assert(NSIGCHLD == 6); static_assert(NSIGSYS == 2); +static_assert(sizeof(siginfo_t) == 128); +static_assert(__alignof__(siginfo_t) == 8); static_assert(offsetof(siginfo_t, si_signo) == 0x00); static_assert(offsetof(siginfo_t, si_errno) == 0x04); static_assert(offsetof(siginfo_t, si_code) == 0x08); diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index ab1775216712..d3be01c46bec 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -469,6 +469,8 @@ static_assert(NSIGBUS == 5); static_assert(NSIGTRAP == 6); static_assert(NSIGCHLD == 6); static_assert(NSIGSYS == 2); +static_assert(sizeof(compat_siginfo_t) == 128); +static_assert(__alignof__(compat_siginfo_t) == 4); static_assert(offsetof(compat_siginfo_t, si_signo) == 0x00); static_assert(offsetof(compat_siginfo_t, si_errno) == 0x04); static_assert(offsetof(compat_siginfo_t, si_code) == 0x08); |