From: "Ross Maxfield" Subject: [PATCH] Misaligned IO reads Date: Mon, 31 Jul 2006 15:29:33 -0600 Message-ID: <44CE218D.DD28.00D3.0@novell.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartB99C3E2D.0__=" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__PartB99C3E2D.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Keir, This patch fixes a data corruption bug in hvm_pio_assist() of xen/arch/x86/hvm/io.c. When the OVERLAP flag is set and the guest is running in real-mode regs->es is used in the generation of the destination address passed to hvm_copy(). regs->es, however, has not been initialized and bad happens. Since __vmread() must be called to obtain regs->es to remedy the bug, this patch instead calls __vmread to obtain the GUEST_LINEAR_ADDRESS which removes the need to check if the guest is in real-mode and hence also the need to adjust addr. Since this block of code is executed so rarely, there is no measurable performance impact using this fix for real or protected mode guests. Signed of by: Ross Maxfield --=__PartB99C3E2D.0__= Content-Type: application/octet-stream; name="hvm_pio_assist.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="hvm_pio_assist.diff" LS0tIGEveGVuL2FyY2gveDg2L2h2bS9pby5jICAgICBTYXQgSnVsIDI5IDE0OjA1OjU5IDIwMDYg KzAxMDAKKysrIGIveGVuL2FyY2gveDg2L2h2bS9pby5jICAgICBNb24gSnVsIDMxIDE1OjIxOjAx IDIwMDYgLTA2MDAKQEAgLTM3NCwxMiArMzc0LDkgQEAgc3RhdGljIHZvaWQgaHZtX3Bpb19hc3Np c3Qoc3RydWN0IGNwdV91cwogICAgICAgICAgICAgcmVncy0+ZWRpICs9IHNpZ24gKiBwLT5jb3Vu dCAqIHAtPnNpemU7CiAgICAgICAgICAgICBpZiAoIHBpb19vcHAtPmZsYWdzICYgT1ZFUkxBUCAp CiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdW5zaWduZWQgbG9uZyBhZGRyID0gcmVn cy0+ZWRpOwotICAgICAgICAgICAgICAgIGlmIChodm1fcmVhbG1vZGUoY3VycmVudCkpCi0gICAg ICAgICAgICAgICAgICAgIGFkZHIgKz0gcmVncy0+ZXMgPDwgNDsKLSAgICAgICAgICAgICAgICBp ZiAoc2lnbiA+IDApCi0gICAgICAgICAgICAgICAgICAgIGFkZHIgLT0gcC0+c2l6ZTsKLSAgICAg ICAgICAgICAgICBodm1fY29weSgmcC0+dS5kYXRhLCBhZGRyLCBwLT5zaXplLCBIVk1fQ09QWV9P VVQpOworICAgICAgICAgICAgICAgIHVuc2lnbmVkIGxvbmcgYWRkcjsKKyAgICAgICAgICAgICAg ICBfX3ZtcmVhZChHVUVTVF9MSU5FQVJfQUREUkVTUywgJmFkZHIpOworICAgICAgICAgICAgICAg IGh2bV9jb3B5KCZw4oCRPnUuZGF0YSwgYWRkciwgcOKAkT5zaXplLCBIVk1fQ09QWV9PVVQpOwog ICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGVsc2UgLyogcC0+ZGlyID09IElPUkVR X1dSSVRFICovCgo= --=__PartB99C3E2D.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartB99C3E2D.0__=--