aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-04-18 16:22:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-18 16:22:59 -0400
commit385910f2b275a636238f70844f1b6da9fda6f2da (patch)
tree284f31a897d1ae9d02598ccb2f1d108ba62a079c /fs
parent0a489cb3b6a7b277030cdbc97c2c65905db94536 (diff)
x86: be careful about tailcall breakage for sys_open[at] too
Came up through a quick grep for other cases similar to the ftruncate() one in commit 0a489cb3b6a7b277030cdbc97c2c65905db94536. Also, add a comment, so that people who read the code understand why we do what looks like a no-op. (Again, this won't actually matter to any sane user, since libc will save and restore the register gcc stomps on, but it's still wrong to stomp on it) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index 8279c65d3bef..53ec28c36777 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -332,6 +332,7 @@ out:
332asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 332asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
333{ 333{
334 long ret = do_sys_ftruncate(fd, length, 1); 334 long ret = do_sys_ftruncate(fd, length, 1);
335 /* avoid REGPARM breakage on x86: */
335 prevent_tail_call(ret); 336 prevent_tail_call(ret);
336 return ret; 337 return ret;
337} 338}
@@ -346,6 +347,7 @@ asmlinkage long sys_truncate64(const char __user * path, loff_t length)
346asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 347asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
347{ 348{
348 long ret = do_sys_ftruncate(fd, length, 0); 349 long ret = do_sys_ftruncate(fd, length, 0);
350 /* avoid REGPARM breakage on x86: */
349 prevent_tail_call(ret); 351 prevent_tail_call(ret);
350 return ret; 352 return ret;
351} 353}
@@ -1097,20 +1099,30 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
1097 1099
1098asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1100asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1099{ 1101{
1102 long ret;
1103
1100 if (force_o_largefile()) 1104 if (force_o_largefile())
1101 flags |= O_LARGEFILE; 1105 flags |= O_LARGEFILE;
1102 1106
1103 return do_sys_open(AT_FDCWD, filename, flags, mode); 1107 ret = do_sys_open(AT_FDCWD, filename, flags, mode);
1108 /* avoid REGPARM breakage on x86: */
1109 prevent_tail_call(ret);
1110 return ret;
1104} 1111}
1105EXPORT_SYMBOL_GPL(sys_open); 1112EXPORT_SYMBOL_GPL(sys_open);
1106 1113
1107asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1114asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1108 int mode) 1115 int mode)
1109{ 1116{
1117 long ret;
1118
1110 if (force_o_largefile()) 1119 if (force_o_largefile())
1111 flags |= O_LARGEFILE; 1120 flags |= O_LARGEFILE;
1112 1121
1113 return do_sys_open(dfd, filename, flags, mode); 1122 ret = do_sys_open(dfd, filename, flags, mode);
1123 /* avoid REGPARM breakage on x86: */
1124 prevent_tail_call(ret);
1125 return ret;
1114} 1126}
1115EXPORT_SYMBOL_GPL(sys_openat); 1127EXPORT_SYMBOL_GPL(sys_openat);
1116 1128