Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1740635
| From | Borislav Petkov <bp@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector |
| Date | 2017-09-27 13:50 +0200 |
| Message-ID | <uuj0K-1P9-5@gated-at.bofh.it> (permalink) |
| References | <ufZOh-2z5-3@gated-at.bofh.it> <ufZXY-2C3-23@gated-at.bofh.it> <utVB7-3Ca-11@gated-at.bofh.it> <uuc8V-5Vj-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Sep 26, 2017 at 09:21:44PM -0700, Ricardo Neri wrote:
> This is true except when we don't have an insn at all (well, it may be
> non-NULL but it will only contain garbage). The case to which I am
> referring is when we begin decoding our instruction. The first step is
> to copy_from_user the instruction and populate insn. For this we must
> calculate the linear address from where we copy using CS and rIP.
Where do we do that?
> Furthermore, in this only case we don't need to look at insn at all as
> the only register involved is rIP no segment override prefixes are
> allowed.
In any case, as it is now it sounds convoluted: you may or may not
have an insn, and yet you call get_overridden_seg_reg() on it but you
don't really need segment overrides because you only need CS and rIP
initially.
Sounds to me like this initial parsing should be done separately from
this function...
> I only used "(E)" (i.e., not the "(R|)" part) as these utility
> functions will deal mostly with protected mode, unless FS or GS are
> used in long mode.
eIP or rIP is simply much easier to type and parse. Those brackets, not
really.
> I only check for a NULL insn when needed (i.e., the contents of the
> instruction could change the used segment register).
... and those if (!insn) tests sprinkled around simply make the code
unreadable and if we can get rid of them, we should.
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-09-27 06:30 +0200
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Borislav Petkov <bp@suse.de> - 2017-09-27 13:50 +0200
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-09-28 00:40 +0200
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Borislav Petkov <bp@suse.de> - 2017-09-28 11:40 +0200
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-09-29 08:10 +0200
Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector Borislav Petkov <bp@suse.de> - 2017-09-29 14:00 +0200
csiph-web