Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58b7825b authored by Gleb Natapov's avatar Gleb Natapov Committed by Marcelo Tosatti
Browse files

KVM: emulator: fix real mode segment checks in address linearization



In real mode CS register is writable, so do not #GP on write.

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 0b26b588
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -677,8 +677,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
						addr.seg);
		if (!usable)
			goto bad;
		/* code segment or read-only data segment */
		if (((desc.type & 8) || !(desc.type & 2)) && write)
		/* code segment in protected mode or read-only data segment */
		if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8))
					|| !(desc.type & 2)) && write)
			goto bad;
		/* unreadable code segment */
		if (!fetch && (desc.type & 8) && !(desc.type & 2))