From nobody Wed Dec 17 05:29:55 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7F2C825F999 for ; Tue, 8 Apr 2025 07:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095746; cv=none; b=PwvVPiuAcRpk2AneMDTtDicM+E6bK72dufxsY+MNHgDHvDTuFJmq9K5YDCVDRApksFY4aBxzN2Zw1nm7TJiVEWtLyhWEqubXJ+FIfI6FCqu9RMAz4ila7nnRCd26qrfLhZZG/6AD+DUfE2t8IcAPHSU5vbx78WczOvIWCnUkE0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095746; c=relaxed/simple; bh=ssSk/dLBIqnA2lH+wz9VIJewqhP/EcXBDWETR4atZWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jEgnMnO0uq/BOJy5gbXHTP3VmWo402oDuRMUIDPFuM8xo3nlGBHPGF8o+ZM/9Sr5yFb1O5vPZ/NGvBFJbb1mguihNBAH5gdoMA1sxUooPfXEIEQGWdDKEUsVE8fad2ff5OQPAWBY6C+tZ+Ra2CyGYMlVDDggmQSf8ceS1LaVxwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hUSAg2QI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hUSAg2QI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14AF2C4CEEC; Tue, 8 Apr 2025 07:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744095746; bh=ssSk/dLBIqnA2lH+wz9VIJewqhP/EcXBDWETR4atZWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUSAg2QIfWVCoNA4Ecwd3LzWu0neMiKLTHRrmZKFThDz2F0XJ3Izp1h7iTSa/jyrf q+dNuhp08z+Ko6lf55tRn55Z2fqHManN5j2IeVR25lIoGXi1N7GvgxANO6H1vIKbux eoIy7tiRnPt5Xa4w3LYFcbx+0SMDuvy/ol3uxJsq//WQ+7VvtIlv1v697tFrUgHzL6 Pq2Ozy8zZXj9h+EC3NbyGUbElKg5yXKZe4ozNU3StVj1gsWXZrDZ1MZGWpwdHOTA/q WOXqfXiiSCNyDFkEpZMvLfg/8ASLoZ65RCXmZ/Cjd8VErpbWDywq4aI7+2f1xCMTwu V3EOzjL2eDubg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Juergen Gross , Andrew Cooper Subject: [PATCH v4 1/4] objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret() Date: Tue, 8 Apr 2025 00:02:13 -0700 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: 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" The !CONFIG_IA32_EMULATION version of xen_entry_SYSCALL_compat() ends with a SYSCALL instruction which is classified by objtool as INSN_CONTEXT_SWITCH. Unlike validate_branch(), validate_unret() doesn't consider INSN_CONTEXT_SWITCH in a non-function to be a dead end, so it keeps going past the end of xen_entry_SYSCALL_compat(), resulting in the following warning: vmlinux.o: warning: objtool: xen_reschedule_interrupt+0x2a: RET before UN= TRAIN Fix that by adding INSN_CONTEXT_SWITCH handling to validate_unret() to match what validate_branch() is already doing. Fixes: a09a6e2399ba ("objtool: Add entry UNRET validation") Reported-by: Andrew Cooper Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 4a1f6c3169b3..c81b070ca495 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3886,6 +3886,11 @@ static int validate_unret(struct objtool_file *file,= struct instruction *insn) WARN_INSN(insn, "RET before UNTRAIN"); return 1; =20 + case INSN_CONTEXT_SWITCH: + if (insn_func(insn)) + break; + return 0; + case INSN_NOP: if (insn->retpoline_safe) return 0; --=20 2.49.0 From nobody Wed Dec 17 05:29:55 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CBF6525FA23 for ; Tue, 8 Apr 2025 07:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095746; cv=none; b=m97/2vTQ8bLLZ+vzy7QXRvgDtXLjTv2nxXOp/AekzlEiwLnKq/gRbYZWmRK1Y7uaTCHmMzzweiH00VlcOdgp0klx2INMQu1vB2WZvg8HV8NPrplrfhQMXXMLZak3QmjtWHIznxwbkPQ5wmI8xBIsSwyVLTFjOypG7quLbuFeBRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095746; c=relaxed/simple; bh=k4/MKOOZH4NpMS5GeWM0EvPG1Sqm8xWCVQ2WGoP0xdM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=piDexQO2VQ9HUbKnbpu8FyfPYubCijhhko2ubwJvrlm9pnJxaq4y5Iiwfdh+cD9ulKKaiyBa0Fvjh6bp3tLO0MtC7s+TcJE/ANWT2Y0Rk341aowH5B/wbrE98QADybNqMObHaeXE/CA7vZ+kWUgv9EGmBjf6Voa5t5PS/0oDdmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pfykiJaP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pfykiJaP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74F46C4CEE9; Tue, 8 Apr 2025 07:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744095746; bh=k4/MKOOZH4NpMS5GeWM0EvPG1Sqm8xWCVQ2WGoP0xdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pfykiJaPTuSsy06Tgsybau043mDI9B9HKdx6J2Kxhztk35dE2hRxtQMmG+ggoN78Y sRzpMyuS2zSiYAZ1lCOjzn12NdujnCSWJirVmyHY/ldTIxBU2CiP/y7kO7YhHmp9kK pfJdopflL9VBOTccYbz4eoWVbO2GmjYRUIICqdcLij1kLaeNxDWX/ANuQq+8/j0Hor aNvJ22SZuTYOg+ykkaV9IH80nKrvK6lxL9zmBmt2bTbBaQoM5gcMZfaf6vrp1ikJh3 KSdZd5p4a13GqTcxogigijNZJZ8pzUG2KFkeNCTDOnlRioHEq6l8uupuSj4AgoCn6c +A3I0os7O5sQA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Juergen Gross Subject: [PATCH v4 2/4] objtool: Split INSN_CONTEXT_SWITCH into INSN_SYSCALL and INSN_SYSRET Date: Tue, 8 Apr 2025 00:02:14 -0700 Message-ID: <19a76c74d2c051d3bc9a775823cafc65ad267a7a.1744095216.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: 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" INSN_CONTEXT_SWITCH is ambiguous. It can represent both call semantics (SYSCALL, SYSENTER) and return semantics (SYSRET, IRET, RETS, RETU). Those differ significantly: calls preserve control flow whereas returns terminate it. Objtool uses an arbitrary rule for INSN_CONTEXT_SWITCH that almost works by accident: if in a function, keep going; otherwise stop. It should instead be based on the semantics of the underlying instruction. In preparation for improving that, split INSN_CONTEXT_SWITCH into INSN_SYCALL and INSN_SYSRET. No functional change. Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- tools/objtool/arch/x86/decode.c | 18 +++++++++++------- tools/objtool/check.c | 6 ++++-- tools/objtool/include/objtool/arch.h | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decod= e.c index 33d861c04ebd..3ce7b54003c2 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -522,7 +522,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec case INAT_PFX_REPNE: if (modrm =3D=3D 0xca) /* eretu/erets */ - insn->type =3D INSN_CONTEXT_SWITCH; + insn->type =3D INSN_SYSRET; break; default: if (modrm =3D=3D 0xca) @@ -535,11 +535,15 @@ int arch_decode_instruction(struct objtool_file *file= , const struct section *sec =20 insn->type =3D INSN_JUMP_CONDITIONAL; =20 - } else if (op2 =3D=3D 0x05 || op2 =3D=3D 0x07 || op2 =3D=3D 0x34 || - op2 =3D=3D 0x35) { + } else if (op2 =3D=3D 0x05 || op2 =3D=3D 0x34) { =20 - /* sysenter, sysret */ - insn->type =3D INSN_CONTEXT_SWITCH; + /* syscall, sysenter */ + insn->type =3D INSN_SYSCALL; + + } else if (op2 =3D=3D 0x07 || op2 =3D=3D 0x35) { + + /* sysret, sysexit */ + insn->type =3D INSN_SYSRET; =20 } else if (op2 =3D=3D 0x0b || op2 =3D=3D 0xb9) { =20 @@ -676,7 +680,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec =20 case 0xca: /* retf */ case 0xcb: /* retf */ - insn->type =3D INSN_CONTEXT_SWITCH; + insn->type =3D INSN_SYSRET; break; =20 case 0xe0: /* loopne */ @@ -721,7 +725,7 @@ int arch_decode_instruction(struct objtool_file *file, = const struct section *sec } else if (modrm_reg =3D=3D 5) { =20 /* jmpf */ - insn->type =3D INSN_CONTEXT_SWITCH; + insn->type =3D INSN_SYSRET; =20 } else if (modrm_reg =3D=3D 6) { =20 diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c81b070ca495..2c703b960420 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3684,7 +3684,8 @@ static int validate_branch(struct objtool_file *file,= struct symbol *func, =20 break; =20 - case INSN_CONTEXT_SWITCH: + case INSN_SYSCALL: + case INSN_SYSRET: if (func) { if (!next_insn || !next_insn->hint) { WARN_INSN(insn, "unsupported instruction in callable function"); @@ -3886,7 +3887,8 @@ static int validate_unret(struct objtool_file *file, = struct instruction *insn) WARN_INSN(insn, "RET before UNTRAIN"); return 1; =20 - case INSN_CONTEXT_SWITCH: + case INSN_SYSCALL: + case INSN_SYSRET: if (insn_func(insn)) break; return 0; diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/o= bjtool/arch.h index 089a1acc48a8..01ef6f415adf 100644 --- a/tools/objtool/include/objtool/arch.h +++ b/tools/objtool/include/objtool/arch.h @@ -19,7 +19,8 @@ enum insn_type { INSN_CALL, INSN_CALL_DYNAMIC, INSN_RETURN, - INSN_CONTEXT_SWITCH, + INSN_SYSCALL, + INSN_SYSRET, INSN_BUG, INSN_NOP, INSN_STAC, --=20 2.49.0 From nobody Wed Dec 17 05:29:55 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 452B325FA32 for ; Tue, 8 Apr 2025 07:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095747; cv=none; b=s7rsHmARZ1JloivlNnjZjlzD2r3NQkc12mA0/qGNEWeK6zp5Dp6Kk+fbYEj1ohA4h67a2mTGXlg88goSCOH9CphZuQIkEtoWU9U0kcrRpcd0Hd7EUgS9eThj8Wmz1c3VHvcCfQtne7fA4HwC7ARuDNRJrHK9WtFQ0itd1uMsyqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095747; c=relaxed/simple; bh=SBUDINiLyQ7t66jKolDruYGdHapsNuOiOzSyeiA3nqg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AnS7bb/sSRekBYuuFkjtH9Icq5FqWJpFNIRN1EYP3lpY1sVzRbsJWfrWk8nUvsbOu6CoKXV/I+otWNuJDxQT3mR7nFZ02XqZn3Uluh8iuD2qPuW4ngJ9ZeQqgo8ZYV8iPARhyE+B2bMF13ktN9Vfxn2VArvAPkiubl42e4z+lIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ehr36aq3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ehr36aq3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEADDC4CEEC; Tue, 8 Apr 2025 07:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744095747; bh=SBUDINiLyQ7t66jKolDruYGdHapsNuOiOzSyeiA3nqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehr36aq3g4yD9MDkfuZOnbbQlwCL1vDRhazEB5LNY+ji13HMQDSzBI4WMFcNjHHdc zaO5PcKnHNltbkrhVp7FXU8m3myan5PqxXuvWQy1oEm7OAzgFXo4q3Hoz3DbF7pvXK P+5vsy7f7i/4tjjgFKZ2PODVvrrtM+yP1Q8INAFmX/OtO2HHkitZHb4gVJRet2hliK wVgTm3K40EOemYmkzsvSz+VEKii8h+AewGNWj8NQRDQI50xGF9LSilkpWuD5xNm1jo VU3F1trO9nXUoSqBjdx2dvR7f+h+EhNDInC7e5yGbQ6mY/+Ohf95fr01/95UOwAHQK 2r1tXgL2YSWpQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Juergen Gross Subject: [PATCH v4 3/4] objtool: Stop UNRET validation on UD2 Date: Tue, 8 Apr 2025 00:02:15 -0700 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: 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" In preparation for simplifying INSN_SYSCALL, make validate_unret() terminate control flow on UD2 just like validate_branch() already does. Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2c703b960420..2dd89b0f4d5e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3902,6 +3902,9 @@ static int validate_unret(struct objtool_file *file, = struct instruction *insn) break; } =20 + if (insn->dead_end) + return 0; + if (!next) { WARN_INSN(insn, "teh end!"); return 1; --=20 2.49.0 From nobody Wed Dec 17 05:29:55 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0AE55261380 for ; Tue, 8 Apr 2025 07:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095748; cv=none; b=Ooapl45Z0USFe79lIeo1S+8kwTQpFfkPicDyQxhZmflKf4UbeUUHwgOAiV98KVq1lx29LpOjUjuKheCX1zyeZ9jAlPKSB/rI/J1TLKnaM+AoSSjCaiFpVnSIkIvphbsS4ktF3sREVhRw7hlUXnTA/9fFuSevC9ZYFTeID4BnWjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744095748; c=relaxed/simple; bh=UZHNB2WAaIfQoYLqr+y1DhwVCNZfceB4h6yShNlV8mc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rkENvMnrLXIabFtSl1KVF2REEBGG3zVzrTyvAS6ORbOljHrvJiOIl7jpYWe+zHBO7FVDQgo4YLAl7EGUnv+fdOk9XX8FIKGePctcvr1qm69cOY3eycl/ggyvFpxeOLpo/p89lS8P5wqAf9KruBgEIpaEA1tZ2jkAFk2zzxrlWRo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kzCTGnLM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kzCTGnLM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 452F7C4CEF2; Tue, 8 Apr 2025 07:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744095747; bh=UZHNB2WAaIfQoYLqr+y1DhwVCNZfceB4h6yShNlV8mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzCTGnLMcbIpK9DVabRh3EcKZhX57rM/643RZ44nM2Lhj4zfD6kXZYHLXrKkGg2pl DPMi+VgRJdeupVgeQssBVeQOXswn+KRRiQ3t/lr7aehnjMI/LzrJ+CnsXLPCfqXNdL OXL+q0PsDJz+b9ALSa/ad7uQkZKD3ViYYqJUjGrtF1Wjsr1L5QbPXf3DrWXNGRebji Mdhfl9VZyx5+CMihD8J5nXk3qtZ+cg6QmEXh/WcTEcbun252JVocc0znuLWFwcUI6N XTv3zWCtJz6cs1ASjBR/3pfmFw6bCiUJyRR8nPgdJgRlnBB0R6nQfvP2scl+pXcD1O wmEV7K5718Mxw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Juergen Gross Subject: [PATCH v4 4/4] objtool, xen: Fix INSN_SYSCALL / INSN_SYSRET semantics Date: Tue, 8 Apr 2025 00:02:16 -0700 Message-ID: <19453dfe9a0431b7f016e9dc16d031cad3812a50.1744095216.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: 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" Objtool uses an arbitrary rule for INSN_SYSCALL and INSN_SYSRET that almost works by accident: if it's in a function, control flow continues after the instruction, otherwise it terminates. That behavior should instead be based on the semantics of the underlying instruction. Change INSN_SYSCALL to always preserve control flow and INSN_SYSRET to always terminate it. The changed semantic for INSN_SYSCALL requires a tweak to the !CONFIG_IA32_EMULATION version of xen_entry_SYSCALL_compat(). In Xen, SYSCALL is a hypercall which usually returns. But in this case it's a hypercall to IRET which doesn't return. Add UD2 to tell objtool to terminate control flow, and to prevent undefined behavior at runtime. Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- arch/x86/xen/xen-asm.S | 4 +--- tools/objtool/check.c | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S index 109af12f7647..461bb1526502 100644 --- a/arch/x86/xen/xen-asm.S +++ b/arch/x86/xen/xen-asm.S @@ -226,9 +226,7 @@ SYM_CODE_END(xen_early_idt_handler_array) push %rax mov $__HYPERVISOR_iret, %eax syscall /* Do the IRET. */ -#ifdef CONFIG_MITIGATION_SLS - int3 -#endif + ud2 /* The SYSCALL should never return. */ .endm =20 SYM_CODE_START(xen_iret) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2dd89b0f4d5e..69f94bc47499 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3685,14 +3685,19 @@ static int validate_branch(struct objtool_file *fil= e, struct symbol *func, break; =20 case INSN_SYSCALL: - case INSN_SYSRET: - if (func) { - if (!next_insn || !next_insn->hint) { - WARN_INSN(insn, "unsupported instruction in callable function"); - return 1; - } - break; + if (func && (!next_insn || !next_insn->hint)) { + WARN_INSN(insn, "unsupported instruction in callable function"); + return 1; } + + break; + + case INSN_SYSRET: + if (func && (!next_insn || !next_insn->hint)) { + WARN_INSN(insn, "unsupported instruction in callable function"); + return 1; + } + return 0; =20 case INSN_STAC: @@ -3888,9 +3893,9 @@ static int validate_unret(struct objtool_file *file, = struct instruction *insn) return 1; =20 case INSN_SYSCALL: + break; + case INSN_SYSRET: - if (insn_func(insn)) - break; return 0; =20 case INSN_NOP: --=20 2.49.0