[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 64bits & df



On Wed, 12 Nov 2003 19:54:58 -0600
Otto Solares <solca@guug.org> wrote:

> On Wed, Nov 12, 2003 at 05:30:22PM -0800, David S. Miller wrote:
> > On Wed, 12 Nov 2003 18:18:51 -0600
> > Otto Solares <solca@guug.org> wrote:
> > 
> > > Hopefully glibc's statfs64 does not depend on kernel 2.4.
> > 
> > The statfs64 system call only exists in 2.6.x kernels that is
> > why 2.4.x returns -ENOSYS and then glibc downgrades to use the
> > older statfs system call instead.
> 
> Thank you.  Hopefully Ben will find a solution, weird he does
> not have the same problem using 2.6 and latest sid's glibc.

I've also just found a few problems with 32-bit statfs64 system
calls in the kernel when running on sparc64, so best to stay
away from 2.6.x without the following patch and until Ben looks
into the glibc side issues.

Thanks.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1436  -> 1.1438 
#	arch/sparc64/kernel/systbls.S	1.50    -> 1.51   
#	         fs/compat.c	1.18    -> 1.19   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/11/12	davem@nuts.ninka.net	1.1437
# [COMPAT]: Fix arguments to compat statfs64 syscalls, 'sz' was missing.
# --------------------------------------------
# 03/11/12	davem@nuts.ninka.net	1.1438
# [SPARC64]: For 32-bit processes, use compat statfs64 syscall handlers not the normal ones.
# --------------------------------------------
#
diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
--- a/arch/sparc64/kernel/systbls.S	Wed Nov 12 18:00:08 2003
+++ b/arch/sparc64/kernel/systbls.S	Wed Nov 12 18:00:08 2003
@@ -65,8 +65,8 @@
 	.word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
 /*220*/	.word compat_sys_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid
 	.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
-/*230*/	.word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_statfs64
-	.word sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
+/*230*/	.word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64
+	.word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
 /*240*/	.word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
 	.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
 /*250*/	.word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
diff -Nru a/fs/compat.c b/fs/compat.c
--- a/fs/compat.c	Wed Nov 12 18:00:08 2003
+++ b/fs/compat.c	Wed Nov 12 18:00:08 2003
@@ -169,7 +169,6 @@
 
 static int put_compat_statfs64(struct compat_statfs64 *ubuf, struct kstatfs *kbuf)
 {
-	
 	if (sizeof ubuf->f_blocks == 4) {
 		if ((kbuf->f_blocks | kbuf->f_bfree |
 		     kbuf->f_bavail | kbuf->f_files | kbuf->f_ffree) &
@@ -192,11 +191,14 @@
 	return 0;
 }
 
-asmlinkage long compat_statfs64(const char *path, struct compat_statfs64 *buf)
+asmlinkage long compat_statfs64(const char *path, compat_size_t sz, struct compat_statfs64 *buf)
 {
 	struct nameidata nd;
 	int error;
 
+	if (sz != sizeof(*buf))
+		return -EINVAL;
+
 	error = user_path_walk(path, &nd);
 	if (!error) {
 		struct kstatfs tmp;
@@ -208,11 +210,14 @@
 	return error;
 }
 
-asmlinkage long compat_fstatfs64(unsigned int fd, struct compat_statfs64 *buf)
+asmlinkage long compat_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 *buf)
 {
 	struct file * file;
 	struct kstatfs tmp;
 	int error;
+
+	if (sz != sizeof(*buf))
+		return -EINVAL;
 
 	error = -EBADF;
 	file = fget(fd);



Reply to: