Subject: kern/22360: broken linux ftruncate64()
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ljocha@ics.muni.cz>
List: netbsd-bugs
Date: 08/05/2003 12:05:26
>Number: 22360
>Category: kern
>Synopsis: linux ftruncate64() is broken due to bad arg alignment
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Aug 05 10:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Ales Krenek
>Release: NetBSD 1.6.1
>Organization:
Masaryk University
>Environment:
System: NetBSD balkis.ics.muni.cz 1.6.1 NetBSD 1.6.1 (BALKIS) #4: Mon Aug 4 20:59:20 CEST 2003 ljocha@balkis.ics.muni.cz:/usr/src/sys/arch/i386/compile/BALKIS i386
Architecture: i386
Machine: i386
>Description:
The call used to return just EFBIG, apparently because linux does not align the `length' arg to 64b boundary
Most likely the problem also applies to -current, as well as other archs.
>How-To-Repeat:
any linux binary calling ftruncate64()
>Fix:
--- compat/linux/arch/i386/syscalls.master.orig Mon Aug 4 20:31:41 2003
+++ compat/linux/arch/i386/syscalls.master Mon Aug 4 20:34:07 2003
@@ -329,7 +329,7 @@
linux_off_t offset); }
193 STD { int linux_sys_truncate64(const char *path, \
off_t length); }
-194 NOARGS linux_ftruncate64 { int sys_ftruncate(int fd, \
+194 STD { int linux_sys_ftruncate64(int fd, \
off_t length); }
195 STD { int linux_sys_stat64(const char *path, \
struct linux_stat64 *sp); }
--- compat/linux/common/linux_file64.c.ljocha Mon Aug 4 20:17:30 2003
+++ compat/linux/common/linux_file64.c Mon Aug 4 20:59:02 2003
@@ -231,6 +231,22 @@
return sys_truncate(p, uap, retval);
}
+int
+linux_sys_ftruncate64(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_ftruncate64_args *uap = v;
+ struct sys_ftruncate_args fta;
+
+ SCARG(&fta,fd) = SCARG(uap,fd);
+ SCARG(&fta,length) = SCARG(uap,length);
+
+ return sys_ftruncate(p,&fta,retval);
+}
+
+
#if !defined(__m68k__)
static void bsd_to_linux_flock64 __P((struct linux_flock64 *,
const struct flock *));
>Release-Note:
>Audit-Trail:
>Unformatted: