kern/181155: [PATCH] *access*(2) does not handle invalid amodes properly
Garrett Cooper
yaneurabeya at gmail.com
Fri Aug 9 02:00:01 UTC 2013
>Number: 181155
>Category: kern
>Synopsis: [PATCH] *access*(2) does not handle invalid amodes properly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Aug 09 02:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Garrett Cooper
>Release: 10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD fuji-current.local 10.0-CURRENT FreeBSD 10.0-CURRENT #12 c3d9dc4-dirty: Thu Aug 8 18:48:47 PDT 2013 root at fuji-current.local:/usr/obj/usr/src/sys/FUJI-NOCOMPAT i386
>Description:
Invalid access modes aren't properly handled in FreeBSD, so feeding in a valid like -1 won't result in a failed call.
>How-To-Repeat:
access("/", -1);
>Fix:
Patch attached with submission follows:
>From ceea6405b65a81a336b7c804dbe6c2dd0d84b72c Mon Sep 17 00:00:00 2001
From: Garrett Cooper <yanegomi at gmail.com>
Date: Thu, 8 Aug 2013 18:26:53 -0700
Subject: [PATCH] Handle invalid modes properly
Sponsored-by: EMC Isilon
---
sys/kern/vfs_syscalls.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index a004ea0..9350821 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2094,6 +2094,9 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
struct nameidata nd;
int error;
+ if (amode & ~(F_OK | R_OK | W_OK | X_OK))
+ return (EINVAL);
+
/*
* Create and modify a temporary credential instead of one that
* is potentially shared.
--
1.8.3.4
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list