diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-08 17:46:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-08 17:46:04 -0500 |
commit | c4c5ff09872751eeb412e3e1af484955529426a1 (patch) | |
tree | 3eeaf398043ab6ff3fa7b1b43f30ba9c793dd48d /arch | |
parent | 92e840b84e75cd662d7e992711e1d073295c9b47 (diff) | |
parent | 87c319a2c3c2efd397281089b9cdce3050febeff (diff) |
Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
Pull tile architecture fixes from Chris Metcalf:
"This fixes the bug that Al Viro spotted with the compat llseek code.
I also fixed the compat syscall definitions to use the new syscall
define macros to properly sign-extend their arguments."
* 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
tile: properly use COMPAT_SYSCALL_DEFINEx
tile: work around bug in the generic sys_llseek
Diffstat (limited to 'arch')
-rw-r--r-- | arch/tile/include/asm/compat.h | 3 | ||||
-rw-r--r-- | arch/tile/kernel/compat.c | 42 |
2 files changed, 32 insertions, 13 deletions
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 001d418a8957..78f1f2ded86c 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -288,6 +288,9 @@ long compat_sys_sync_file_range2(int fd, unsigned int flags, | |||
288 | long compat_sys_fallocate(int fd, int mode, | 288 | long compat_sys_fallocate(int fd, int mode, |
289 | u32 offset_lo, u32 offset_hi, | 289 | u32 offset_lo, u32 offset_hi, |
290 | u32 len_lo, u32 len_hi); | 290 | u32 len_lo, u32 len_hi); |
291 | long compat_sys_llseek(unsigned int fd, unsigned int offset_high, | ||
292 | unsigned int offset_low, loff_t __user * result, | ||
293 | unsigned int origin); | ||
291 | 294 | ||
292 | /* Assembly trampoline to avoid clobbering r0. */ | 295 | /* Assembly trampoline to avoid clobbering r0. */ |
293 | long _compat_sys_rt_sigreturn(void); | 296 | long _compat_sys_rt_sigreturn(void); |
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index 7f72401b4f45..6ea4cdb3c6a0 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c | |||
@@ -32,50 +32,65 @@ | |||
32 | * adapt the usual convention. | 32 | * adapt the usual convention. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high) | 35 | COMPAT_SYSCALL_DEFINE4(truncate64, char __user *, filename, u32, dummy, |
36 | u32, low, u32, high) | ||
36 | { | 37 | { |
37 | return sys_truncate(filename, ((loff_t)high << 32) | low); | 38 | return sys_truncate(filename, ((loff_t)high << 32) | low); |
38 | } | 39 | } |
39 | 40 | ||
40 | long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high) | 41 | COMPAT_SYSCALL_DEFINE4(ftruncate64, unsigned int, fd, u32, dummy, |
42 | u32, low, u32, high) | ||
41 | { | 43 | { |
42 | return sys_ftruncate(fd, ((loff_t)high << 32) | low); | 44 | return sys_ftruncate(fd, ((loff_t)high << 32) | low); |
43 | } | 45 | } |
44 | 46 | ||
45 | long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, | 47 | COMPAT_SYSCALL_DEFINE6(pread64, unsigned int, fd, char __user *, ubuf, |
46 | u32 dummy, u32 low, u32 high) | 48 | size_t, count, u32, dummy, u32, low, u32, high) |
47 | { | 49 | { |
48 | return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low); | 50 | return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low); |
49 | } | 51 | } |
50 | 52 | ||
51 | long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count, | 53 | COMPAT_SYSCALL_DEFINE6(pwrite64, unsigned int, fd, char __user *, ubuf, |
52 | u32 dummy, u32 low, u32 high) | 54 | size_t, count, u32, dummy, u32, low, u32, high) |
53 | { | 55 | { |
54 | return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); | 56 | return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); |
55 | } | 57 | } |
56 | 58 | ||
57 | long compat_sys_lookup_dcookie(u32 low, u32 high, char __user *buf, size_t len) | 59 | COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, low, u32, high, |
60 | char __user *, buf, size_t, len) | ||
58 | { | 61 | { |
59 | return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len); | 62 | return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len); |
60 | } | 63 | } |
61 | 64 | ||
62 | long compat_sys_sync_file_range2(int fd, unsigned int flags, | 65 | COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags, |
63 | u32 offset_lo, u32 offset_hi, | 66 | u32, offset_lo, u32, offset_hi, |
64 | u32 nbytes_lo, u32 nbytes_hi) | 67 | u32, nbytes_lo, u32, nbytes_hi) |
65 | { | 68 | { |
66 | return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo, | 69 | return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo, |
67 | ((loff_t)nbytes_hi << 32) | nbytes_lo, | 70 | ((loff_t)nbytes_hi << 32) | nbytes_lo, |
68 | flags); | 71 | flags); |
69 | } | 72 | } |
70 | 73 | ||
71 | long compat_sys_fallocate(int fd, int mode, | 74 | COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode, |
72 | u32 offset_lo, u32 offset_hi, | 75 | u32, offset_lo, u32, offset_hi, |
73 | u32 len_lo, u32 len_hi) | 76 | u32, len_lo, u32, len_hi) |
74 | { | 77 | { |
75 | return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo, | 78 | return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo, |
76 | ((loff_t)len_hi << 32) | len_lo); | 79 | ((loff_t)len_hi << 32) | len_lo); |
77 | } | 80 | } |
78 | 81 | ||
82 | /* | ||
83 | * Avoid bug in generic sys_llseek() that specifies offset_high and | ||
84 | * offset_low as "unsigned long", thus making it possible to pass | ||
85 | * a sign-extended high 32 bits in offset_low. | ||
86 | */ | ||
87 | COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, | ||
88 | unsigned int, offset_low, loff_t __user *, result, | ||
89 | unsigned int, origin) | ||
90 | { | ||
91 | return sys_llseek(fd, offset_high, offset_low, result, origin); | ||
92 | } | ||
93 | |||
79 | /* Provide the compat syscall number to call mapping. */ | 94 | /* Provide the compat syscall number to call mapping. */ |
80 | #undef __SYSCALL | 95 | #undef __SYSCALL |
81 | #define __SYSCALL(nr, call) [nr] = (call), | 96 | #define __SYSCALL(nr, call) [nr] = (call), |
@@ -83,6 +98,7 @@ long compat_sys_fallocate(int fd, int mode, | |||
83 | /* See comments in sys.c */ | 98 | /* See comments in sys.c */ |
84 | #define compat_sys_fadvise64_64 sys32_fadvise64_64 | 99 | #define compat_sys_fadvise64_64 sys32_fadvise64_64 |
85 | #define compat_sys_readahead sys32_readahead | 100 | #define compat_sys_readahead sys32_readahead |
101 | #define sys_llseek compat_sys_llseek | ||
86 | 102 | ||
87 | /* Call the assembly trampolines where necessary. */ | 103 | /* Call the assembly trampolines where necessary. */ |
88 | #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn | 104 | #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn |