mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Al Viro
parent
ec1ab0abde
commit
2b1c6bd77d
@@ -356,40 +356,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ustat compatibility */
|
||||
struct ustat32 {
|
||||
compat_daddr_t f_tfree;
|
||||
compat_ino_t f_tinode;
|
||||
char f_fname[6];
|
||||
char f_fpack[6];
|
||||
};
|
||||
|
||||
extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
|
||||
|
||||
SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32)
|
||||
{
|
||||
int err;
|
||||
struct ustat tmp;
|
||||
struct ustat32 tmp32;
|
||||
mm_segment_t old_fs = get_fs();
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
err = sys_ustat(dev, (struct ustat __user *)&tmp);
|
||||
set_fs(old_fs);
|
||||
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
memset(&tmp32, 0, sizeof(struct ustat32));
|
||||
tmp32.f_tfree = tmp.f_tfree;
|
||||
tmp32.f_tinode = tmp.f_tinode;
|
||||
|
||||
err = copy_to_user(ubuf32, &tmp32, sizeof(struct ustat32)) ? -EFAULT : 0;
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
|
||||
compat_off_t __user *, offset, s32, count)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user