On Fri, Oct 27, 2017 at 01:25:45PM -0700, Ricardo Neri wrote: > insn_get_addr_ref() returns the effective address as defined by the > section 3.7.5.1 Vol 1 of the Intel 64 and IA-32 Architectures Software > Developer's Manual. In order to compute the linear address, we must add > to the effective address the segment base address as set in the segment > descriptor. The segment descriptor to use depends on the register used as > operand and segment override prefixes, if any. > > In most cases, the segment base address will be 0 if the USER_DS/USER32_DS > segment is used or if segmentation is not used. However, the base address > is not necessarily zero if a user programs defines its own segments. This > is possible by using a local descriptor table. > > Since the effective address is a signed quantity, the unsigned segment > base address is saved in a separate variable and added to the final, > unsigned, effective address. > > Cc: Dave Hansen <dave.han...@linux.intel.com> > Cc: Adam Buchbinder <adam.buchbin...@gmail.com> > Cc: Colin Ian King <colin.k...@canonical.com> > Cc: Lorenzo Stoakes <lstoa...@gmail.com> > Cc: Qiaowei Ren <qiaowei....@intel.com> > Cc: Arnaldo Carvalho de Melo <a...@redhat.com> > Cc: Masami Hiramatsu <mhira...@kernel.org> > Cc: Adrian Hunter <adrian.hun...@intel.com> > Cc: Kees Cook <keesc...@chromium.org> > Cc: Thomas Garnier <thgar...@google.com> > Cc: Peter Zijlstra <pet...@infradead.org> > Cc: Borislav Petkov <b...@suse.de> > Cc: Dmitry Vyukov <dvyu...@google.com> > Cc: Ravi V. Shankar <ravi.v.shan...@intel.com> > Cc: x...@kernel.org > Signed-off-by: Ricardo Neri <ricardo.neri-calde...@linux.intel.com> > --- > arch/x86/lib/insn-eval.c | 55 > +++++++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 52 insertions(+), 3 deletions(-)
Reviewed-by: Borislav Petkov <b...@suse.de> -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --