lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1518b6425f7dbee3a666d45cb3be0e3d2487fbec.1266107200.git.matthltc@us.ibm.com>
Date:	Sat, 13 Feb 2010 16:27:46 -0800
From:	Matt Helsley <matthltc@...ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	Matt Helsley <matthltc@...ibm.com>,
	Davide Libenzi <davidel@...ilserver.org>
Subject: [RFC][PATCH 3/4] anon_inode fcntl() checks: report failure for fcntl(F_SETFL) on epoll

Report failure when userspace attempts to set unsupported flags
on epoll files with fcntl().

Signed-off-by: Matt Helsley <matthltc@...ibm.com>
Cc: Davide Libenzi <davidel@...ilserver.org>
---
 fs/eventpoll.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index bd056a5..ea46b92 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -671,8 +671,19 @@ static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait)
 	return pollflags != -1 ? pollflags : 0;
 }
 
+static int ep_eventpoll_check_flags(int flags)
+{
+	/* Check the EPOLL_* constant for consistency.  */
+	BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
+
+	if (flags & ~EPOLL_CLOEXEC)
+		return -EINVAL;
+	return 0;
+}
+
 /* File callbacks that implement the eventpoll file behaviour */
 static const struct file_operations eventpoll_fops = {
+	.check_flags    = ep_eventpoll_check_flags,
 	.release	= ep_eventpoll_release,
 	.poll		= ep_eventpoll_poll
 };
@@ -1190,11 +1201,9 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
 	int error;
 	struct eventpoll *ep = NULL;
 
-	/* Check the EPOLL_* constant for consistency.  */
-	BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
-
-	if (flags & ~EPOLL_CLOEXEC)
+	if (ep_eventpoll_check_flags(flags))
 		return -EINVAL;
+
 	/*
 	 * Create the internal data structure ("struct eventpoll").
 	 */
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ