aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoav Zach <yoav_zach@yahoo.com>2005-06-23 03:09:58 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:28 -0400
commitef3daeda7b58f046f94b26637d500354038d39f4 (patch)
treeacce3fb6a4ef5fa5c4e6962490d6f0db434fbad3
parent44e58a6a0bd604f46be9d808408a1cd880cc9b19 (diff)
[PATCH] Don't force O_LARGEFILE for 32 bit processes on ia64
In ia64 kernel, the O_LARGEFILE flag is forced when opening a file. This is problematic for execution of 32 bit processes, which are not largefile aware, either by SW emulation or by HW execution. For such processes, the problem is two-fold: 1) When trying to open a file that is larger than 4G the operation should fail, but it's not 2) Writing to offset larger than 4G should fail, but it's not The proposed patch takes advantage of the way 32 bit processes are identified in ia64 systems. Such processes have PER_LINUX32 for their personality. With the patch, the ia64 kernel will not enforce the O_LARGEFILE flag if the current process has PER_LINUX32 set. The behavior for all other architectures remains unchanged. Signed-off-by: Yoav Zach <yoav.zach@intel.com> Acked-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/open.c7
-rw-r--r--include/asm-ia64/fcntl.h2
-rw-r--r--include/linux/fcntl.h4
3 files changed, 10 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index 963bd81a44c8..2ebb72c1a876 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -21,6 +21,7 @@
21#include <linux/vfs.h> 21#include <linux/vfs.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/personality.h>
24#include <linux/pagemap.h> 25#include <linux/pagemap.h>
25#include <linux/syscalls.h> 26#include <linux/syscalls.h>
26 27
@@ -935,9 +936,9 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
935 char * tmp; 936 char * tmp;
936 int fd, error; 937 int fd, error;
937 938
938#if BITS_PER_LONG != 32 939 if (force_o_largefile())
939 flags |= O_LARGEFILE; 940 flags |= O_LARGEFILE;
940#endif 941
941 tmp = getname(filename); 942 tmp = getname(filename);
942 fd = PTR_ERR(tmp); 943 fd = PTR_ERR(tmp);
943 if (!IS_ERR(tmp)) { 944 if (!IS_ERR(tmp)) {
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h
index d193981bb1d8..c9f8d835d0cc 100644
--- a/include/asm-ia64/fcntl.h
+++ b/include/asm-ia64/fcntl.h
@@ -81,4 +81,6 @@ struct flock {
81 81
82#define F_LINUX_SPECIFIC_BASE 1024 82#define F_LINUX_SPECIFIC_BASE 1024
83 83
84#define force_o_largefile() ( ! (current->personality & PER_LINUX32) )
85
84#endif /* _ASM_IA64_FCNTL_H */ 86#endif /* _ASM_IA64_FCNTL_H */
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 704fb76b6334..8a7c82151de9 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -25,6 +25,10 @@
25 25
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27 27
28#ifndef force_o_largefile
29#define force_o_largefile() (BITS_PER_LONG != 32)
30#endif
31
28#if BITS_PER_LONG == 32 32#if BITS_PER_LONG == 32
29#define IS_GETLK32(cmd) ((cmd) == F_GETLK) 33#define IS_GETLK32(cmd) ((cmd) == F_GETLK)
30#define IS_SETLK32(cmd) ((cmd) == F_SETLK) 34#define IS_SETLK32(cmd) ((cmd) == F_SETLK)