From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KgeYc-00018P-CH for qemu-devel@nongnu.org; Fri, 19 Sep 2008 07:53:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KgeYa-00015s-QL for qemu-devel@nongnu.org; Fri, 19 Sep 2008 07:53:53 -0400 Received: from [199.232.76.173] (port=35438 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KgeYa-00015h-Ie for qemu-devel@nongnu.org; Fri, 19 Sep 2008 07:53:52 -0400 Received: from ey-out-1920.google.com ([74.125.78.145]:60146) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KgeYa-0000pF-1E for qemu-devel@nongnu.org; Fri, 19 Sep 2008 07:53:52 -0400 Received: by ey-out-1920.google.com with SMTP id 4so106429eyk.4 for ; Fri, 19 Sep 2008 04:53:48 -0700 (PDT) Date: Fri, 19 Sep 2008 14:54:33 +0300 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] [PATCH] uselib, mincore and readahead syscalls Message-ID: <20080919115432.GB5346@localhost.localdomain> References: <20080917194542.GC21187@kos.to> <20080919080534.GB18614@localhost.localdomain> <20080919113713.GB9668@kos.to> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QKdGvSO+nmPlgiQ/" Content-Disposition: inline In-Reply-To: <20080919113713.GB9668@kos.to> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --QKdGvSO+nmPlgiQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 19, 2008 at 02:37:13PM +0300, Riku Voipio wrote: > On Fri, Sep 19, 2008 at 11:05:35AM +0300, Kirill A. Shutemov wrote: > > On Wed, Sep 17, 2008 at 10:45:42PM +0300, Riku Voipio wrote: > > > These have been carried in Debian since forever. Added lock_user() > > > calls for mincore before submitting, I'm not sure if that's the corre= ct > > > way? > > >=20 > > > Signed-off-by: Riku Voipio >=20 > > I think this patch should be splited by syscall. >=20 > Yes, but expecting that these patches as going to be ignored I didn't > want to put too much effort in them.. >=20 > > > Index: trunk/linux-user/syscall.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > --- trunk.orig/linux-user/syscall.c 2008-09-17 20:07:40.000000000 +03= 00 > > > +++ trunk/linux-user/syscall.c 2008-09-17 21:43:47.000000000 +0300 > > > @@ -276,6 +276,7 @@ > > > extern int setfsuid(int); > > > extern int setfsgid(int); > > > extern int setgroups(int, gid_t *); > > > +extern int uselib(const char*); >=20 > > Probably, we should use _syscall1 macros instead. >=20 > Why? More specifically, in which cases should we use _syscall macros > and which cases the libc versions? I don't see much logic in the current > mix of both being used in syscall.c Sorry. I'm wrong. >=20 > > > #define ERRNO_TABLE_SIZE 1200 > > > =20 > > > @@ -4226,7 +4227,13 @@ > > > #endif > > > #ifdef TARGET_NR_uselib > > > case TARGET_NR_uselib: > > > - goto unimplemented; > > > + { > > > + if(!(p =3D lock_user_string(arg1))) > > > + goto efault; > > > + ret =3D get_errno(uselib(path(p))); > > > + unlock_user(p, arg1, 0); > > > + } > > > + break; > > > #endif > > > #ifdef TARGET_NR_swapon > > > case TARGET_NR_swapon: > > > @@ -5512,7 +5519,18 @@ > > > goto unimplemented; > > > #ifdef TARGET_NR_mincore > > > case TARGET_NR_mincore: > > > - goto unimplemented; > > > + { > > > + void *a; > > > + if (!(a =3D lock_user(VERIFY_READ, arg1,arg2, 0))) > > > + goto efault; > > > + if (!(p =3D lock_user_string(arg3))) > > > + goto mincore_fail; > > > + ret =3D get_errno(mincore((void*)a, (size_t)arg2, (unsigned= char*)p)); > >=20 > > Type casting is unneeded here. >=20 > Will fix >=20 > > > + unlock_user(p, arg3, ret); > > > + mincore_fail: > > > + unlock_user(a, arg1, 0); >=20 > > You should set ret here. >=20 > Will fix >=20 > > > + } > > > + break; > > > #endif > > > #ifdef TARGET_NR_madvise > > > case TARGET_NR_madvise: > > > @@ -5652,7 +5670,8 @@ > > > break; > > > #ifdef TARGET_NR_readahead > > > case TARGET_NR_readahead: > > > - goto unimplemented; > > > + ret =3D get_errno(readahead((int)arg1, (off64_t)arg2, (size_= t)arg3)); > >=20 > > Type casting is unneeded here. >=20 > Will fix >=20 > > > + break; > > > #endif > > > #ifdef TARGET_NR_setxattr > > > case TARGET_NR_setxattr: > >=20 > > --=20 > > Regards, Kirill A. Shutemov > > + Belarus, Minsk > > + ALT Linux Team, http://www.altlinux.com/ >=20 >=20 >=20 > --=20 > "rm -rf" only sounds scary if you don't have backups >=20 >=20 --=20 Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/ --QKdGvSO+nmPlgiQ/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkjTkvgACgkQbWYnhzC5v6pN9wCfTVs18gqZe7NDJ5XNz0F9uhcM XnYAn1N/l+6r574iJur/J6m1wsOCmJL9 =+nZQ -----END PGP SIGNATURE----- --QKdGvSO+nmPlgiQ/--