From owner-freebsd-current@FreeBSD.ORG Sun Apr 8 19:38:21 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FF1316A403; Sun, 8 Apr 2007 19:38:21 +0000 (UTC) (envelope-from davidt@yadt.co.uk) Received: from outcold.yadt.co.uk (outcold.yadt.co.uk [81.187.204.178]) by mx1.freebsd.org (Postfix) with ESMTP id B2C9D13C459; Sun, 8 Apr 2007 19:38:20 +0000 (UTC) (envelope-from davidt@yadt.co.uk) Received: from localhost (localhost [127.0.0.1]) by outcold.yadt.co.uk (Postfix) with ESMTP id 45F671DD480; Sun, 8 Apr 2007 20:10:20 +0100 (BST) X-Virus-Scanned: amavisd-new at yadt.co.uk Received: from outcold.yadt.co.uk ([127.0.0.1]) by localhost (outcold.yadt.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vKndf-x8+HV8; Sun, 8 Apr 2007 20:10:13 +0100 (BST) Received: by outcold.yadt.co.uk (Postfix, from userid 1001) id 138F31DD4A6; Sun, 8 Apr 2007 20:10:13 +0100 (BST) Date: Sun, 8 Apr 2007 20:10:13 +0100 From: David Taylor To: freebsd-emulation@freebsd.org Message-ID: <20070408191012.GA95373@outcold.yadt.co.uk> Mail-Followup-To: freebsd-emulation@freebsd.org, freebsd-current@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Cc: freebsd-current@freebsd.org Subject: linux_statfs64() missing an argument?? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2007 19:38:21 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline I've recently been trying to compile gentoo under FreeBSD (in order, eventually, to compile OpenWRT), and ran in to a rather confusing problem when trying to diagnose the reason "coreutils" failed to build properly. Eventually I tracked down the problem: glibc calls the statfs64 syscall with (path, sizeof(struct statfs64), buf) The linux_statfs64 emulated syscall in FreeBSD expects only (path, buf), and returns EFAULT every time, as buf is always 0x54. The attached patch adds the missing argument, and ensures it matches sizeof(struct l_statfs64), returning EINVAL otherwise (is that the right error). I'm currently recompiling my kernel to test this, but thought I'd see if anyone had any comments on the patch as is, since I've probably done something wrong, as I'm not too sure how the whole syscalls.master setup works. -- David Taylor --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=iso-8859-15 Content-Disposition: attachment; filename="linux_statfs64.patch" Index: sys/amd64/linux32/linux32_proto.h =================================================================== RCS file: /home/ncvs/src/sys/amd64/linux32/linux32_proto.h,v retrieving revision 1.31 diff -u -r1.31 linux32_proto.h --- sys/amd64/linux32/linux32_proto.h 30 Mar 2007 00:08:21 -0000 1.31 +++ sys/amd64/linux32/linux32_proto.h 8 Apr 2007 19:00:27 -0000 @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.31 2007/03/30 00:08:21 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp */ @@ -796,6 +796,7 @@ }; struct linux_statfs64_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_fstatfs64_args { Index: sys/amd64/linux32/linux32_syscall.h =================================================================== RCS file: /home/ncvs/src/sys/amd64/linux32/linux32_syscall.h,v retrieving revision 1.31 diff -u -r1.31 linux32_syscall.h --- sys/amd64/linux32/linux32_syscall.h 30 Mar 2007 00:08:21 -0000 1.31 +++ sys/amd64/linux32/linux32_syscall.h 8 Apr 2007 19:00:27 -0000 @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.31 2007/03/30 00:08:21 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp */ Index: sys/amd64/linux32/linux32_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/amd64/linux32/linux32_sysent.c,v retrieving revision 1.31 diff -u -r1.31 linux32_sysent.c --- sys/amd64/linux32/linux32_sysent.c 30 Mar 2007 00:08:21 -0000 1.31 +++ sys/amd64/linux32/linux32_sysent.c 8 Apr 2007 19:00:27 -0000 @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.31 2007/03/30 00:08:21 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.28 2007/03/30 00:06:21 jkim Exp */ Index: sys/amd64/linux32/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/amd64/linux32/syscalls.master,v retrieving revision 1.28 diff -u -r1.28 syscalls.master --- sys/amd64/linux32/syscalls.master 30 Mar 2007 00:06:21 -0000 1.28 +++ sys/amd64/linux32/syscalls.master 8 Apr 2007 19:00:11 -0000 @@ -435,7 +435,7 @@ 266 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); } 267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ struct l_timespec *rqtp, struct l_timespec *rmtp); } -268 AUE_STATFS STD { int linux_statfs64(char *path, struct l_statfs64_buf *buf); } +268 AUE_STATFS STD { int linux_statfs64(char *path, size_t bufsize, struct l_statfs64_buf *buf); } 269 AUE_FSTATFS STD { int linux_fstatfs64(void); } 270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } 271 AUE_UTIMES STD { int linux_utimes(char *fname, \ Index: sys/i386/linux/linux_proto.h =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_proto.h,v retrieving revision 1.92 diff -u -r1.92 linux_proto.h --- sys/i386/linux/linux_proto.h 29 Mar 2007 02:11:46 -0000 1.92 +++ sys/i386/linux/linux_proto.h 8 Apr 2007 18:56:56 -0000 @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.92 2007/03/29 02:11:46 julian Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.87 2007/03/29 02:11:46 julian Exp */ #ifndef _LINUX_SYSPROTO_H_ @@ -801,6 +801,7 @@ }; struct linux_statfs64_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; char buf_l_[PADL_(struct l_statfs64_buf *)]; struct l_statfs64_buf * buf; char buf_r_[PADR_(struct l_statfs64_buf *)]; }; struct linux_fstatfs64_args { Index: sys/i386/linux/linux_syscall.h =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_syscall.h,v retrieving revision 1.85 diff -u -r1.85 linux_syscall.h --- sys/i386/linux/linux_syscall.h 29 Mar 2007 02:11:46 -0000 1.85 +++ sys/i386/linux/linux_syscall.h 8 Apr 2007 18:56:56 -0000 @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.85 2007/03/29 02:11:46 julian Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.87 2007/03/29 02:11:46 julian Exp */ #define LINUX_SYS_exit 1 Index: sys/i386/linux/linux_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_sysent.c,v retrieving revision 1.92 diff -u -r1.92 linux_sysent.c --- sys/i386/linux/linux_sysent.c 29 Mar 2007 02:11:46 -0000 1.92 +++ sys/i386/linux/linux_sysent.c 8 Apr 2007 18:56:56 -0000 @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.92 2007/03/29 02:11:46 julian Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.86 2007/02/15 00:54:40 jkim Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.87 2007/03/29 02:11:46 julian Exp */ #include Index: sys/i386/linux/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/syscalls.master,v retrieving revision 1.87 diff -u -r1.87 syscalls.master --- sys/i386/linux/syscalls.master 29 Mar 2007 02:11:46 -0000 1.87 +++ sys/i386/linux/syscalls.master 8 Apr 2007 18:56:50 -0000 @@ -439,7 +439,7 @@ 266 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); } 267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ struct l_timespec *rqtp, struct l_timespec *rmtp); } -268 AUE_STATFS STD { int linux_statfs64(char *path, struct l_statfs64_buf *buf); } +268 AUE_STATFS STD { int linux_statfs64(char *path, size_t bufsize, struct l_statfs64_buf *buf); } 269 AUE_FSTATFS STD { int linux_fstatfs64(void); } 270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } 271 AUE_UTIMES STD { int linux_utimes(char *fname, \ Index: sys/compat/linux/linux_stats.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_stats.c,v retrieving revision 1.87 diff -u -r1.87 linux_stats.c --- sys/compat/linux/linux_stats.c 6 Mar 2007 07:39:12 -0000 1.87 +++ sys/compat/linux/linux_stats.c 8 Apr 2007 18:59:47 -0000 @@ -418,6 +418,9 @@ char *path; int error; + if (args->bufsize != sizeof(struct l_statfs64)) + return EINVAL; + LCONVPATHEXIST(td, args->path, &path); #ifdef DEBUG --azLHFNyN32YCQGCU--