svn commit: r318183 - stable/11/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Thu May 11 09:36:53 UTC 2017
Author: kib
Date: Thu May 11 09:36:51 2017
New Revision: 318183
URL: https://svnweb.freebsd.org/changeset/base/318183
Log:
MFC r317523:
Add asserts to verify stability of struct proc and struct thread layouts.
Modified:
stable/11/sys/kern/kern_thread.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/kern_thread.c
==============================================================================
--- stable/11/sys/kern/kern_thread.c Thu May 11 08:39:55 2017 (r318182)
+++ stable/11/sys/kern/kern_thread.c Thu May 11 09:36:51 2017 (r318183)
@@ -64,6 +64,57 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_domain.h>
#include <sys/eventhandler.h>
+/*
+ * Asserts below verify the stability of struct thread and struct proc
+ * layout, as exposed by KBI to modules. On head, the KBI is allowed
+ * to drift, change to the structures must be accompanied by the
+ * assert update.
+ *
+ * On the stable branches after KBI freeze, conditions must not be
+ * violated. Typically new fields are moved to the end of the
+ * structures.
+ */
+#ifdef __amd64__
+_Static_assert(offsetof(struct thread, td_flags) == 0xe4,
+ "struct thread KBI td_flags");
+_Static_assert(offsetof(struct thread, td_pflags) == 0xec,
+ "struct thread KBI td_pflags");
+_Static_assert(offsetof(struct thread, td_frame) == 0x418,
+ "struct thread KBI td_frame");
+_Static_assert(offsetof(struct thread, td_emuldata) == 0x4c0,
+ "struct thread KBI td_emuldata");
+_Static_assert(offsetof(struct proc, p_flag) == 0xb0,
+ "struct proc KBI p_flag");
+_Static_assert(offsetof(struct proc, p_pid) == 0xbc,
+ "struct proc KBI p_pid");
+_Static_assert(offsetof(struct proc, p_filemon) == 0x3d0,
+ "struct proc KBI p_filemon");
+_Static_assert(offsetof(struct proc, p_comm) == 0x3e0,
+ "struct proc KBI p_comm");
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b0,
+ "struct proc KBI p_emuldata");
+#endif
+#ifdef __i386__
+_Static_assert(offsetof(struct thread, td_flags) == 0x8c,
+ "struct thread KBI td_flags");
+_Static_assert(offsetof(struct thread, td_pflags) == 0x94,
+ "struct thread KBI td_pflags");
+_Static_assert(offsetof(struct thread, td_frame) == 0x2c0,
+ "struct thread KBI td_frame");
+_Static_assert(offsetof(struct thread, td_emuldata) == 0x30c,
+ "struct thread KBI td_emuldata");
+_Static_assert(offsetof(struct proc, p_flag) == 0x68,
+ "struct proc KBI p_flag");
+_Static_assert(offsetof(struct proc, p_pid) == 0x74,
+ "struct proc KBI p_pid");
+_Static_assert(offsetof(struct proc, p_filemon) == 0x278,
+ "struct proc KBI p_filemon");
+_Static_assert(offsetof(struct proc, p_comm) == 0x284,
+ "struct proc KBI p_comm");
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x304,
+ "struct proc KBI p_emuldata");
+#endif
+
SDT_PROVIDER_DECLARE(proc);
SDT_PROBE_DEFINE(proc, , , lwp__exit);
More information about the svn-src-stable-11
mailing list