Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4730218imw; Tue, 12 Jul 2022 13:10:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toCL3XPLtTS/Uc26Us0Rs6eKQ5Ds+Um6YCNA/Jq4LmF3syWjSEwo7SEGl8ahcoxuHnqfoQ X-Received: by 2002:a65:6bc4:0:b0:3c2:2f7c:cc74 with SMTP id e4-20020a656bc4000000b003c22f7ccc74mr21926342pgw.307.1657656612858; Tue, 12 Jul 2022 13:10:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657656612; cv=none; d=google.com; s=arc-20160816; b=RycNtCg5FjY7Z0rR2KQCDa+yFEPP3DKOX7jnrOUF2uolQnCyliLiryizMA9EaNb+np UrHlxcrc6qVywGLOtMBg81Nb2E3Tj+J/fo7xDSEZbBbv7bf2iENVsx8dSZOdiNp7xyOO GwIswOkcT4Iveyb4QlCfqNM8Y2fzZzDvtCt5Ry7OisdwuITq93Vo2FFrr+HMYy+kL1n8 IYMmIwBQJ3Rd39qx0Dbv1plyTfi4QSPyKmuUv88SceD2bi8llL5nV8d/B2wf2OoLG/N9 Bg2jjiFw7oNWMtqziykMukRBJcWmTmog0qBvOu68JlgprgXhQkLMP9Bf9cAHVHOZNHSp pDbA== 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=DbXAb29CuH1FoFkkj9KM6wtx2K9saFedRDmKxqj7WMI=; b=r2Vn8OmrtYJX9CMjZMlZsPq9FI/hhOWOXYOZ4SxvaM4QEvbF6p2Rii1eTvi58xE0ab WuBh6kHMbXvJzIN9A1Qi1sP//gfTTxmtGAN7uJ9vvrPqWNcJC32ghVgANE2Xa2FzvqFu HrlDvH0arAbZPVRNO0nRRBtB+jj6dOSk5dpt7O03gsB6R4TTj/zlxz9Srn86gBokh2Tb oom5CLDLjRlxAir/n/CzE38yWOggnEJghq0F+hd/etjyVAcylVwSQ9ggV5XW9H43YEAr r7wiLYUjalx51+zNyiNHHGsTIITUU8+rgcHjINJ+MsJE/28rMZ1FeE83FcKmVgLsq/XG 5pTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MoQM4Sdm; 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 t13-20020a170902e84d00b00168abe39847si5926502plg.43.2022.07.12.13.09.50; Tue, 12 Jul 2022 13:10:12 -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=MoQM4Sdm; 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 S235006AbiGLS77 (ORCPT + 99 others); Tue, 12 Jul 2022 14:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbiGLS6j (ORCPT ); Tue, 12 Jul 2022 14:58:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2E4DD23E; Tue, 12 Jul 2022 11:47:47 -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 855406090C; Tue, 12 Jul 2022 18:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 929E5C341C0; Tue, 12 Jul 2022 18:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657651666; bh=20+x+E4fn2Zd1ZHDJTs7z8JQMSMIXBb4N5Np79R9lsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoQM4SdmFFVJr2Wg+lzlHWKE7Ww1S7cHk4aBagMhnJlNHatWj/AEaKMCsZXB3S87x omnpC7fQoB50SkVcNEe2L1P0O4q/QMGP9JeQmKTZsFzYG1R9+wg7tWpPyPdZUxyNiE UPX88p2i7tWq4gmp6nFEKT+Y3TxoRGwa/EosDrf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Josh Poimboeuf , Alexei Starovoitov , Thadeu Lima de Souza Cascardo Subject: [PATCH 5.15 18/78] x86/alternative: Add debug prints to apply_retpolines() Date: Tue, 12 Jul 2022 20:38:48 +0200 Message-Id: <20220712183239.588567381@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183238.844813653@linuxfoundation.org> References: <20220712183238.844813653@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.7 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,T_SCC_BODY_TEXT_LINE 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: Peter Zijlstra commit d4b5a5c993009ffeb5febe3b701da3faab6adb96 upstream. Make sure we can see the text changes when booting with 'debug-alternative'. Example output: [ ] SMP alternatives: retpoline at: __traceiter_initcall_level+0x1f/0x30 (ffffffff8100066f) len: 5 to: __x86_indirect_thunk_rax+0x0/0x20 [ ] SMP alternatives: ffffffff82603e58: [2:5) optimized NOPs: ff d0 0f 1f 00 [ ] SMP alternatives: ffffffff8100066f: orig: e8 cc 30 00 01 [ ] SMP alternatives: ffffffff8100066f: repl: ff d0 0f 1f 00 Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Borislav Petkov Acked-by: Josh Poimboeuf Tested-by: Alexei Starovoitov Link: https://lore.kernel.org/r/20211026120310.422273830@infradead.org Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/alternative.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -492,9 +492,15 @@ void __init_or_module noinline apply_ret continue; } + DPRINTK("retpoline at: %pS (%px) len: %d to: %pS", + addr, addr, insn.length, + addr + insn.length + insn.immediate.value); + len = patch_retpoline(addr, &insn, bytes); if (len == insn.length) { optimize_nops(bytes, len); + DUMP_BYTES(((u8*)addr), len, "%px: orig: ", addr); + DUMP_BYTES(((u8*)bytes), len, "%px: repl: ", addr); text_poke_early(addr, bytes, len); } }