From owner-svn-src-user@FreeBSD.ORG Mon Sep 15 18:41:51 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94C735B1; Mon, 15 Sep 2014 18:41:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67EE3D82; Mon, 15 Sep 2014 18:41:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8FIfpuH042622; Mon, 15 Sep 2014 18:41:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8FIfp7c042620; Mon, 15 Sep 2014 18:41:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201409151841.s8FIfp7c042620@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 15 Sep 2014 18:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r271639 - in user/ngie/add-pjdfstest: lib/libc/sys sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2014 18:41:51 -0000 Author: ngie Date: Mon Sep 15 18:41:50 2014 New Revision: 271639 URL: http://svnweb.freebsd.org/changeset/base/271639 Log: Validate the mode argument in access, eaccess, and faccessat for optional POSIX compliance and to improve compatibility with Linux and NetBSD The issue was identified with lib/libc/sys/t_access:access_inval from NetBSD Update the manpage accordingly PR: 181155 Reviewed by: jilles (code), jmmv (code), wblock (manpage), wollman (code) MFC after: 4 weeks Phabric: D678 (code), D786 (manpage) Sponsored by: EMC / Isilon Storage Division Modified: user/ngie/add-pjdfstest/lib/libc/sys/access.2 user/ngie/add-pjdfstest/sys/kern/vfs_syscalls.c Modified: user/ngie/add-pjdfstest/lib/libc/sys/access.2 ============================================================================== --- user/ngie/add-pjdfstest/lib/libc/sys/access.2 Mon Sep 15 18:09:30 2014 (r271638) +++ user/ngie/add-pjdfstest/lib/libc/sys/access.2 Mon Sep 15 18:41:50 2014 (r271639) @@ -133,8 +133,16 @@ and .Sh RETURN VALUES .Rv -std .Sh ERRORS -Access to the file is denied if: +.Fn access , +.Fn eaccess , +or +.Fn faccessat +will fail if: .Bl -tag -width Er +.It Bq Er EINVAL +The value of the +.Fa mode +argument is invalid. .It Bq Er ENOTDIR A component of the path prefix is not a directory. .It Bq Er ENAMETOOLONG Modified: user/ngie/add-pjdfstest/sys/kern/vfs_syscalls.c ============================================================================== --- user/ngie/add-pjdfstest/sys/kern/vfs_syscalls.c Mon Sep 15 18:09:30 2014 (r271638) +++ user/ngie/add-pjdfstest/sys/kern/vfs_syscalls.c Mon Sep 15 18:41:50 2014 (r271639) @@ -2055,6 +2055,9 @@ kern_accessat(struct thread *td, int fd, cap_rights_t rights; int error; + if (amode != F_OK && (amode & ~(R_OK | W_OK | X_OK)) != 0) + return (EINVAL); + /* * Create and modify a temporary credential instead of one that * is potentially shared.