Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+14 -2
+14 -2
fs/open.c
··· 332 332 asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 333 333 { 334 334 long ret = do_sys_ftruncate(fd, length, 1); 335 + /* avoid REGPARM breakage on x86: */ 335 336 prevent_tail_call(ret); 336 337 return ret; 337 338 } ··· 347 346 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 348 347 { 349 348 long ret = do_sys_ftruncate(fd, length, 0); 349 + /* avoid REGPARM breakage on x86: */ 350 350 prevent_tail_call(ret); 351 351 return ret; 352 352 } ··· 1099 1097 1100 1098 asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1101 1099 { 1100 + long ret; 1101 + 1102 1102 if (force_o_largefile()) 1103 1103 flags |= O_LARGEFILE; 1104 1104 1105 - return do_sys_open(AT_FDCWD, filename, flags, mode); 1105 + ret = do_sys_open(AT_FDCWD, filename, flags, mode); 1106 + /* avoid REGPARM breakage on x86: */ 1107 + prevent_tail_call(ret); 1108 + return ret; 1106 1109 } 1107 1110 EXPORT_SYMBOL_GPL(sys_open); 1108 1111 1109 1112 asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1110 1113 int mode) 1111 1114 { 1115 + long ret; 1116 + 1112 1117 if (force_o_largefile()) 1113 1118 flags |= O_LARGEFILE; 1114 1119 1115 - return do_sys_open(dfd, filename, flags, mode); 1120 + ret = do_sys_open(dfd, filename, flags, mode); 1121 + /* avoid REGPARM breakage on x86: */ 1122 + prevent_tail_call(ret); 1123 + return ret; 1116 1124 } 1117 1125 EXPORT_SYMBOL_GPL(sys_openat); 1118 1126