From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= Subject: Re: xc_evtchn_status fails with EFAULT on HVM, the same on PV works Date: Fri, 13 Jan 2017 19:03:48 +0100 Message-ID: <20170113180348.GJ5268@mail-itl> References: <20170113173130.GI5268@mail-itl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2551569061307337343==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Andrew Cooper Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --===============2551569061307337343== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9/9WPmgm2v60RN0g" Content-Disposition: inline --9/9WPmgm2v60RN0g Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 13, 2017 at 05:38:42PM +0000, Andrew Cooper wrote: > On 13/01/17 17:31, Marek Marczykowski-G=C3=B3recki wrote: > > Hi, > > > > I have a strange problem - xc_evtchn_status fails when running in HVM, > > while exactly the same code (same kernel, same application etc) works > > fine in PV. I've narrowed it down to copy_from_guest call in > > common/event_channel.c, but no idea why it fails there. Xen version is > > 4.8.0. kernel is kernel-4.8.13-100.fc23. Any idea? >=20 > Which specific copy_from_guest() call? >=20 > Copying data out of a PV guest is different to copying out of a HVM > guest, but copy_from_guest() should cope properly with both. >=20 > However, to progress, it would help to know exactly which piece of data > is being requested. This one: https://github.com/xen-project/xen/blob/stable-4.8/xen/common/event_channel= =2Ec#L1104 case EVTCHNOP_status: { struct evtchn_status status; if ( copy_from_guest(&status, arg, 1) !=3D 0 ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return -EFAULT; rc =3D evtchn_status(&status); if ( !rc && __copy_to_guest(arg, &status, 1) ) rc =3D -EFAULT; break; The evtchn_status structure in application is on stack (local variable), but I think it shouldn't matter, as libxc copy it to a bounce buffer. --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? --9/9WPmgm2v60RN0g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJYeRaFAAoJENuP0xzK19cs87QH/i9uMYwjCjmvAK0Li7tJ/AYB 8q4xJYJYQfPeZTKvS9Pqdkz60hg+P3ht8ZWvU7eq6GJF7TqvecImmWS6v9k5h86W riNJhF+JJbCq2If9t0gGkx0CmVDM0yloUvnyfcNVrSm6+SaFZ86j7J+Y+FHz0jOy kzpLddarpFA4dnaCIuOEXalu54Cbv9Nc7Ujy30Z229UyOs64ZinKcgSPnesf+7ln N0hS+DGj5/5BSb76ZzI01syJ6YPdjyFYzk5HZUXH6rtr49DgcoTHaWFE1DAAGqS7 1XA06xARNJGZq9ceoSMdQhVRIa8EHl6W6dFu8AsBYAt8r6sQGPQ4P42ofk/3nTA= =Ygul -----END PGP SIGNATURE----- --9/9WPmgm2v60RN0g-- --===============2551569061307337343== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============2551569061307337343==--