From nobody Mon Jun 22 23:41:08 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E493C433EF for ; Tue, 15 Mar 2022 10:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347374AbiCOKrq (ORCPT ); Tue, 15 Mar 2022 06:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347408AbiCOKpx (ORCPT ); Tue, 15 Mar 2022 06:45:53 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A51351316; Tue, 15 Mar 2022 03:44:14 -0700 (PDT) Date: Tue, 15 Mar 2022 10:44:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647341053; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=th9wlFvuAi/z/VLkuNyschT/woD6lbuLfOlTayI0RL4=; b=nPiaZGD7oDWS8JSHm4Q/RdgezPDID0BmbOcd+edy9NCAOcR6r/IzqBI5k1/gUdO9NRQjmC WspQ4qypoEpbxciVi8eiOlwOJ12J6m6mMeOyDjBjSJy33I2+teNFfzXL5MSFgFbFJHtHel w/dwCEJkifjE14k3pAH6xDjED40536UM3vGVlw+N7szar2GDHMTjf6VhGH/pMvjZBpXGoJ O/UqPXtv4tXPWH6NH+ndDPPXaD9YuwLLpyRnn2axuluI85zJ5nYNlhnPyUfkvTuZ4/NyF0 zM6zUaJ2PDlQGeSBB/7d74qovEQeEwBSzPEQo11KVmtSU3aRCOUPPrmO2gTfRw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647341053; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=th9wlFvuAi/z/VLkuNyschT/woD6lbuLfOlTayI0RL4=; b=0H1EV1T2JePPQxOmWz3AepJu4oQxWjvaS+GnugrciYPavSf5tUdYe59zN4bxqEirKv/u7L u+lwzyaeZdroBUAw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/ibt: Add ANNOTATE_NOENDBR Cc: "Peter Zijlstra (Intel)" , Kees Cook , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220308154317.578968224@infradead.org> References: <20220308154317.578968224@infradead.org> MIME-Version: 1.0 Message-ID: <164734105230.16921.2670196975839251214.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: c8c301abeae58ec756b8fcb2178a632bd3c9e284 Gitweb: https://git.kernel.org/tip/c8c301abeae58ec756b8fcb2178a632bd= 3c9e284 Author: Peter Zijlstra AuthorDate: Tue, 08 Mar 2022 16:30:18 +01:00 Committer: Peter Zijlstra CommitterDate: Tue, 15 Mar 2022 10:32:33 +01:00 x86/ibt: Add ANNOTATE_NOENDBR In order to have objtool warn about code references to !ENDBR instruction, we need an annotation to allow this for non-control-flow instances -- consider text range checks, text patching, or return trampolines etc. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kees Cook Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20220308154317.578968224@infradead.org --- include/linux/objtool.h | 16 ++++++++++++++++ tools/include/linux/objtool.h | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/linux/objtool.h b/include/linux/objtool.h index aca52db..f797368 100644 --- a/include/linux/objtool.h +++ b/include/linux/objtool.h @@ -77,6 +77,12 @@ struct unwind_hint { #define STACK_FRAME_NON_STANDARD_FP(func) #endif =20 +#define ANNOTATE_NOENDBR \ + "986: \n\t" \ + ".pushsection .discard.noendbr\n\t" \ + _ASM_PTR " 986b\n\t" \ + ".popsection\n\t" + #else /* __ASSEMBLY__ */ =20 /* @@ -129,6 +135,13 @@ struct unwind_hint { .popsection .endm =20 +.macro ANNOTATE_NOENDBR +.Lhere_\@: + .pushsection .discard.noendbr + .quad .Lhere_\@ + .popsection +.endm + #endif /* __ASSEMBLY__ */ =20 #else /* !CONFIG_STACK_VALIDATION */ @@ -139,12 +152,15 @@ struct unwind_hint { "\n\t" #define STACK_FRAME_NON_STANDARD(func) #define STACK_FRAME_NON_STANDARD_FP(func) +#define ANNOTATE_NOENDBR #else #define ANNOTATE_INTRA_FUNCTION_CALL .macro UNWIND_HINT sp_reg:req sp_offset=3D0 type:req end=3D0 .endm .macro STACK_FRAME_NON_STANDARD func:req .endm +.macro ANNOTATE_NOENDBR +.endm #endif =20 #endif /* CONFIG_STACK_VALIDATION */ diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h index aca52db..f797368 100644 --- a/tools/include/linux/objtool.h +++ b/tools/include/linux/objtool.h @@ -77,6 +77,12 @@ struct unwind_hint { #define STACK_FRAME_NON_STANDARD_FP(func) #endif =20 +#define ANNOTATE_NOENDBR \ + "986: \n\t" \ + ".pushsection .discard.noendbr\n\t" \ + _ASM_PTR " 986b\n\t" \ + ".popsection\n\t" + #else /* __ASSEMBLY__ */ =20 /* @@ -129,6 +135,13 @@ struct unwind_hint { .popsection .endm =20 +.macro ANNOTATE_NOENDBR +.Lhere_\@: + .pushsection .discard.noendbr + .quad .Lhere_\@ + .popsection +.endm + #endif /* __ASSEMBLY__ */ =20 #else /* !CONFIG_STACK_VALIDATION */ @@ -139,12 +152,15 @@ struct unwind_hint { "\n\t" #define STACK_FRAME_NON_STANDARD(func) #define STACK_FRAME_NON_STANDARD_FP(func) +#define ANNOTATE_NOENDBR #else #define ANNOTATE_INTRA_FUNCTION_CALL .macro UNWIND_HINT sp_reg:req sp_offset=3D0 type:req end=3D0 .endm .macro STACK_FRAME_NON_STANDARD func:req .endm +.macro ANNOTATE_NOENDBR +.endm #endif =20 #endif /* CONFIG_STACK_VALIDATION */