From patchwork Mon Feb 27 18:49:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 9593777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D968D604AB for ; Mon, 27 Feb 2017 18:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCFBE283F1 for ; Mon, 27 Feb 2017 18:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1394284C9; Mon, 27 Feb 2017 18:51:03 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 D67AC283F1 for ; Mon, 27 Feb 2017 18:51:02 +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: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:In-Reply-To: References:List-Owner; bh=xYIaMmkhTfOPxrHhf55O+Yn1a/j/P/2/lckuiDfiw0U=; b=WMz 0rrJZxsRN7Xa52F09L25wuzEwyGBCCYj0BfZn5FhHJheTEzoq+y0RNzpGGc3nw/nAcKzt0ppx69jS 3cdbZVDvaIvjGKbW3nHV+Sif613iPk6CqXhvGoYcCrm1TFdSrTs9PQxOSWhYYhS7pR2p0Vi7msP/R EJxRSGcuN9Ao36IhEto/0LX0YmlA70uSbM0cKFFbn1GiPF15qYSt+DNIsKlQDUdpgQwTKZgWrzMNR vKqQuA3Hk9v8J7fIq7sljXZKFthakFZkVY4YfyBhTA/AGg+HJ5bzHgcGFWWxtsRBHL0Q0jm8Kn+75 LhOX0xni2ndOTALmhHQGOsGDLsaUaWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciQNy-0007dA-GP; Mon, 27 Feb 2017 18:51:02 +0000 Received: from prod-mail-xrelay08.akamai.com ([96.6.114.112]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciQNt-0007cI-Ep for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 18:51:00 +0000 Received: from prod-mail-xrelay08.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id F125D200037; Mon, 27 Feb 2017 18:50:32 +0000 (GMT) Received: from prod-mail-relay08.akamai.com (prod-mail-relay08.akamai.com [172.27.22.71]) by prod-mail-xrelay08.akamai.com (Postfix) with ESMTP id D9FBF200014; Mon, 27 Feb 2017 18:50:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; s=a1; t=1488221432; bh=DQ/fXPYoLsDiJALqPNXZRvJC1vmX613KApgSFqaOFhI=; l=4622; h=From:To:Cc:Date:From; b=nsJURsEn8iGrj/u0xIWNb9iOUn0PbLrIWPE0U/zQoUCysTzLNqxlged9Bc0TS54sj nUty/4XcdwqFuqvBZjrhy2bt144UvH6oBzwhoPiHBNOkfeEKar2UDvfCwsuTDd247f ME83EHL/aXtS+FcGV4AyR38nun7M4obgY/GcvEKU= Received: from bos-lpjec.kendall.corp.akamai.com (bos-lpjec.kendall.corp.akamai.com [172.28.13.148]) by prod-mail-relay08.akamai.com (Postfix) with ESMTP id F27879808E; Mon, 27 Feb 2017 18:50:31 +0000 (GMT) From: Jason Baron To: rostedt@goodmis.org Subject: [PATCH] jump_label: align jump_entry table to at least 4-bytes Date: Mon, 27 Feb 2017 13:49:24 -0500 Message-Id: <1488221364-13905-1-git-send-email-jbaron@akamai.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_105057_755432_1D4535DE X-CRM114-Status: GOOD ( 10.56 ) 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: linux-mips@linux-mips.org, Chris Metcalf , Benjamin Herrenschmidt , linux-kernel@vger.kernel.org, Ralf Baechle , Russell King , Rabin Vincent , David Daney , Paul Mackerras , Anton Blanchard , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Zhigang Lu 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 core jump_label code makes use of the 2 lower bits of the static_key::[type|entries|next] field. Thus, ensure that the jump_entry table is at least 4-byte aligned. Reported-and-tested-by: Sachin Sant Cc: Steven Rostedt Cc: Ingo Molnar Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Anton Blanchard Cc: Rabin Vincent Cc: Russell King Cc: Ralf Baechle Cc: Chris Metcalf Cc: Zhigang Lu Cc: David Daney Signed-off-by: Jason Baron --- arch/arm/include/asm/jump_label.h | 2 ++ arch/mips/include/asm/jump_label.h | 2 ++ arch/powerpc/include/asm/jump_label.h | 3 +++ arch/tile/include/asm/jump_label.h | 2 ++ 4 files changed, 9 insertions(+) diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h index 34f7b6980d21..9c017bb04d1c 100644 --- a/arch/arm/include/asm/jump_label.h +++ b/arch/arm/include/asm/jump_label.h @@ -13,6 +13,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran asm_volatile_goto("1:\n\t" WASM(nop) "\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" ".word 1b, %l[l_yes], %c0\n\t" ".popsection\n\t" : : "i" (&((char *)key)[branch]) : : l_yes); @@ -27,6 +28,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool asm_volatile_goto("1:\n\t" WASM(b) " %l[l_yes]\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" ".word 1b, %l[l_yes], %c0\n\t" ".popsection\n\t" : : "i" (&((char *)key)[branch]) : : l_yes); diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h index e77672539e8e..243791f3ae71 100644 --- a/arch/mips/include/asm/jump_label.h +++ b/arch/mips/include/asm/jump_label.h @@ -31,6 +31,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran asm_volatile_goto("1:\t" NOP_INSN "\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t" ".popsection\n\t" : : "i" (&((char *)key)[branch]) : : l_yes); @@ -45,6 +46,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool asm_volatile_goto("1:\tj %l[l_yes]\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t" ".popsection\n\t" : : "i" (&((char *)key)[branch]) : : l_yes); diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h index 9a287e0ac8b1..bfe83496b590 100644 --- a/arch/powerpc/include/asm/jump_label.h +++ b/arch/powerpc/include/asm/jump_label.h @@ -24,6 +24,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran asm_volatile_goto("1:\n\t" "nop # arch_static_branch\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" ".popsection \n\t" : : "i" (&((char *)key)[branch]) : : l_yes); @@ -38,6 +39,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool asm_volatile_goto("1:\n\t" "b %l[l_yes] # arch_static_branch_jump\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" ".popsection \n\t" : : "i" (&((char *)key)[branch]) : : l_yes); @@ -63,6 +65,7 @@ struct jump_entry { #define ARCH_STATIC_BRANCH(LABEL, KEY) \ 1098: nop; \ .pushsection __jump_table, "aw"; \ + .balign 4; \ FTR_ENTRY_LONG 1098b, LABEL, KEY; \ .popsection #endif diff --git a/arch/tile/include/asm/jump_label.h b/arch/tile/include/asm/jump_label.h index cde7573f397b..a964e6135ea3 100644 --- a/arch/tile/include/asm/jump_label.h +++ b/arch/tile/include/asm/jump_label.h @@ -25,6 +25,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, asm_volatile_goto("1:\n\t" "nop" "\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" ".quad 1b, %l[l_yes], %0 + %1 \n\t" ".popsection\n\t" : : "i" (key), "i" (branch) : : l_yes); @@ -39,6 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, asm_volatile_goto("1:\n\t" "j %l[l_yes]" "\n\t" ".pushsection __jump_table, \"aw\"\n\t" + ".balign 4\n\t" ".quad 1b, %l[l_yes], %0 + %1 \n\t" ".popsection\n\t" : : "i" (key), "i" (branch) : : l_yes);