From owner-svn-src-all@freebsd.org Thu May 11 09:36:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19908D66142; Thu, 11 May 2017 09:36:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF0781FEE; Thu, 11 May 2017 09:36:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4B9apcs051388; Thu, 11 May 2017 09:36:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4B9apD9051387; Thu, 11 May 2017 09:36:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705110936.v4B9apD9051387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 May 2017 09:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r318183 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2017 09:36:53 -0000 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 #include +/* + * 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);