diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-02 11:34:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-02 11:34:06 -0500 |
commit | 14cc0b55b70e297a4b5411733d58c6cdc2d7f1be (patch) | |
tree | 2aa0fe9d267d5ae1ab1b47a67d31fbbc1dbf928e /fs | |
parent | 3cfb07743a5bffecba83f0da26444e85c0a9bfbb (diff) | |
parent | 0e803bafbb7d1b8a9031104f1a982a01b45da4c6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal/compat fixes from Al Viro:
"Fixes for several regressions introduced in the last signal.git pile,
along with fixing bugs in truncate and ftruncate compat (on just about
anything biarch at least one of those two had been done wrong)."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
compat: restore timerfd settime and gettime compat syscalls
[regression] braino in "sparc: convert to ksignal"
fix compat truncate/ftruncate
switch lseek to COMPAT_SYSCALL_DEFINE
lseek() and truncate() on sparc really need sign extension
Diffstat (limited to 'fs')
-rw-r--r-- | fs/open.c | 15 | ||||
-rw-r--r-- | fs/read_write.c | 9 | ||||
-rw-r--r-- | fs/timerfd.c | 10 |
3 files changed, 28 insertions, 6 deletions
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/fs_struct.h> | 30 | #include <linux/fs_struct.h> |
31 | #include <linux/ima.h> | 31 | #include <linux/ima.h> |
32 | #include <linux/dnotify.h> | 32 | #include <linux/dnotify.h> |
33 | #include <linux/compat.h> | ||
33 | 34 | ||
34 | #include "internal.h" | 35 | #include "internal.h" |
35 | 36 | ||
@@ -140,6 +141,13 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) | |||
140 | return do_sys_truncate(path, length); | 141 | return do_sys_truncate(path, length); |
141 | } | 142 | } |
142 | 143 | ||
144 | #ifdef CONFIG_COMPAT | ||
145 | COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length) | ||
146 | { | ||
147 | return do_sys_truncate(path, length); | ||
148 | } | ||
149 | #endif | ||
150 | |||
143 | static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | 151 | static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) |
144 | { | 152 | { |
145 | struct inode *inode; | 153 | struct inode *inode; |
@@ -195,6 +203,13 @@ SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) | |||
195 | return ret; | 203 | return ret; |
196 | } | 204 | } |
197 | 205 | ||
206 | #ifdef CONFIG_COMPAT | ||
207 | COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length) | ||
208 | { | ||
209 | return do_sys_ftruncate(fd, length, 1); | ||
210 | } | ||
211 | #endif | ||
212 | |||
198 | /* LFS versions of truncate are only needed on 32 bit machines */ | 213 | /* LFS versions of truncate are only needed on 32 bit machines */ |
199 | #if BITS_PER_LONG == 32 | 214 | #if BITS_PER_LONG == 32 |
200 | SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) | 215 | SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) |
diff --git a/fs/read_write.c b/fs/read_write.c index 3ae6dbe828bf..a698eff457fb 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
16 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
17 | #include <linux/splice.h> | 17 | #include <linux/splice.h> |
18 | #include <linux/compat.h> | ||
18 | #include "read_write.h" | 19 | #include "read_write.h" |
19 | 20 | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
@@ -247,6 +248,13 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) | |||
247 | return retval; | 248 | return retval; |
248 | } | 249 | } |
249 | 250 | ||
251 | #ifdef CONFIG_COMPAT | ||
252 | COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned int, whence) | ||
253 | { | ||
254 | return sys_lseek(fd, offset, whence); | ||
255 | } | ||
256 | #endif | ||
257 | |||
250 | #ifdef __ARCH_WANT_SYS_LLSEEK | 258 | #ifdef __ARCH_WANT_SYS_LLSEEK |
251 | SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, | 259 | SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, |
252 | unsigned long, offset_low, loff_t __user *, result, | 260 | unsigned long, offset_low, loff_t __user *, result, |
@@ -278,7 +286,6 @@ out_putf: | |||
278 | } | 286 | } |
279 | #endif | 287 | #endif |
280 | 288 | ||
281 | |||
282 | /* | 289 | /* |
283 | * rw_verify_area doesn't like huge counts. We limit | 290 | * rw_verify_area doesn't like huge counts. We limit |
284 | * them to something that fits in "int" so that others | 291 | * them to something that fits in "int" so that others |
diff --git a/fs/timerfd.c b/fs/timerfd.c index 0e606b12a59d..32b644f03690 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -383,10 +383,10 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) | |||
383 | return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0; | 383 | return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0; |
384 | } | 384 | } |
385 | 385 | ||
386 | #ifdef COMPAT | 386 | #ifdef CONFIG_COMPAT |
387 | COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, | 387 | COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, |
388 | const struct itimerspec __user *, utmr, | 388 | const struct compat_itimerspec __user *, utmr, |
389 | struct itimerspec __user *, otmr) | 389 | struct compat_itimerspec __user *, otmr) |
390 | { | 390 | { |
391 | struct itimerspec new, old; | 391 | struct itimerspec new, old; |
392 | int ret; | 392 | int ret; |
@@ -402,12 +402,12 @@ COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, | |||
402 | } | 402 | } |
403 | 403 | ||
404 | COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, | 404 | COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, |
405 | struct itimerspec __user *, otmr) | 405 | struct compat_itimerspec __user *, otmr) |
406 | { | 406 | { |
407 | struct itimerspec kotmr; | 407 | struct itimerspec kotmr; |
408 | int ret = do_timerfd_gettime(ufd, &kotmr); | 408 | int ret = do_timerfd_gettime(ufd, &kotmr); |
409 | if (ret) | 409 | if (ret) |
410 | return ret; | 410 | return ret; |
411 | return put_compat_itimerspec(otmr, &t) ? -EFAULT: 0; | 411 | return put_compat_itimerspec(otmr, &kotmr) ? -EFAULT: 0; |
412 | } | 412 | } |
413 | #endif | 413 | #endif |