* [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses
@ 2016-11-02 14:52 Andrew Cooper
2016-11-02 15:42 ` Jan Beulich
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2016-11-02 14:52 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich
No sane OS would deliberately try this, but make Xen's emulation match real
hardware by delivering #GP(0), rather than suffering a VMEntry failure.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/x86/x86_emulate/x86_emulate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 7a707dc..6b940c4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -4443,6 +4443,8 @@ x86_emulate(
(rc = read_ulong(ea.mem.seg, ea.mem.off+2,
&base, mode_64bit() ? 8 : 4, ctxt, ops)) )
goto done;
+ generate_exception_if(mode_64bit() &&
+ !is_canonical_address(base), EXC_GP, 0);
sreg.base = base;
sreg.limit = limit;
if ( op_bytes == 2 )
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses
2016-11-02 14:52 [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses Andrew Cooper
@ 2016-11-02 15:42 ` Jan Beulich
2016-11-02 17:39 ` Andrew Cooper
2016-11-03 10:43 ` Wei Liu
0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2016-11-02 15:42 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Wei Liu, Xen-devel
>>> On 02.11.16 at 15:52, <andrew.cooper3@citrix.com> wrote:
> No sane OS would deliberately try this, but make Xen's emulation match real
> hardware by delivering #GP(0), rather than suffering a VMEntry failure.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
albeit ...
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -4443,6 +4443,8 @@ x86_emulate(
> (rc = read_ulong(ea.mem.seg, ea.mem.off+2,
> &base, mode_64bit() ? 8 : 4, ctxt, ops)) )
> goto done;
> + generate_exception_if(mode_64bit() &&
> + !is_canonical_address(base), EXC_GP, 0);
... I don't think the mode_64bit() part is needed.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses
2016-11-02 15:42 ` Jan Beulich
@ 2016-11-02 17:39 ` Andrew Cooper
2016-11-03 10:43 ` Wei Liu
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2016-11-02 17:39 UTC (permalink / raw)
To: Jan Beulich; +Cc: Wei Liu, Xen-devel
On 02/11/16 15:42, Jan Beulich wrote:
>>>> On 02.11.16 at 15:52, <andrew.cooper3@citrix.com> wrote:
>> No sane OS would deliberately try this, but make Xen's emulation match real
>> hardware by delivering #GP(0), rather than suffering a VMEntry failure.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> albeit ...
>
>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>> @@ -4443,6 +4443,8 @@ x86_emulate(
>> (rc = read_ulong(ea.mem.seg, ea.mem.off+2,
>> &base, mode_64bit() ? 8 : 4, ctxt, ops)) )
>> goto done;
>> + generate_exception_if(mode_64bit() &&
>> + !is_canonical_address(base), EXC_GP, 0);
> ... I don't think the mode_64bit() part is needed.
True - as we explicitly zero sreg to start with, the canonical base
check is safe in all modes. I will drop it from v2.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses
2016-11-02 15:42 ` Jan Beulich
2016-11-02 17:39 ` Andrew Cooper
@ 2016-11-03 10:43 ` Wei Liu
1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-11-03 10:43 UTC (permalink / raw)
To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, Xen-devel
On Wed, Nov 02, 2016 at 09:42:33AM -0600, Jan Beulich wrote:
> >>> On 02.11.16 at 15:52, <andrew.cooper3@citrix.com> wrote:
> > No sane OS would deliberately try this, but make Xen's emulation match real
> > hardware by delivering #GP(0), rather than suffering a VMEntry failure.
> >
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-03 10:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02 14:52 [PATCH for-4.8] x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses Andrew Cooper
2016-11-02 15:42 ` Jan Beulich
2016-11-02 17:39 ` Andrew Cooper
2016-11-03 10:43 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).