From owner-svn-src-all@FreeBSD.ORG Sun May 24 19:21:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EBA51065690; Sun, 24 May 2009 19:21:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C0AA8FC0C; Sun, 24 May 2009 19:21:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OJLn5u098233; Sun, 24 May 2009 19:21:49 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OJLnda098232; Sun, 24 May 2009 19:21:49 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905241921.n4OJLnda098232@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 19:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192694 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 19:21:50 -0000 Author: trasz Date: Sun May 24 19:21:49 2009 New Revision: 192694 URL: http://svn.freebsd.org/changeset/base/192694 Log: Don't allow non-owner to set SUID bit on a file. It doesn't make any difference now, but in NFSv4 ACLs, there is write_acl permission, which also affects mode changes. Reviewed by: pjd Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun May 24 18:49:53 2009 (r192693) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun May 24 19:21:49 2009 (r192694) @@ -302,6 +302,14 @@ secpolicy_setid_setsticky_clear(struct v if (error) return (error); } + /* + * Deny setting setuid if we are not the file owner. + */ + if ((vap->va_mode & S_ISUID) && ovap->va_uid != cred->cr_uid) { + error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0); + if (error) + return (error); + } return (0); }