From: Pengfei Xu <pengfei.xu@intel.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: <x86@kernel.org>, <linux-kernel@vger.kernel.org>,
"Yang, Weijiang" <weijiang.yang@intel.com>,
"Su, Heng" <heng.su@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v1.1] x86/ibt, objtool: Add IBT_NOSEAL()
Date: Fri, 19 Aug 2022 13:54:06 +0800 [thread overview]
Message-ID: <Yv8lfpTQk8cqZNVU@xpf.sh.intel.com> (raw)
In-Reply-To: <20220818213927.e44fmxkoq4yj6ybn@treble>
Hi Poimboeuf,
I installed your patches based on v5.19 kernel.
And ran syzkaller test on TGL-H and ADL-P for more than
4 hours with above kernel, this issue could not be reproduced.
This issue should be fixed.
Thanks!
BR.
On 2022-08-18 at 14:39:27 -0700, Josh Poimboeuf wrote:
> Add a macro which prevents a function from getting sealed if there are
> no compile-time references to it.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
> v1.1:
> - add empty IBT_NOSEAL for CONFIG_X86_KERNEL_IBT=n
>
> arch/x86/include/asm/ibt.h | 11 +++++++++++
> tools/objtool/check.c | 3 ++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/ibt.h b/arch/x86/include/asm/ibt.h
> index 689880eca9ba..9b08082a5d9f 100644
> --- a/arch/x86/include/asm/ibt.h
> +++ b/arch/x86/include/asm/ibt.h
> @@ -31,6 +31,16 @@
>
> #define __noendbr __attribute__((nocf_check))
>
> +/*
> + * Create a dummy function pointer reference to prevent objtool from marking
> + * the function as needing to be "sealed" (i.e. ENDBR converted to NOP by
> + * apply_ibt_endbr()).
> + */
> +#define IBT_NOSEAL(fname) \
> + ".pushsection .discard.ibt_endbr_noseal\n\t" \
> + _ASM_PTR fname "\n\t" \
> + ".popsection\n\t"
> +
> static inline __attribute_const__ u32 gen_endbr(void)
> {
> u32 endbr;
> @@ -84,6 +94,7 @@ extern __noendbr void ibt_restore(u64 save);
> #ifndef __ASSEMBLY__
>
> #define ASM_ENDBR
> +#define IBT_NOSEAL(name)
>
> #define __noendbr
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 0cec74da7ffe..91678252a9b6 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -4096,7 +4096,8 @@ static int validate_ibt(struct objtool_file *file)
> * These sections can reference text addresses, but not with
> * the intent to indirect branch to them.
> */
> - if (!strncmp(sec->name, ".discard", 8) ||
> + if ((!strncmp(sec->name, ".discard", 8) &&
> + strcmp(sec->name, ".discard.ibt_endbr_noseal")) ||
> !strncmp(sec->name, ".debug", 6) ||
> !strcmp(sec->name, ".altinstructions") ||
> !strcmp(sec->name, ".ibt_endbr_seal") ||
> --
> 2.37.2
>
next prev parent reply other threads:[~2022-08-19 5:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 15:53 [PATCH 0/3] x86/kvm, objtool: Fix KVM "missing ENDBR" bug Josh Poimboeuf
2022-08-18 15:53 ` [PATCH 1/3] x86/ibt, objtool: Add IBT_NOSEAL() Josh Poimboeuf
2022-08-18 21:39 ` [PATCH v1.1] " Josh Poimboeuf
2022-08-19 5:54 ` Pengfei Xu [this message]
2022-08-18 15:53 ` [PATCH 2/3] x86/kvm: Simplify FOP_SETCC() Josh Poimboeuf
2022-08-18 15:53 ` [PATCH 3/3] x86/kvm: Fix "missing ENDBR" BUG for fastop functions Josh Poimboeuf
2022-08-18 17:25 ` [PATCH 0/3] x86/kvm, objtool: Fix KVM "missing ENDBR" bug Paolo Bonzini
2022-08-19 7:50 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yv8lfpTQk8cqZNVU@xpf.sh.intel.com \
--to=pengfei.xu@intel.com \
--cc=heng.su@intel.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=weijiang.yang@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®