From nobody Thu Oct 2 00:45:58 2025 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B44EACA6F for ; Wed, 24 Sep 2025 13:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721653; cv=none; b=d5pv2k0+XrQ3SIvOhvOhrie15gtYIgVkxHdAmiwDIWdZicSTgUrv9Y8RiMqttVUkR8fvJSJCCY1H3aemd1tC/saaCT018uCQUcTpJ/jvzmzW0CRdSMv8kPGa6+mTMFGeMsSl3z346LV/QMUQFPA7ys23/9q6kSr4YojKWu3RzuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721653; c=relaxed/simple; bh=OBfMOW22D98davzTH45xo1zVpW2eTbrHV63JoKZq7lE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=P+1luJvug7ufGC0JQRRR5K5L4UCVdMpQZh4PZ+pc3D9lZe3ffgj0FzjxkVQfsw4Uek8OpFyca8bEUpG4otfXHfco9eJDLEDgKIfJsciJMpHRzakAK5bbFTpqWzqaW/kJ+xYoQolgsx5aWyeEZe4+2e67LLyUMADRxerpgOXntr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=PTvjL6Th; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PTvjL6Th" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=M6Mu1EgZSYpGGeuwl+54OvBXl6dGSzkTbe6klqtPCT4=; b=PTvjL6Th1k+WraWEz4sdwoJB+j O0Z/2kkzGbYui49Blsmhhbh3WumT9lLyaPx0b3SIezybrdm8JL+wdiJySKr53kRHpwBNxIVFmjHjG evaMPRwJb3/AzflfB46ic1Nf6brvcy/1f/UzhxYQLiWA2d9v2GbfsyXwJpDR766cKZTVX3xPdnN49 p61JXRE2UUrdFhFjcASfkZpMpjjc+zZXwrx8kbDUdohtAfPI/xCv8mS3/TvglRhq5P5rzriE5o24H IIiQlyfTplNLM10rgOnFQXzESULdaJy/gE2Jp7l2eqczCv76LKfBc76GSopTo7b+OyK/9PEylAjcX Eze68QtA==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1v1PqD-0000000GLzD-0S6M; Wed, 24 Sep 2025 13:47:29 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id 01B8530043D; Wed, 24 Sep 2025 15:47:28 +0200 (CEST) Message-ID: <20250924134643.907226869@infradead.org> User-Agent: quilt/0.68 Date: Wed, 24 Sep 2025 15:45:08 +0200 From: Peter Zijlstra To: jpoimboe@kernel.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, alexandre.chartre@oracle.com Subject: [PATCH 1/3] objtool/x86: Remove 0xea hack References: <20250924134507.288529132@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Was properly fixed in the decoder with commit 4b626015e1bf ("x86/insn: Stop decoding i64 instructions in x86-64 mode at opcode") Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/arch/x86/decode.c | 9 --------- 1 file changed, 9 deletions(-) --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -189,15 +189,6 @@ int arch_decode_instruction(struct objto op2 =3D ins.opcode.bytes[1]; op3 =3D ins.opcode.bytes[2]; =20 - /* - * XXX hack, decoder is buggered and thinks 0xea is 7 bytes long. - */ - if (op1 =3D=3D 0xea) { - insn->len =3D 1; - insn->type =3D INSN_BUG; - return 0; - } - if (ins.rex_prefix.nbytes) { rex =3D ins.rex_prefix.bytes[0]; rex_w =3D X86_REX_W(rex) >> 3; From nobody Thu Oct 2 00:45:58 2025 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B46453002CF for ; Wed, 24 Sep 2025 13:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721653; cv=none; b=bVpM/1wWlABuFhps0J7MrvMP5prIlblhsOxdb5EBx4baj5b3rzkrYpBeqiUYN+6pr7RlEhalIzjYE7BJY9wPoNlqIrn3phE9xgi2vQxrSsIfePresddP6ZSH52cTR6Mas2v1nRQUKETEoXuHCu7uXFVwe7nXU9Oz0aLu699fsk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721653; c=relaxed/simple; bh=heasNeHH0aWYUhHAL48nCMzJ3G3G+c7phH/t2HC5htE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=LGTsLQ/xu/pGYyfbuAc1YlAG470eB49jqHJcB3oBukv7vbvrceXgsNJISdKPQlQ5JQDKJlvXyM7xG8+8sJS3hrqDW92uTWcFDXDW38IzlQyJBRSl1IMpnRjzvoFDnnhNgx3YTbMlmOiub/CWxL7nutqZQlz42g4X5gsvvpnSHTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=fl6rh/Ys; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fl6rh/Ys" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=r0SX4y0lRHKH3+P4hS9KFsvpxs6hjsZz/jLPnhf+0YU=; b=fl6rh/Ys9SKVZ7Zd2z+roHS+Vk pMW87ZOtVJFspZMd33wLmVyu7IemCfKCTSsns3QIAoYLf5s9NhPc8DJzaEtbjM5NI7VITaPgbxSRB tCrsMv5U4L6FH3QbaTRU75iZeCbQ0KGdmndHB03oSsBX1lalZxK854hdHLtusb1ReQZRfK3miz1RV TpHMMWlLXBLWQHcl9hwgqed86L+8kt00pS2AMLfu60okyYClqLhKZy9aTIR66q8wOshqFLU1FKspD 1WC2lhF5cy8VypQC4Tb9QHz/zdruk0iplOY2F9IYoQw3bYb35PxgC1+DBtVR9Z41Ous0OT0Zsixn6 7z2Tc/cQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1v1PqD-0000000GLzC-0S6H; Wed, 24 Sep 2025 13:47:29 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id 0633030050D; Wed, 24 Sep 2025 15:47:28 +0200 (CEST) Message-ID: <20250924134644.027686159@infradead.org> User-Agent: quilt/0.68 Date: Wed, 24 Sep 2025 15:45:09 +0200 From: Peter Zijlstra To: jpoimboe@kernel.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, alexandre.chartre@oracle.com Subject: [PATCH 2/3] objtool/x86: Add UDB support References: <20250924134507.288529132@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Per commit 85a2d4a890dc ("x86,ibt: Use UDB instead of 0xEA"), make sure objtool also recognises UDB as a #UD instruction. Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/arch/x86/decode.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -683,6 +683,10 @@ int arch_decode_instruction(struct objto insn->type =3D INSN_SYSRET; break; =20 + case 0xd6: /* udb */ + insn->type =3D INSN_BUG; + break; + case 0xe0: /* loopne */ case 0xe1: /* loope */ case 0xe2: /* loop */ From nobody Thu Oct 2 00:45:58 2025 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 611B13054E8 for ; Wed, 24 Sep 2025 13:47:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721655; cv=none; b=cjdOvoXOIKkvYRZgrZcW8Bu5uJDZ+2ILGuKiKSfdpWo7mm8KYW+oM1fnWKZlBxhz0NWjvMX2JONHBkopoLHKQEGei/YRVPtISbEJCrhKRoEY7OCG8QUjLsnWCcr3ofoty1zO9WrOQMkPO64tHLnwUVRaTH5XaJl9B2nbnhZlUNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758721655; c=relaxed/simple; bh=g3mVbQEmSZSox+3rar4GDne8V7SWg8EuyYhYo65mxMU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=hRjNoi76cLG88t1FfquatSTmW0vrJPU3/iPjr5/PuDvxRa/+IPmJQU0CAG756egt3dpAjgH6PmnJGcaf5sDaXTxhkjzcIKbYZkNv/d37e5AVFsoPuNSxqmsT7u6yJOjitk2KGlXy0gsPcXUBe5Lt3BiIYLPuTsSmPOzUtkiW32c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HPfYkXLA; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HPfYkXLA" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=/kke/R2RN+R2Wvie6ypomPBx+8JQhx98os7Yw9mzMeE=; b=HPfYkXLA1cT+g9jLGmkau4wDuZ o+0kMKoNnIFvSoPvXh+1LNG1GaGN/naVF5Xf0eA5I8Q/FMRnTLIdoBdimdKRu/MfUmf7tv3VwIiwA UDGzY1H/+wb1ShAoFgOBsqmxkW+EBIKBSSvHLar2zG+Wcwjo8j0H5WpbydqITnzyQ8h1Vwm4BEFsG PdJX530gQxHWZPlZzo2iDcqL8Ri0H0+D6jpMDiWoksSXoqEWc5DBBzYGynkzy/aS48pStQfCHWjPb jVemUao6/1NuSiereFDY0gkhldCSufyVKDtQ6zOrHmMCA3AVaeGY+k7wgSjwMPTGzt/CLU9paraaU 5XjFgvjw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1v1PqD-00000008jyY-0I9o; Wed, 24 Sep 2025 13:47:29 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id 0A0D1302D64; Wed, 24 Sep 2025 15:47:28 +0200 (CEST) Message-ID: <20250924134644.154610650@infradead.org> User-Agent: quilt/0.68 Date: Wed, 24 Sep 2025 15:45:10 +0200 From: Peter Zijlstra To: jpoimboe@kernel.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, alexandre.chartre@oracle.com Subject: [PATCH 3/3] objtool/x86: Fix NOP decode References: <20250924134507.288529132@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For x86_64 the kernel consistently uses 2 instructions for all NOPs: 90 - NOP 0f 1f /0 - NOPL Notably: - REP NOP is PAUSE, not a NOP instruction. - 0f {0c...0f} is reserved space, except for 0f 0d /1, which is PREFETCHW, not a NOP. - 0f {19,1c...1f} is reserved space, except for 0f 1f /0, which is NOPL. Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/arch/x86/decode.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -494,7 +494,8 @@ int arch_decode_instruction(struct objto break; =20 case 0x90: - insn->type =3D INSN_NOP; + if (prefix !=3D 0xf3) /* REP NOP :=3D PAUSE */ + insn->type =3D INSN_NOP; break; =20 case 0x9c: @@ -547,13 +548,14 @@ int arch_decode_instruction(struct objto =20 } else if (op2 =3D=3D 0x0b || op2 =3D=3D 0xb9) { =20 - /* ud2 */ + /* ud2, ud1 */ insn->type =3D INSN_BUG; =20 - } else if (op2 =3D=3D 0x0d || op2 =3D=3D 0x1f) { + } else if (op2 =3D=3D 0x1f) { =20 - /* nopl/nopw */ - insn->type =3D INSN_NOP; + /* 0f 1f /0 :=3D NOPL */ + if (modrm_reg =3D=3D 0) + insn->type =3D INSN_NOP; =20 } else if (op2 =3D=3D 0x1e) {