From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kgaz2-0008R7-HW for qemu-devel@nongnu.org; Fri, 19 Sep 2008 04:04:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kgaz0-0008Pn-AF for qemu-devel@nongnu.org; Fri, 19 Sep 2008 04:04:55 -0400 Received: from [199.232.76.173] (port=43623 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kgayz-0008Pg-W5 for qemu-devel@nongnu.org; Fri, 19 Sep 2008 04:04:54 -0400 Received: from mx20.gnu.org ([199.232.41.8]:29379) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kgayz-0004jt-Bj for qemu-devel@nongnu.org; Fri, 19 Sep 2008 04:04:53 -0400 Received: from nf-out-0910.google.com ([64.233.182.186]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kgayy-0006nz-6l for qemu-devel@nongnu.org; Fri, 19 Sep 2008 04:04:52 -0400 Received: by nf-out-0910.google.com with SMTP id b2so157518nfb.12 for ; Fri, 19 Sep 2008 01:04:51 -0700 (PDT) Date: Fri, 19 Sep 2008 11:05:35 +0300 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] [PATCH] uselib, mincore and readahead syscalls Message-ID: <20080919080534.GB18614@localhost.localdomain> References: <20080917194542.GC21187@kos.to> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mojUlQ0s9EVzWg2t" Content-Disposition: inline In-Reply-To: <20080917194542.GC21187@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 --mojUlQ0s9EVzWg2t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 correct > way? >=20 > Signed-off-by: Riku Voipio >=20 > --=20 > "rm -rf" only sounds scary if you don't have backups I think this patch should be splited by syscall. > 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 +0300 > +++ 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*); Probably, we should use _syscall1 macros instead. > #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 cha= r*)p)); Type casting is unneeded here. > + unlock_user(p, arg3, ret); > + mincore_fail: > + unlock_user(a, arg1, 0); You should set ret here. > + } > + 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)ar= g3)); Type casting is unneeded here. > + break; > #endif > #ifdef TARGET_NR_setxattr > case TARGET_NR_setxattr: --=20 Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/ --mojUlQ0s9EVzWg2t 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) iEYEARECAAYFAkjTXU4ACgkQbWYnhzC5v6rcwQCeNAFNrgZJlknarc55779TbsBx ULgAn2Sw+Bei0ybsXBuF1XMp0HMor/PW =ljG2 -----END PGP SIGNATURE----- --mojUlQ0s9EVzWg2t--