diff options
author | Christoph Hellwig <hch@lst.de> | 2008-11-28 04:09:09 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-03-27 14:43:57 -0400 |
commit | 2b1c6bd77d4e6a727ffac8630cd154b2144b751a (patch) | |
tree | ffc4237dbeed66492124ef2ccecf48db0767531a /arch/mips/kernel | |
parent | ec1ab0abde0af586a59541ad71841f022dcac3e7 (diff) |
generic compat_sys_ustat
Due to a different size of ino_t ustat needs a compat handler, but
currently only x86 and mips provide one. Add a generic compat_sys_ustat
and switch all architectures over to it. Instead of doing various
user copy hacks compat_sys_ustat just reimplements sys_ustat as
it's trivial. This was suggested by Arnd Bergmann.
Found by Eric Sandeen when running xfstests/017 on ppc64, which causes
stack smashing warnings on RHEL/Fedora due to the too large amount of
data writen by the syscall.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/linux32.c | 34 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-n32.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-o32.S | 2 |
3 files changed, 2 insertions, 36 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 1a86f84fa947..784859cedef7 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -356,40 +356,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality) | |||
356 | return ret; | 356 | return ret; |
357 | } | 357 | } |
358 | 358 | ||
359 | /* ustat compatibility */ | ||
360 | struct ustat32 { | ||
361 | compat_daddr_t f_tfree; | ||
362 | compat_ino_t f_tinode; | ||
363 | char f_fname[6]; | ||
364 | char f_fpack[6]; | ||
365 | }; | ||
366 | |||
367 | extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf); | ||
368 | |||
369 | SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32) | ||
370 | { | ||
371 | int err; | ||
372 | struct ustat tmp; | ||
373 | struct ustat32 tmp32; | ||
374 | mm_segment_t old_fs = get_fs(); | ||
375 | |||
376 | set_fs(KERNEL_DS); | ||
377 | err = sys_ustat(dev, (struct ustat __user *)&tmp); | ||
378 | set_fs(old_fs); | ||
379 | |||
380 | if (err) | ||
381 | goto out; | ||
382 | |||
383 | memset(&tmp32, 0, sizeof(struct ustat32)); | ||
384 | tmp32.f_tfree = tmp.f_tfree; | ||
385 | tmp32.f_tinode = tmp.f_tinode; | ||
386 | |||
387 | err = copy_to_user(ubuf32, &tmp32, sizeof(struct ustat32)) ? -EFAULT : 0; | ||
388 | |||
389 | out: | ||
390 | return err; | ||
391 | } | ||
392 | |||
393 | SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, | 359 | SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, |
394 | compat_off_t __user *, offset, s32, count) | 360 | compat_off_t __user *, offset, s32, count) |
395 | { | 361 | { |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 7438e92f8a01..f61d6b0e5731 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -253,7 +253,7 @@ EXPORT(sysn32_call_table) | |||
253 | PTR compat_sys_utime /* 6130 */ | 253 | PTR compat_sys_utime /* 6130 */ |
254 | PTR sys_mknod | 254 | PTR sys_mknod |
255 | PTR sys_32_personality | 255 | PTR sys_32_personality |
256 | PTR sys_32_ustat | 256 | PTR compat_sys_ustat |
257 | PTR compat_sys_statfs | 257 | PTR compat_sys_statfs |
258 | PTR compat_sys_fstatfs /* 6135 */ | 258 | PTR compat_sys_fstatfs /* 6135 */ |
259 | PTR sys_sysfs | 259 | PTR sys_sysfs |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index b0fef4ff9827..60997f1f69d4 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -265,7 +265,7 @@ sys_call_table: | |||
265 | PTR sys_olduname | 265 | PTR sys_olduname |
266 | PTR sys_umask /* 4060 */ | 266 | PTR sys_umask /* 4060 */ |
267 | PTR sys_chroot | 267 | PTR sys_chroot |
268 | PTR sys_32_ustat | 268 | PTR compat_sys_ustat |
269 | PTR sys_dup2 | 269 | PTR sys_dup2 |
270 | PTR sys_getppid | 270 | PTR sys_getppid |
271 | PTR sys_getpgrp /* 4065 */ | 271 | PTR sys_getpgrp /* 4065 */ |