Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector

From: Ricardo Neri
Date: Wed Oct 04 2017 - 12:48:25 EST


On Fri, 2017-09-29 at 13:56 +0200, Borislav Petkov wrote:
> On Thu, Sep 28, 2017 at 11:06:42PM -0700, Ricardo Neri wrote:
> >
> > I agree. In fact, insn_get_seg_base() does not need insn at all. All it
> > needs is
> > a INAT_SEG_REG_* index. This would make things clear. UMIP (and callers that
> > need to copy_from_user code can do insn_get_seg_base(regs, INAT_SEG_REG_CS).
> > No
> > insn needed.
> Yap.
>
> >
> > In fact, it is only the insn_get_addr_ref_xx() family of functions that does
> I think you mean get_addr_ref_xx() here.

Yes.

>
> >
> > Do you think the pseudocode above addresses your concerns?
> >
> > *insn_get_seg_base() will take a INAT_SEG_REG_* index
> > *insn_get_ref_xx() receives an initialized insn that can check for NULL
> > value.
> > *a reworked resolve_seg_reg_idx will clearly check if it can use segment
> > override prefixes and obtain them. If not, it will use default values.
> Makes sense, but send me the final version to take a look at it too.

I just sent a v9 with all these changes as they impacted several patches in the
series.

Thanks and BR,
Ricardo