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: <20070220.399.99798900@egw.corp.redhat.com>
Date:	Tue, 20 Feb 2007 17:05:33 -0500
From:	"Chris Snook" <csnook@...hat.com>
To:	"Chris Snook" <csnook@...hat.com>, linux-kernel@...r.kernel.org
Cc:	akpm@...l.org, dhowells@...hat.com, jeffpc@...efsipek.net,
	csnook@...hat.com
Subject: [PATCH 2/2] use use SEEK_MAX to validate user lseek arguments

From: Chris Snook <csnook@...hat.com>

Add SEEK_MAX and use it to validate lseek arguments from userspace.

Signed-off-by: Chris Snook <csnook@...hat.com>
--
diff -urp b/fs/read_write.c c/fs/read_write.c
--- b/fs/read_write.c	2007-02-20 16:48:39.000000000 -0500
+++ c/fs/read_write.c	2007-02-20 16:55:46.000000000 -0500
@@ -139,7 +139,7 @@ asmlinkage off_t sys_lseek(unsigned int
 		goto bad;

 	retval = -EINVAL;
-	if (origin <= 2) {
+	if (origin <= SEEK_MAX) {
 		loff_t res = vfs_llseek(file, offset, origin);
 		retval = res;
 		if (res != (loff_t)retval)
@@ -166,7 +166,7 @@ asmlinkage long sys_llseek(unsigned int
 		goto bad;

 	retval = -EINVAL;
-	if (origin > 2)
+	if (origin > SEEK_MAX)
 		goto out_putf;

 	offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,
diff -urp b/include/linux/fs.h c/include/linux/fs.h
--- b/include/linux/fs.h	2007-02-20 14:49:46.000000000 -0500
+++ c/include/linux/fs.h	2007-02-20 16:54:30.000000000 -0500
@@ -30,6 +30,7 @@
 #define SEEK_SET	0	/* seek relative to beginning of file */
 #define SEEK_CUR	1	/* seek relative to current file position */
 #define SEEK_END	2	/* seek relative to end of file */
+#define SEEK_MAX	SEEK_END

 /* And dynamically-tunable limits and defaults: */
 struct files_stat_struct {

-
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