[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250430190328.GO4439@noisy.programming.kicks-ass.net>
Date: Wed, 30 Apr 2025 21:03:28 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, kys@...rosoft.com, haiyangz@...rosoft.com,
wei.liu@...nel.org, decui@...rosoft.com, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
hpa@...or.com, seanjc@...gle.com, pbonzini@...hat.com,
ardb@...nel.org, kees@...nel.org, Arnd Bergmann <arnd@...db.de>,
gregkh@...uxfoundation.org, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-efi@...r.kernel.org, samitolvanen@...gle.com,
ojeda@...nel.org
Subject: Re: [PATCH v2 13/13] objtool: Validate kCFI calls
On Wed, Apr 30, 2025 at 08:59:53AM -0700, Josh Poimboeuf wrote:
> On Wed, Apr 30, 2025 at 01:07:47PM +0200, Peter Zijlstra wrote:
> > + case ANNOTYPE_NOCFI:
> > + sym = insn->sym;
> > + if (!sym) {
> > + ERROR_INSN(insn, "dodgy NOCFI annotation");
> > + break;
>
> return -1;
Oh right.
> > + /*
> > + * kCFI call sites look like:
> > + *
> > + * movl $(-0x12345678), %r10d
> > + * addl -4(%r11), %r10d
> > + * jz 1f
> > + * ud2
> > + * 1: cs call __x86_indirect_thunk_r11
> > + *
> > + * Verify all indirect calls are kCFI adorned by checking for the
> > + * UD2. Notably, doing __nocfi calls to regular (cfi) functions is
> > + * broken.
> > + */
> > + list_for_each_entry(insn, &file->retpoline_call_list, call_node) {
> > + struct symbol *sym = insn->sym;
> > +
> > + if (sym && sym->type == STT_FUNC && !sym->nocfi) {
> > + struct instruction *prev =
> > + prev_insn_same_sym(file, insn);
> > +
> > + if (!prev || prev->type != INSN_BUG) {
> > + WARN_INSN(insn, "no-cfi indirect call!");
> > + warnings++;
>
> Do we not care about indirect calls from !STT_FUNC?
Let me try, see what happens.
Powered by blists - more mailing lists