From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751865AbdB1S02 (ORCPT ); Tue, 28 Feb 2017 13:26:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdB1SZc (ORCPT ); Tue, 28 Feb 2017 13:25:32 -0500 Subject: Re: [PATCH 1/2] vfs: implement fchmodat2() syscall To: Greg Kurz , viro@zeniv.linux.org.uk References: <148830142269.7103.7429913851447595016.stgit@bahia> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <99466bd0-48f2-1594-5392-5e6191d56ffa@redhat.com> Date: Tue, 28 Feb 2017 12:23:01 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <148830142269.7103.7429913851447595016.stgit@bahia> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CQijQmrT4KWmhtC9CbOx441PlahSdsNai" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Feb 2017 18:23:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CQijQmrT4KWmhtC9CbOx441PlahSdsNai Content-Type: multipart/mixed; boundary="IfQqJ7poROhBroC7AJfCLfvqMv91Arnc9"; protected-headers="v1" From: Eric Blake To: Greg Kurz , viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <99466bd0-48f2-1594-5392-5e6191d56ffa@redhat.com> Subject: Re: [PATCH 1/2] vfs: implement fchmodat2() syscall References: <148830142269.7103.7429913851447595016.stgit@bahia> In-Reply-To: <148830142269.7103.7429913851447595016.stgit@bahia> --IfQqJ7poROhBroC7AJfCLfvqMv91Arnc9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/28/2017 11:03 AM, Greg Kurz wrote: > According to the POSIX.1-2008 manual page [1], the fchmodat() function = has > a flag argument which may be passed the following value: >=20 > AT_SYMLINK_NOFOLLOW > If path names a symbolic link, then the mode of the symbolic link i= s > changed. >=20 > and the following error may be returned: >=20 > [EOPNOTSUPP] > The AT_SYMLINK_NOFOLLOW bit is set in the flag argument, path names= a > symbolic link, and the system does not support changing the mode of= a > symbolic link. >=20 > The linux kernel doesn't support changing the mode of a symbolic link, = but > the current implementation doesn't even have a flag argument. It is the= n > up to userspace to deal with that. Unfortunately, it is impossible to > implement the POSIX behavior in a race-free manner. >=20 > This patch introduces a new fchmodat2() syscall with a flag argument to= > address the issue. >=20 > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.htm= l >=20 > Signed-off-by: Greg Kurz > --- Might also be worth mentioning that this patch is required in order to solve CVE-2016-9602, per discussion at https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg06089.html > +++ b/include/linux/syscalls.h > @@ -775,6 +775,8 @@ asmlinkage long sys_futimesat(int dfd, const char _= _user *filename, > asmlinkage long sys_faccessat(int dfd, const char __user *filename, in= t mode); > asmlinkage long sys_fchmodat(int dfd, const char __user * filename, > umode_t mode); > +asmlinkage long sys_fchmodat2(int dfd, const char __user *filename, > + umode_t mode, int flag); > asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid= _t user, > gid_t group, int flag); Is the indentation off here? Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --IfQqJ7poROhBroC7AJfCLfvqMv91Arnc9-- --CQijQmrT4KWmhtC9CbOx441PlahSdsNai Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYtcAFAAoJEKeha0olJ0NqAasH/jCcOgOkg6v9JCifJbjTHAyI 9WIuTP53M6B8LapuVpM2wP1QXKEYIZo5qb6QYnBO5lrOXQo4IWwAfLrt5Gvq/t7R TGnATRPkq+l0YiTOm1L678hFl5iR5OLY/1u1rAqorjYqvgHIERFDqS3pxMQ1X3GT OcYJnX41vfppvBJPSPzgXvzLJsxFzElgNP/SLzSmtVQiq4JTOBB9dIK+dZljZieY hPRjFVrJ10ZSAMoUazXAIaHFAnXEms4xx9j7kxdf5GXTOEfK1FePI8Cl78qjonNs lxa/F9YDQ5oHD04P7LYvAo2H2jw1yV/ZknLCC2v2b+godMCAh+Hh14FwL2So12Y= =93/w -----END PGP SIGNATURE----- --CQijQmrT4KWmhtC9CbOx441PlahSdsNai--