Module Name: src
Committed By: dholland
Date: Sun Feb 27 23:06:41 UTC 2011
Modified Files:
src/sys/kern: vfs_syscalls.c
Log Message:
Check for bogus flags to access() up front. Otherwise we end up
calling VOP_ACCESS with flags 0 and something asserts deep in the
bowels of kauth. PR 44648 from Taylor Campbell. (I moved the check
earlier relative to the suggested patch.)
Pullup candidate.
To generate a diff of this commit:
cvs rdiff -u -r1.414 -r1.415 src/sys/kern/vfs_syscalls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.414 src/sys/kern/vfs_syscalls.c:1.415
--- src/sys/kern/vfs_syscalls.c:1.414 Thu Jan 13 07:25:50 2011
+++ src/sys/kern/vfs_syscalls.c Sun Feb 27 23:06:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.415 2011/02/27 23:06:40 dholland Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.415 2011/02/27 23:06:40 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -2484,6 +2484,11 @@
struct pathbuf *pb;
struct nameidata nd;
+ if ((SCARG(uap, flags) & ~(R_OK | W_OK | X_OK)) != 0) {
+ /* nonsense flags */
+ return EINVAL;
+ }
+
error = pathbuf_copyin(SCARG(uap, path), &pb);
if (error) {
return error;