From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2CBEC433B4 for ; Wed, 12 May 2021 20:13:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4498613FB for ; Wed, 12 May 2021 20:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384729AbhELUCN (ORCPT ); Wed, 12 May 2021 16:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357083AbhELShy (ORCPT ); Wed, 12 May 2021 14:37:54 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D61C061239; Wed, 12 May 2021 11:32:33 -0700 (PDT) Date: Wed, 12 May 2021 18:32:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620844351; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuZ52jdPatIbvnFuE0KauhphGZeSHfIiCbzAT4VZhjE=; b=x5Zf6aIE8iyxwSftVm70auKJY26mhjI/DGuZhWhaz4TOaYbhwHWootACL5aoKppgB6P57y 55x66l9tRPYNI9KV/Fk0sKrEonuLyV85etfuWuwA0hkIdVEAqa73r643WUGAy0xtRiJArh dFuD9TgkA+19n9pNNWdqdD10lzRk2SOmakA5CxRios7T3eY61homkcQdCccnNRrfvY+ndd 0qRpw5EycdbOmggrrtb2+6pFAztWcO0ZjHRp24re1x1B20sAtcsML6PprE9ND3ZDACnP1J EF2tPdkpez/u3NxYAIHpT9xfRyuOa2bas/jHT2B+oIyGIlVTDCyMCQ9aPva+eQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620844351; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AuZ52jdPatIbvnFuE0KauhphGZeSHfIiCbzAT4VZhjE=; b=G1RE2eUJvQPVIJWPwLNDtmDyfQQQTBBdWREQelBYmcBX4mWrUqDs/QDb532HWlp4yAEPXi OjlMvvRQJpER8RDQ== From: "tip-bot2 for Vasily Gorbik" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/urgent] objtool/x86: Fix elf_add_alternative() endianness Cc: Vasily Gorbik , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3Cpatch-2=2Ethread-6c9df9=2Egit-6c9df9a8098d=2Eyou?= =?utf-8?q?r-ad-here=2Ecall-01620841104-ext-2554=40work=2Ehours=3E?= References: =?utf-8?q?=3Cpatch-2=2Ethread-6c9df9=2Egit-6c9df9a8098d=2Eyour?= =?utf-8?q?-ad-here=2Ecall-01620841104-ext-2554=40work=2Ehours=3E?= MIME-Version: 1.0 Message-ID: <162084435091.29796.15613736364949786764.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the objtool/urgent branch of tip: Commit-ID: e63db0917117b26e0217dde51a9df238d3ed63d2 Gitweb: https://git.kernel.org/tip/e63db0917117b26e0217dde51a9df238d3ed63d2 Author: Vasily Gorbik AuthorDate: Wed, 12 May 2021 19:42:13 +02:00 Committer: Ingo Molnar CommitterDate: Wed, 12 May 2021 20:25:48 +02:00 objtool/x86: Fix elf_add_alternative() endianness Currently x86 kernel cross-compiled on big endian system fails at boot with: kernel BUG at arch/x86/kernel/alternative.c:258! Corresponding bug condition look like the following: BUG_ON(feature >= (NCAPINTS + NBUGINTS) * 32); Fix that by converting alternative feature/cpuid to target endianness. Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls") Signed-off-by: Vasily Gorbik Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/patch-2.thread-6c9df9.git-6c9df9a8098d.your-ad-here.call-01620841104-ext-2554@work.hours --- tools/objtool/arch/x86/decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index cedf3ed..24295d3 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static int is_x86_64(const struct elf *elf) @@ -725,7 +726,7 @@ static int elf_add_alternative(struct elf *elf, return -1; } - alt->cpuid = cpuid; + alt->cpuid = bswap_if_needed(cpuid); alt->instrlen = orig_len; alt->replacementlen = repl_len;