[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180115191151.zmnuxymdjtp5qkvm@treble>
Date: Mon, 15 Jan 2018 13:11:51 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Peter Zijlstra <peterz@...radead.org>,
David Woodhouse <dwmw2@...radead.org>,
linux-kernel@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg KH <gregkh@...uxfoundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Arjan Van De Ven <arjan.van.de.ven@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>
Subject: Re: [PATCH 2/4] objtool: Implement jump_assert for _static_cpu_has()
On Mon, Jan 15, 2018 at 01:08:19PM -0600, Josh Poimboeuf wrote:
> On Mon, Jan 15, 2018 at 07:59:37PM +0100, Borislav Petkov wrote:
> > Right,
> >
> > I've been putting away extending struct alt_instr for a long time now,
> > trying to be conservative about it but I guess this might be the right
> > time to change that. How about:
> >
> > struct alt_instr {
> > s32 instr_offset; /* original instruction */
> > s32 repl_offset; /* offset to replacement instruction */
> > u16 cpuid; /* cpuid bit set for replacement */
> > u8 instrlen; /* length of original instruction */
> > u8 replacementlen; /* length of new instruction */
> > u8 padlen; /* length of build-time padding */
> > u64 flags; /* alternative flags, see <some enum> */
> > } __packed;
> >
> > This way we have 64 settings. So we could do:
> >
> > ...
> > .flags = ALT_FLAGS_STATIC_CPU_HAS,
> >
> > or something like that and then we can do additional processing/matching
> > for the alternatives.
> >
> > Or, we can do
> >
> > struct alt_instr {
> > s32 instr_offset; /* original instruction */
> > s32 repl_offset; /* offset to replacement instruction */
> > u16 cpuid; /* cpuid bit set for replacement */
> > u8 instrlen; /* length of original instruction */
> > u8 replacementlen; /* length of new instruction */
> > u8 padlen; /* length of build-time padding */
> > u8 type; /* types */
> > } __packed;
> >
> > and have 256 types but that would be limiting as we won't be able to set
> > more than one.
> >
> > Hmmm?
>
> That might be a good idea, but here we also need to annotate jump
> labels. So unless you want to make alternatives broad enough to
> encompass jump labels, I don't think it solves this particular problem.
Well, to clarify, it would solve _some_ of the problem. Maybe even most
of the problem. We'd still need to special-case jump labels in objtool
(like in 1/4), but that's probably not a big deal.
So, contradicting my previous answer here... yes, it would help.
--
Josh
Powered by blists - more mailing lists