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: <69d9c93fe958497f69102bea7c32cd048160b978.1266107200.git.matthltc@us.ibm.com>
Date:	Sat, 13 Feb 2010 16:27:44 -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 1/4] anon_inode fcntl() checks: report failure for fcntl(F_SETFL) on signalfd

anon_inode interfaces often do not support flags that can be set
by fcntl(). Right now using fcntl() to set these flags falsely
reports success for things like O_ASYNC (yet SIGIO is not delivered).

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

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

diff --git a/fs/signalfd.c b/fs/signalfd.c
index 1dabe4e..3016f3b 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -199,7 +199,19 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count,
 	return total ? total: ret;
 }
 
+static int signalfd_check_flags(int flags)
+{
+	/* Check the SFD_* constants for consistency.  */
+	BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
+	BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
+
+	if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
+		return -EINVAL;
+	return 0;
+}
+
 static const struct file_operations signalfd_fops = {
+	.check_flags    = signalfd_check_flags,
 	.release	= signalfd_release,
 	.poll		= signalfd_poll,
 	.read		= signalfd_read,
@@ -211,13 +223,8 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
 	sigset_t sigmask;
 	struct signalfd_ctx *ctx;
 
-	/* Check the SFD_* constants for consistency.  */
-	BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
-	BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
-
-	if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
+	if (signalfd_check_flags(flags))
 		return -EINVAL;
-
 	if (sizemask != sizeof(sigset_t) ||
 	    copy_from_user(&sigmask, user_mask, sizeof(sigmask)))
 		return -EINVAL;
-- 
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