diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-18 16:22:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-18 16:22:59 -0400 |
commit | 385910f2b275a636238f70844f1b6da9fda6f2da (patch) | |
tree | 284f31a897d1ae9d02598ccb2f1d108ba62a079c /fs | |
parent | 0a489cb3b6a7b277030cdbc97c2c65905db94536 (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.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -332,6 +332,7 @@ out: | |||
332 | asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) | 332 | asmlinkage 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) | |||
346 | asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) | 347 | asmlinkage 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 | ||
1098 | asmlinkage long sys_open(const char __user *filename, int flags, int mode) | 1100 | asmlinkage 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 | } |
1105 | EXPORT_SYMBOL_GPL(sys_open); | 1112 | EXPORT_SYMBOL_GPL(sys_open); |
1106 | 1113 | ||
1107 | asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, | 1114 | asmlinkage 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 | } |
1115 | EXPORT_SYMBOL_GPL(sys_openat); | 1127 | EXPORT_SYMBOL_GPL(sys_openat); |
1116 | 1128 | ||