Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1369862imi; Sat, 23 Jul 2022 03:57:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uvZ9QKwlMrCvb+RXy2TEpby6plKFr9YExgXNnRTgpd8zBnXh3kBO5UBy2dYJEzCufnZzNn X-Received: by 2002:a17:902:a586:b0:16c:3182:a9b with SMTP id az6-20020a170902a58600b0016c31820a9bmr3713911plb.44.1658573825340; Sat, 23 Jul 2022 03:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658573825; cv=none; d=google.com; s=arc-20160816; b=sLOgtocE6rasoD+IrvDKls3IJtcNh4Y5EMimfCaGLeVRm2naXi7bmgXqXiqhug1au5 nETYPMEjYOXPh0NrVSBbKl9UHjPtjedIL40qEu8tDa/gBUCL93wIe1SKQVhkVQflG9OB 7eMzJxFdUo7kGJfHqZyPRuIK3GraWYXWu3mIh/gBDxJn0gk7lb+JvXhGEObMnu8oe5Ps vdtAZpa0opO4wwOf2Fxu2grNyJeRnuVliZm/tz4TpIJ/+wy6wPvc5QhkCPybOq/pTOU/ hzbwv5v4trAtOZTYnpqU74t0j9bmu6CA1uKV/szKoGkSAflVrNk6TQUJFWalxipmEuSK 3dBA== 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=Mi8rQ5grVsv5ZNH8s/uecbFMgL9KJbFbG9k6Thwi+CQ=; b=plSrxzVtuj52Ndi7hQNblHi9gxucEMt9l8JLQ5ARdz8ndFs4WaraX9xYC780GKDSU0 +6KgQ3abBRYCvwO39piPd+63MVTqoPDTWN1ZCdQQp1jwVIzOYISvUrlk8ThTEtqX3TH6 dBo9vzQm2mBGnxfq2o4MmgzyqJ3LmdVLSq15WV7LCIQA2G5I8e1PNvzh3GFG5gBJm0YT XIpY9CbyjfFiNDlOxuahWeeHySMlcr8FacHSINRhlDVcKi5pneHD4nDFBZay1kiXGwMY p6puwc5nPqLDXU7Ob3Jw1zw5qTs+J/SR3jTcpGlbitT1mEnG/YYeFBFJbLNgykShsLQ+ fbhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tf/6n7Yu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a631d03000000b003fae0c67055si8332465pgd.777.2022.07.23.03.56.51; Sat, 23 Jul 2022 03:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tf/6n7Yu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S237992AbiGWKBk (ORCPT + 99 others); Sat, 23 Jul 2022 06:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237914AbiGWKAh (ORCPT ); Sat, 23 Jul 2022 06:00:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E0693E760; Sat, 23 Jul 2022 02:58:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B3C7611BF; Sat, 23 Jul 2022 09:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43D87C341C0; Sat, 23 Jul 2022 09:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658570306; bh=Cc2FMcbo41U7/t4HCIrRJ9iCyx8ihS/uOqE18E+9374=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tf/6n7YuvNVqLV+XK3KH/ubMnw0U3JFyVLrIlLwfv4JZg05WORjeDd37nZ4Sv+vYN 7/PHQjqVbVtfDgyDf7+5tkPm3Y/HLLNJCw5dZS1uzaVhmYmMEBvtBc9s4dYckv+lge 07ugfkBTJFehBVNfoCeACXIAX4SQsq0cmfRX2338= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Lawrence , Josh Poimboeuf , Ingo Molnar , Ben Hutchings Subject: [PATCH 5.10 040/148] objtool: Dont make .altinstructions writable Date: Sat, 23 Jul 2022 11:54:12 +0200 Message-Id: <20220723095235.534043721@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220723095224.302504400@linuxfoundation.org> References: <20220723095224.302504400@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf commit e31694e0a7a709293319475d8001e05e31f2178c upstream. When objtool creates the .altinstructions section, it sets the SHF_WRITE flag to make the section writable -- unless the section had already been previously created by the kernel. The mismatch between kernel-created and objtool-created section flags can cause failures with external tooling (kpatch-build). And the section doesn't need to be writable anyway. Make the section flags consistent with the kernel's. Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls") Reported-by: Joe Lawrence Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.com Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- tools/objtool/arch/x86/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -611,7 +611,7 @@ static int elf_add_alternative(struct el sec = find_section_by_name(elf, ".altinstructions"); if (!sec) { sec = elf_create_section(elf, ".altinstructions", - SHF_WRITE, size, 0); + SHF_ALLOC, size, 0); if (!sec) { WARN_ELF("elf_create_section");