Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Feb 2022 21:33:57 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3988ca5aabb2 - main - aarch64: Add static asssert for context size
Message-ID:  <202202102133.21ALXvKo083690@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=3988ca5aabb21deaeac1fdd6f3520dce2f1e1975

commit 3988ca5aabb21deaeac1fdd6f3520dce2f1e1975
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-02-10 21:26:26 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-10 21:32:20 +0000

    aarch64: Add static asssert for context size
    
    Add a static assert for the siginfo{,32}_t, mcontext{,32}_t and
    ucontext{,32}_t sizes. These are de-facto ABI options and cannot change
    size ever.
    
    Reviewed by:            kib, andrew, jhb
    Differential Revision:  https://reviews.freebsd.org/D32958
---
 sys/arm64/arm64/exec_machdep.c      | 4 ++++
 sys/arm64/arm64/freebsd32_machdep.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c
index d29ddabd23bf..b60909c95945 100644
--- a/sys/arm64/arm64/exec_machdep.c
+++ b/sys/arm64/arm64/exec_machdep.c
@@ -60,6 +60,10 @@ __FBSDID("$FreeBSD$");
 #include <machine/vfp.h>
 #endif
 
+_Static_assert(sizeof(mcontext_t) == 880, "mcontext_t size incorrect");
+_Static_assert(sizeof(ucontext_t) == 960, "ucontext_t size incorrect");
+_Static_assert(sizeof(siginfo_t) == 80, "siginfo_t size incorrect");
+
 static void get_fpcontext(struct thread *td, mcontext_t *mcp);
 static void set_fpcontext(struct thread *td, mcontext_t *mcp);
 
diff --git a/sys/arm64/arm64/freebsd32_machdep.c b/sys/arm64/arm64/freebsd32_machdep.c
index c43d8f4ad8e6..98f0bf784326 100644
--- a/sys/arm64/arm64/freebsd32_machdep.c
+++ b/sys/arm64/arm64/freebsd32_machdep.c
@@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$");
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
 
+_Static_assert(sizeof(mcontext32_t) == 208, "mcontext32_t size incorrect");
+_Static_assert(sizeof(ucontext32_t) == 260, "ucontext32_t size incorrect");
+_Static_assert(sizeof(struct siginfo32) == 64, "struct siginfo32 size incorrect");
+
 extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202102133.21ALXvKo083690>