lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <cbbf4f41-db88-d238-4eef-47b4f9582229@intel.com> Date: Tue, 12 Dec 2017 16:50:11 +0800 From: Lan Tianyu <tianyu.lan@...el.com> To: Paolo Bonzini <pbonzini@...hat.com>, Tianyu Lan <lantianyu1986@...il.com>, Jim Mattson <jmattson@...gle.com> Cc: Wanpeng Li <kernellwp@...il.com>, Dmitry Vyukov <dvyukov@...gle.com>, syzbot <bot+75375385991b4f8c599704a10849863c586ea284@...kaller.appspotmail.com>, "H. Peter Anvin" <hpa@...or.com>, kvm <kvm@...r.kernel.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...hat.com>, Radim Krcmar <rkrcmar@...hat.com>, syzkaller-bugs@...glegroups.com, Thomas Gleixner <tglx@...utronix.de>, the arch/x86 maintainers <x86@...nel.org> Subject: Re: Re: WARNING in x86_emulate_insn On 2017年12月12日 06:45, Paolo Bonzini wrote: > On 08/12/2017 09:28, Tianyu Lan wrote: >> I find this is pop instruction emulation issue. According "SDM VOL2, >> chapter INSTRUCTION >> SET REFERENCE. POP—Pop a Value from the Stack" >> >> Protected Mode Exceptions >> #GP(0) If attempt is made to load SS register with NULL segment selector. > > This is not what the testcase is testing; this is already covered by > __load_segment_descriptor: > > if (null_selector) { > if (seg == VCPU_SREG_CS || seg == VCPU_SREG_TR) > goto exception; > > if (seg == VCPU_SREG_SS) { > if (ctxt->mode != X86EMUL_MODE_PROT64 || rpl != cpl) > goto exception; > ... > } Yes, __load_segment_descriptor() does such check. I find em_pop doesn't load SS segment. SS isn't loaded before calling em_pop in the test case. Should this be fixed? > > Is there a path that can return X86EMUL_PROPAGATE_FAULT without setting > ctxt->exception.vector and/or without going through emulate_exception? > > I don't think it's possible to write a test in kvm-unit-tests, because the > state has "impossible" segment descriptor cache contents. Sent out a fix patch for the issue. Please have a look. Thanks. https://marc.info/?l=kvm&m=151306208214733&w=2 > > Paolo > >> This test case hits it but current code doesn't check such case. >> The following patch can fix the issue. >> >> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c >> index abe74f7..e2ac5cc 100644 >> --- a/arch/x86/kvm/emulate.c >> +++ b/arch/x86/kvm/emulate.c >> @@ -1844,6 +1844,9 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt, >> int rc; >> struct segmented_address addr; >> >> + if ( !get_segment_selector(ctxt, VCPU_SREG_SS)) >> + return emulate_gp(ctxt, 0); >> + >> addr.ea = reg_read(ctxt, VCPU_REGS_RSP) & stack_mask(ctxt); >> addr.seg = VCPU_SREG_SS; >> rc = segmented_read(ctxt, addr, dest, len); > -- Best regards Tianyu Lan
Powered by blists - more mailing lists