Index: Makefile =================================================================== RCS file: /var/cvs/linux/Makefile,v retrieving revision 1.402 diff -u -p -r1.402 Makefile --- Makefile 14 Jul 2003 05:11:53 -0000 1.402 +++ Makefile 14 Jul 2003 21:32:01 -0000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 21 -EXTRAVERSION = -pa4 +EXTRAVERSION = -pa5 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) Index: arch/parisc/kernel/sys_parisc32.c =================================================================== RCS file: /var/cvs/linux/arch/parisc/kernel/sys_parisc32.c,v retrieving revision 1.27 diff -u -p -r1.27 sys_parisc32.c --- arch/parisc/kernel/sys_parisc32.c 14 Sep 2002 05:14:03 -0000 1.27 +++ arch/parisc/kernel/sys_parisc32.c 14 Jul 2003 21:32:02 -0000 @@ -59,6 +59,11 @@ #define A(__x) ((unsigned long)(__x)) +static inline void *compat_ptr(u32 uptr) +{ + return (void *)(unsigned long)uptr; +} + #undef DEBUG @@ -2298,6 +2303,78 @@ out: extern asmlinkage int sys_setsockopt(int fd, int level, int optname, char *optval, int optlen); + +static int do_netfilter_replace(int fd, int level, int optname, + char *optval, int optlen) +{ + struct ipt_replace32 { + char name[IPT_TABLE_MAXNAMELEN]; + __u32 valid_hooks; + __u32 num_entries; + __u32 size; + __u32 hook_entry[NF_IP_NUMHOOKS]; + __u32 underflow[NF_IP_NUMHOOKS]; + __u32 num_counters; + __u32 counters; + struct ipt_entry entries[0]; + } *repl32 = (struct ipt_replace32 *)optval; + struct ipt_replace *krepl; + struct ipt_counters *counters32; + __u32 origsize; + unsigned int kreplsize, kcountersize; + mm_segment_t old_fs; + int ret; + + if (optlen < sizeof(repl32)) + return -EINVAL; + + if (copy_from_user(&origsize, + &repl32->size, + sizeof(origsize))) + return -EFAULT; + + kreplsize = sizeof(*krepl) + origsize; + kcountersize = krepl->num_counters * sizeof(struct ipt_counters); + + /* Hack: Causes ipchains to give correct error msg --RR */ + if (optlen != kreplsize) + return -ENOPROTOOPT; + + krepl = (struct ipt_replace *)kmalloc(kreplsize, GFP_KERNEL); + if (krepl == NULL) + return -ENOMEM; + + if (copy_from_user(krepl, optval, kreplsize)) { + kfree(krepl); + return -EFAULT; + } + + counters32 = (struct ipt_counters *) compat_ptr(((struct ipt_replace32 *)krepl)->counters); + + kcountersize = krepl->num_counters * sizeof(struct ipt_counters); + krepl->counters = (struct ipt_counters *)kmalloc( + kcountersize, GFP_KERNEL); + if (krepl->counters == NULL) { + kfree(krepl); + return -ENOMEM; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + ret = sys_setsockopt(fd, level, optname, + (char *)krepl, kreplsize); + set_fs(old_fs); + + if (ret == 0 && + copy_to_user(counters32, krepl->counters, kcountersize)) + ret = -EFAULT; + + kfree(krepl->counters); + kfree(krepl); + + return ret; +} + static int do_set_attach_filter(int fd, int level, int optname, char *optval, int optlen) { @@ -2473,6 +2550,9 @@ err02: asmlinkage int sys32_setsockopt(int fd, int level, int optname, char *optval, int optlen) { + if (optname == IPT_SO_SET_REPLACE) + return do_netfilter_replace(fd, level, optname, optval, optlen); + if (optname == SO_ATTACH_FILTER) return do_set_attach_filter(fd, level, optname, optval, optlen); @@ -2959,6 +3039,31 @@ asmlinkage int sys32_quotactl(int cmd, c return err; } + +extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, + size_t count); + +asmlinkage long +sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count) +{ + mm_segment_t old_fs = get_fs(); + int ret; + off_t of; + + if (offset && get_user(of, offset)) + return -EFAULT; + + set_fs(KERNEL_DS); + ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); + set_fs(old_fs); + + if (!ret && offset && put_user(of, offset)) + return -EFAULT; + + return ret; +} + + struct timex32 { unsigned int modes; /* mode selector */ int offset; /* time offset (usec) */ @@ -3005,6 +3110,7 @@ asmlinkage long sys32_adjtimex(struct ti CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt); CP(stbcnt); ret = do_adjtimex(&txc); +#undef CP #define CP(x) t32.x = txc.x CP(modes); CP(offset); CP(freq); CP(maxerror); CP(esterror); CP(status); CP(constant); CP(precision); CP(tolerance); Index: arch/parisc/kernel/syscall.S =================================================================== RCS file: /var/cvs/linux/arch/parisc/kernel/syscall.S,v retrieving revision 1.78 diff -u -p -r1.78 syscall.S --- arch/parisc/kernel/syscall.S 4 Aug 2002 22:57:47 -0000 1.78 +++ arch/parisc/kernel/syscall.S 14 Jul 2003 21:32:05 -0000 @@ -484,7 +484,7 @@ sys_call_table: ENTRY_SAME(madvise) ENTRY_SAME(clone_wrapper) /* 120 */ ENTRY_SAME(setdomainname) - ENTRY_SAME(sendfile) + ENTRY_DIFF(sendfile) /* struct sockaddr... */ ENTRY_SAME(recvfrom) /* struct timex contains longs */