Index: Makefile =================================================================== RCS file: /home/linas/cvsroot/linux24/Makefile,v retrieving revision 1.1.1.2.2.1 diff -u -p -u -p -r1.1.1.2.2.1 Makefile --- Makefile 23 Oct 2003 20:27:48 -0000 1.1.1.2.2.1 +++ Makefile 23 Oct 2003 20:29:44 -0000 @@ -19,7 +19,7 @@ FINDHPATH = $(HPATH)/asm $(HPATH)/linux HOSTCC = gcc HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -CROSS_COMPILE = +CROSS_COMPILE = /opt/cross/bin/powerpc64-linux- # # Include the make variables (CC, etc...) Index: arch/ppc64/kernel/misc.S =================================================================== RCS file: /home/linas/cvsroot/linux24/arch/ppc64/kernel/misc.S,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 misc.S --- arch/ppc64/kernel/misc.S 23 Oct 2003 20:07:43 -0000 1.1.1.2 +++ arch/ppc64/kernel/misc.S 23 Oct 2003 23:17:13 -0000 @@ -819,8 +819,37 @@ _GLOBAL(sys_call_table32) .llong .sys_fremovexattr /* 220 */ .llong .sys_futex #endif + .llong .sys_ni_syscall /* 208 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 210 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 215 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 220 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 225 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 230 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_new_s_context /* 235 */ + .llong .sys_set_ipv4root .llong .sys_perfmonctl /* Put this here for now ... */ - .rept NR_syscalls-222 + .rept NR_syscalls-237 .llong .sys_ni_syscall .endr #endif @@ -1050,7 +1079,36 @@ _GLOBAL(sys_call_table) .llong .sys_fremovexattr /* 220 */ .llong .sys_futex #endif + .llong .sys_ni_syscall /* 208 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 210 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 215 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 220 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 225 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall /* 230 */ + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_ni_syscall + .llong .sys_new_s_context /* 235 */ + .llong .sys_set_ipv4root .llong .sys_perfmonctl /* Put this here for now ... */ - .rept NR_syscalls-222 + .rept NR_syscalls-237 .llong .sys_ni_syscall .endr Index: arch/ppc64/kernel/ptrace.c =================================================================== RCS file: /home/linas/cvsroot/linux24/arch/ppc64/kernel/ptrace.c,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 ptrace.c --- arch/ppc64/kernel/ptrace.c 23 Oct 2003 20:07:42 -0000 1.1.1.2 +++ arch/ppc64/kernel/ptrace.c 23 Oct 2003 23:31:46 -0000 @@ -115,7 +115,7 @@ int sys_ptrace(long request, long pid, l if (child) get_task_struct(child); read_unlock(&tasklist_lock); - if (!child) + if (!child || child->s_context != current->s_context) goto out; ret = -EPERM; Index: arch/ppc64/kernel/sys_ppc32.c =================================================================== RCS file: /home/linas/cvsroot/linux24/arch/ppc64/kernel/sys_ppc32.c,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 sys_ppc32.c --- arch/ppc64/kernel/sys_ppc32.c 23 Oct 2003 20:07:43 -0000 1.1.1.2 +++ arch/ppc64/kernel/sys_ppc32.c 23 Oct 2003 22:07:06 -0000 @@ -103,11 +103,38 @@ asmlinkage long sys32_utime(char * filen return ret; } +asmlinkage int sys32_ustat(__kernel_dev_t32 dev, struct ustat32 * ubuf) +{ + + struct super_block *s; + struct ustat32 tmp; + struct statfs sbuf; + struct ustat *tmp_ubuf; + int err = -EINVAL; + + s = get_super(to_kdev_t(dev)); + if (s == NULL) + goto out; + err = vfs_statfs(s, &sbuf); + drop_super(s); + if (err) + goto out; + + memset(&tmp,0,sizeof(struct ustat)); + tmp.f_tfree = sbuf.f_bfree; + tmp.f_tinode = sbuf.f_ffree; + err = copy_to_user(ubuf, &tmp, sizeof(struct ustat32)) ? -EFAULT : 0; + +out: + return err; + +} struct iovec32 { u32 iov_base; __kernel_size_t32 iov_len; }; typedef ssize_t (*IO_fn_t)(struct file *, char *, size_t, loff_t *); +typedef __kernel_ssize_t32 ssize_t32; static long do_readv_writev32(int type, struct file *file, const struct iovec32 *vector, u32 count) @@ -148,6 +175,11 @@ static long do_readv_writev32(int type, ivp->iov_len = (__kernel_size_t) len; vector++; ivp++; + if ((len < 0) || (tot_len != (ssize_t32)tot_len)) { + if (iov != iovstack) + kfree(iov); + return -EINVAL; + } i--; } @@ -454,7 +486,7 @@ out: return err; } -struct user_dqblk32 { +struct dqblk32 { __u32 dqb_bhardlimit; __u32 dqb_bsoftlimit; __u32 dqb_curblocks; @@ -473,13 +505,13 @@ extern asmlinkage long sys_quotactl(int * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ -asmlinkage long sys32_quotactl(u32 cmd_parm, const char *special, u32 id_parm, caddr_t addr) +asmlinkage long sys32_quotactl(u32 cmd_parm, const char *special, u32 id_parm, unsigned long addr) { - int cmd = (int)cmd_parm; - int id = (int)id_parm; + int cmd = (int)cmd_parm; + int id = (int)id_parm; int cmds = cmd >> SUBCMDSHIFT; int err; - struct v1c_mem_dqblk d; + // struct dqblk d; mm_segment_t old_fs; char *spec; @@ -487,39 +519,45 @@ asmlinkage long sys32_quotactl(u32 cmd_p current->pid, current, current->comm); switch (cmds) { - case Q_V1_GETQUOTA: + case Q_GETQUOTA: break; - case Q_V1_SETQUOTA: - case Q_V1_SETUSE: - case Q_V1_SETQLIM: - if (copy_from_user(&d, addr, sizeof(struct user_dqblk32))) + case Q_SETQUOTA: +#if 0 + case Q_SETUSE: + case Q_SETQLIM: + if (copy_from_user (&d, (struct dqblk32 *)addr, + sizeof (struct dqblk32))) return -EFAULT; - d.dqb_itime = ((struct user_dqblk32 *)&d)->dqb_itime; - d.dqb_btime = ((struct user_dqblk32 *)&d)->dqb_btime; + d.dqb_itime = ((struct dqblk32 *)&d)->dqb_itime; + d.dqb_btime = ((struct dqblk32 *)&d)->dqb_btime; +#endif break; default: - return sys_quotactl(cmd, special, id, addr); + return sys_quotactl(cmd, special, + id, (caddr_t)addr); } - spec = getname(special); + spec = getname (special); err = PTR_ERR(spec); - if (IS_ERR(spec)) - return err; - old_fs = get_fs(); + if (IS_ERR(spec)) return err; +#if 0 + old_fs = get_fs (); set_fs (KERNEL_DS); err = sys_quotactl(cmd, (const char *)spec, id, (caddr_t)&d); set_fs (old_fs); putname (spec); - if (cmds == Q_V1_GETQUOTA) { + if (cmds == Q_GETQUOTA) { __kernel_time_t b = d.dqb_btime, i = d.dqb_itime; - ((struct user_dqblk32 *)&d)->dqb_itime = i; - ((struct user_dqblk32 *)&d)->dqb_btime = b; - if (copy_to_user(addr, &d, sizeof(struct user_dqblk32))) + ((struct dqblk32 *)&d)->dqb_itime = i; + ((struct dqblk32 *)&d)->dqb_btime = b; + if (copy_to_user ((struct dqblk32 *)addr, &d, + sizeof (struct dqblk32))) return -EFAULT; } PPCDBG(PPCDBG_SYS32, "sys32_quotactl - exited - pid=%ld current=%lx comm=%s \n", current->pid, current, current->comm); +#endif return err; } @@ -994,19 +1032,21 @@ asmlinkage long sys32_newfstat(unsigned static inline int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf) { - int err; - - err = put_user (kbuf->f_type, &ubuf->f_type); - err |= __put_user (kbuf->f_bsize, &ubuf->f_bsize); - err |= __put_user (kbuf->f_blocks, &ubuf->f_blocks); - err |= __put_user (kbuf->f_bfree, &ubuf->f_bfree); - err |= __put_user (kbuf->f_bavail, &ubuf->f_bavail); - err |= __put_user (kbuf->f_files, &ubuf->f_files); - err |= __put_user (kbuf->f_ffree, &ubuf->f_ffree); - err |= __put_user (kbuf->f_namelen, &ubuf->f_namelen); - err |= __put_user (kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]); - err |= __put_user (kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]); - return err; + struct statfs32 tmp; + memset(&tmp, 0, sizeof(tmp)); + + tmp.f_type = kbuf->f_type; + tmp.f_bsize = kbuf->f_bsize; + tmp.f_blocks = kbuf->f_blocks; + tmp.f_bfree = kbuf->f_bfree; + tmp.f_bavail = kbuf->f_bavail; + tmp.f_files = kbuf->f_files; + tmp.f_ffree = kbuf->f_ffree; + tmp.f_namelen = kbuf->f_namelen; + tmp.f_fsid.val[0] = kbuf->f_fsid.val[0]; + tmp.f_fsid.val[1] = kbuf->f_fsid.val[1]; + + return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; } extern asmlinkage int sys_statfs(const char * path, struct statfs * buf); @@ -2566,7 +2606,7 @@ static long do_sys32_semctl(int first, i err = -EFAULT; if (get_user(pad, (u32 *)uptr)) return err; - if (third == SETVAL) + if ((third & (~IPC_64)) == SETVAL) fourth.val = (int)pad; else fourth.__pad = (void *)A(pad); @@ -4605,8 +4645,6 @@ extern asmlinkage ssize_t sys_pread(unsi extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf, size_t count, loff_t pos); - -typedef __kernel_ssize_t32 ssize_t32; asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf, __kernel_size_t32 count, u32 reg6, u32 poshi, u32 poslo) Index: include/asm-ppc64/ppc32.h =================================================================== RCS file: /home/linas/cvsroot/linux24/include/asm-ppc64/ppc32.h,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 ppc32.h --- include/asm-ppc64/ppc32.h 23 Oct 2003 20:11:15 -0000 1.1.1.2 +++ include/asm-ppc64/ppc32.h 23 Oct 2003 22:00:52 -0000 @@ -76,6 +76,13 @@ struct statfs32 { int f_spare[6]; }; +struct ustat32 { + __kernel_daddr_t32 f_tfree; + __kernel_ino_t32 f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; + typedef union sigval32 { int sival_int; unsigned int sival_ptr; Index: include/asm-ppc64/unistd.h =================================================================== RCS file: /home/linas/cvsroot/linux24/include/asm-ppc64/unistd.h,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 unistd.h --- include/asm-ppc64/unistd.h 23 Oct 2003 20:11:14 -0000 1.1.1.2 +++ include/asm-ppc64/unistd.h 23 Oct 2003 22:59:47 -0000 @@ -244,6 +244,9 @@ #define __NR_alloc_hugepages 232 #define __NR_free_hugepages 233 #define __NR_exit_group 234 +#define __NR_new_s_context 235 +#define __NR_set_ipv4root 236 + #define __NR(n) #n