From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Wed, 7 Nov 2018 21:58:35 +0000 Subject: [PATCH 1/7] arm64: Add static check for pt_regs alignment In-Reply-To: <1537970184-44348-2-git-send-email-julien.thierry@arm.com> References: <1537970184-44348-1-git-send-email-julien.thierry@arm.com> <1537970184-44348-2-git-send-email-julien.thierry@arm.com> Message-ID: <20181107215834.GB12248@brain-police> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Sep 26, 2018 at 02:56:18PM +0100, Julien Thierry wrote: > The pt_regs structure's size is required to be a multiple of 16 to maintain > the stack alignment upon kernel entries. > > Add a static check to ensure this is the case. > > Signed-off-by: Julien Thierry > --- > arch/arm64/include/asm/ptrace.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h > index 177b851..cc17fad 100644 > --- a/arch/arm64/include/asm/ptrace.h > +++ b/arch/arm64/include/asm/ptrace.h > @@ -229,6 +229,8 @@ static inline u64 regs_get_register(struct pt_regs *regs, unsigned int offset) > > WARN_ON(offset & 7); > > + BUILD_BUG_ON((sizeof (struct pt_regs) % 16 != 0)); This seems like a fairly random place to put this, and given that it's not dependent on context I reckon it would be better to put it in a C file rather than in a header that gets included multiple times. I still couldn't really find a good place though :/ Will