Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631224

Re: [v6 PATCH 03/21] x86/mpx: Do not use R/EBP as base in the SIB byte with Mod = 0

From Borislav Petkov <bp@suse.de>
Newsgroups linux.kernel
Subject Re: [v6 PATCH 03/21] x86/mpx: Do not use R/EBP as base in the SIB byte with Mod = 0
Date 2017-04-26 10:20 +0200
Message-ID <tAql4-84y-3@gated-at.bofh.it> (permalink)
References <tixO1-76a-3@gated-at.bofh.it> <tixO1-76a-11@gated-at.bofh.it> <tvc93-4t0-1@gated-at.bofh.it> <tAkz0-4lo-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Apr 25, 2017 at 07:04:20PM -0700, Ricardo Neri wrote:
> For the specific case of ModRM.mod being 0, I feel I need to clarify
> that REX.B is not decoded and if SIB.base is %r13 the base is also 0.

Well, that all doesn't matter. The rule is this:

ModRM.mod == 00b and ModRM.r/m == 101b -> effective address: disp32

See Table 2-2. "32-Bit Addressing Forms with the ModR/M Byte" in the SDM.

So the base register is not used. How that base register is specified
then doesn't matter (undecoded REX bits or not).

> This comment adds clarity because REX.X is decoded when determining
> SIB.index.

Well, that's a different thing. The REX bits participating in the SIB
fields don't matter about this particular case. We only want to say that
we're returning a disp32 without a base register and the comment should
keep it simple without extraneous information.

I know, you want to mention what Table 2-5. "Special Cases of REX
Encodings" says but we should avoid unnecessary content in the comment.
People who want details can stare at the manuals - the comment should
only document what that particular case is.

Btw, you could write it even better:

	if (!X86_MODRM_MOD(insn->modrm.value) && X86_MODRM_RM(insn->modrm.value) == 5)

and then it is basically a 1:1 copy of the rule from Table 2-2.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [v6 PATCH 03/21] x86/mpx: Do not use R/EBP as base in the SIB  byte with Mod = 0 Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-04-26 04:10 +0200
  Re: [v6 PATCH 03/21] x86/mpx: Do not use R/EBP as base in the SIB  byte with Mod = 0 Borislav Petkov <bp@suse.de> - 2017-04-26 10:20 +0200
    Re: [v6 PATCH 03/21] x86/mpx: Do not use R/EBP as base in the SIB  byte with Mod = 0 Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-04-28 01:00 +0200

csiph-web