From patchwork Wed Sep 26 13:56:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 10616037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D63C415E8 for ; Wed, 26 Sep 2018 14:01:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D08C52B0C5 for ; Wed, 26 Sep 2018 14:01:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE3F52B0BC; Wed, 26 Sep 2018 14:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 055942B0C0 for ; Wed, 26 Sep 2018 14:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=t4xceN1NhKsElvfp4M8UzpioCLgvtDbcqgLAcfLNoxQ=; b=WEwc8AjEezBAUrtYaH/tQG6Q3C UUje1lIMo4Tlk6wuTiAcI/HAHgMQ4xNLKmSTXrXywFGgCEhYT2sl0EAwu2xh7v34vH3sxP5FeXsEx 5KgMgMnySikT2d/FKzHIJGBIl9Yo7vxs+oH+rnb/ulWbc9ydWJLMjaTFk7jw9UJgeEvQVmz/OhxPB anqQAf7j4ZKmj1b8hM+hWnjE3hlAvllwqu9zTPAeUroVtTQDLlK+901zLYc5Mbxiv6XTCa8cy7xgc GuKDZtAKW3HWpBz025UIxkBNvxyYLeVkFgZLV+/z7Ca5anEcg6OW3FW1wLCITAIX8R4C4VMbbqtvu 6j04MxVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5AN5-0001R7-SM; Wed, 26 Sep 2018 14:00:56 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5AJM-00076U-K3 for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:57:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E27315AD; Wed, 26 Sep 2018 06:56:32 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B25813F5B3; Wed, 26 Sep 2018 06:56:30 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/7] arm64: Add static check for pt_regs alignment Date: Wed, 26 Sep 2018 14:56:18 +0100 Message-Id: <1537970184-44348-2-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1537970184-44348-1-git-send-email-julien.thierry@arm.com> References: <1537970184-44348-1-git-send-email-julien.thierry@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_065704_712098_2D9CA2BD X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Thierry , marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, christoffer.dall@arm.com, james.morse@arm.com, Dave.Martin@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Ard Biesheuvel --- 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)); + offset >>= 3; switch (offset) { case 0 ... 30: