Received: by 2002:a05:6520:1682:b0:147:d1a0:b502 with SMTP id ck2csp5594845lkb; Mon, 11 Oct 2021 09:37:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn+U2HN4IW4GyGOXMpGMvdFESiXZ0hXOX/rTeq+obB0NmmsrK35EhfpFVo1ByCEjao23ED X-Received: by 2002:a17:90b:1b42:: with SMTP id nv2mr31117966pjb.91.1633970226636; Mon, 11 Oct 2021 09:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633970226; cv=none; d=google.com; s=arc-20160816; b=O7Y+UpiG6QjuUSXimdp70/jYcgG3jy8mcbntLemLnIbDkVV+GXQURIPQf3Gyf47Vqu +mP+5tlglKqVUDaigftjyOOywlGjmhANH0ycytbTqbVHb+UAxu87WILh0/zvuCXF7tl9 isDQh8KTvwSgXjC/jnVn1ZVAMWKe0KXz8RVjahbJXMFBsdsCnqxpRFL+6PmKrJioGo8T Wvs6qytPErQL6kng0gLGK3axTguA8BP5z2MU5JpHc4d+j8bCnbIoBOgo3n1tDJcMyS8N 2Z9ty73qRoyuktCuAX0icxdOkBwSfgU3V7sMC1ahWx62Cwh/wtnNCCsF1ZBMjcgp70wj mZXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=blk21WrD2+wos3hNimL48x0ZKavpzgCEZzggMzCUA4M=; b=eA7Fk+3abJohEaVK6sdxmXAT446LQH1e4ya7z3Uyc+7iI1LirAsb1RGsNj8GG4q5P9 Ta9uQnzEH5itbHZqmHivESaCW02vVsQtTByvnAQqU3lJSXqcenZ0yVndo7r4oqgXbIsV +X7HtuwWwhtnTZgedjkdU1R+/NtW5qn1plaIMRlmZFcZzxbpyz+eJUv6xNxOeHYOvPln RDBgU3gS/9gvOo8GCUOjjxdhgUFP59TqgvLbbiR89rnUlY8nBLutMIaH47YfbwuvPN90 /Pz1CCdSb9sjIDVFGGzbu5/ZYf1P3xyNEwc3agwtqEMiy194nzNJC46UK2eV3wg39KoD SOYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zs4cqHYq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l62si12558046pge.621.2021.10.11.09.36.52; Mon, 11 Oct 2021 09:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zs4cqHYq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237598AbhJKOON (ORCPT + 99 others); Mon, 11 Oct 2021 10:14:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:33640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243411AbhJKOLV (ORCPT ); Mon, 11 Oct 2021 10:11:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7578E61105; Mon, 11 Oct 2021 14:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633960985; bh=DhbK6jwRhGcJoNCZCiAJuMgy8jFuWH9LvcIvAtDFR3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zs4cqHYqDm5QpieCCslfA5ZzLMfk/QTYKf2sLHDTwxtrvW7R4yamzk6cUdMJP2VDq ZZ54BglgHQrfX2YFIzDtTmE2awvdyGZN3SbsWxVarXMe0n1isz5KKSo2q3ncKIiUAB GiiRgl+K4XcOHM605o+Fm45Rl+es/j7kYy4H/wTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Lawrence , Miroslav Benes , Josh Poimboeuf , Andy Lavr , Peter Zijlstra , x86@kernel.org, Sasha Levin Subject: [PATCH 5.14 132/151] objtool: Make .altinstructions section entry size consistent Date: Mon, 11 Oct 2021 15:46:44 +0200 Message-Id: <20211011134522.069620035@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011134517.833565002@linuxfoundation.org> References: <20211011134517.833565002@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Lawrence [ Upstream commit dc02368164bd0ec603e3f5b3dd8252744a667b8a ] Commit e31694e0a7a7 ("objtool: Don't make .altinstructions writable") aligned objtool-created and kernel-created .altinstructions section flags, but there remains a minor discrepency in their use of a section entry size: objtool sets one while the kernel build does not. While sh_entsize of sizeof(struct alt_instr) seems intuitive, this small deviation can cause failures with external tooling (kpatch-build). Fix this by creating new .altinstructions sections with sh_entsize of 0 and then later updating sec->sh_size as alternatives are added to the section. An added benefit is avoiding the data descriptor and buffer created by elf_create_section(), but previously unused by elf_add_alternative(). Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls") Signed-off-by: Joe Lawrence Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20210822225037.54620-2-joe.lawrence@redhat.com Cc: Andy Lavr Cc: Peter Zijlstra Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin --- tools/objtool/arch/x86/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index bc821056aba9..0893436cc09f 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf, sec = find_section_by_name(elf, ".altinstructions"); if (!sec) { sec = elf_create_section(elf, ".altinstructions", - SHF_ALLOC, size, 0); + SHF_ALLOC, 0, 0); if (!sec) { WARN_ELF("elf_create_section"); -- 2.33.0