* [PATCH][COMPAT] {get,put}_compat_timspec 2/8 ppc64
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
@ 2003-01-08 11:41 ` Stephen Rothwell
2003-01-08 11:44 ` [PATCH][COMPAT] {get,put}_compat_timspec 3/8 sparc64 Stephen Rothwell
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 11:41 UTC (permalink / raw)
To: anton; +Cc: torvalds, linux-kernel
Hi Anton,
The ppc64 part. This is relative to my previous patches.
This patch also fixes a strange bit of code in sys32_rt_sigtimedwait.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/ppc64/kernel/signal32.c 2.5.54-200301081106-32bit.3/arch/ppc64/kernel/signal32.c
--- 2.5.54-200301081106-32bit.2/arch/ppc64/kernel/signal32.c 2003-01-08 11:40:34.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/ppc64/kernel/signal32.c 2003-01-08 17:17:13.000000000 +1100
@@ -720,18 +720,11 @@
case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
}
- if (uts) {
- ret = get_user(t.tv_sec, &uts->tv_sec);
- ret |= __get_user(t.tv_nsec, &uts->tv_nsec);
- if (ret)
- return -EFAULT;
- }
+ if (uts && get_compat_timespec(&t, uts))
+ return -EFAULT;
set_fs(KERNEL_DS);
- if (uts)
- ret = sys_rt_sigtimedwait(&s, &info, &t, sigsetsize);
- else
- ret = sys_rt_sigtimedwait(&s, &info, (struct timespec *)uts,
- sigsetsize);
+ ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
+ sigsetsize);
set_fs(old_fs);
if (ret >= 0 && uinfo) {
if (copy_siginfo_to_user32(uinfo, &info))
diff -ruN 2.5.54-200301081106-32bit.2/arch/ppc64/kernel/sys_ppc32.c 2.5.54-200301081106-32bit.3/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.54-200301081106-32bit.2/arch/ppc64/kernel/sys_ppc32.c 2003-01-08 11:40:35.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/ppc64/kernel/sys_ppc32.c 2003-01-08 17:17:55.000000000 +1100
@@ -3603,10 +3603,8 @@
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval((int)pid, &t);
set_fs (old_fs);
- if (put_user (t.tv_sec, &interval->tv_sec) ||
- __put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
-
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 3/8 sparc64
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
2003-01-08 11:41 ` [PATCH][COMPAT] {get,put}_compat_timspec 2/8 ppc64 Stephen Rothwell
@ 2003-01-08 11:44 ` Stephen Rothwell
2003-01-08 11:53 ` [PATCH][COMPAT] {get,put}_compat_timspec 4/8 x86_64 Stephen Rothwell
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 11:44 UTC (permalink / raw)
To: davem; +Cc: torvalds, linux-kernel
Hi Dave,
sparc 64 part. This is relative to the previous patches I have sent you.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/sparc64/kernel/sys_sparc32.c 2.5.54-200301081106-32bit.3/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.54-200301081106-32bit.2/arch/sparc64/kernel/sys_sparc32.c 2003-01-08 11:40:38.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/sparc64/kernel/sys_sparc32.c 2003-01-08 17:15:17.000000000 +1100
@@ -1729,8 +1729,7 @@
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
set_fs (old_fs);
- if (put_user (t.tv_sec, &interval->tv_sec) ||
- __put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
@@ -1861,8 +1860,7 @@
signotset(&these);
if (uts) {
- if (get_user (ts.tv_sec, &uts->tv_sec) ||
- get_user (ts.tv_nsec, &uts->tv_nsec))
+ if (get_compat_timespec(&ts, uts))
return -EINVAL;
if (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0
|| ts.tv_sec < 0)
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 4/8 x86_64
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
2003-01-08 11:41 ` [PATCH][COMPAT] {get,put}_compat_timspec 2/8 ppc64 Stephen Rothwell
2003-01-08 11:44 ` [PATCH][COMPAT] {get,put}_compat_timspec 3/8 sparc64 Stephen Rothwell
@ 2003-01-08 11:53 ` Stephen Rothwell
2003-01-08 12:01 ` [PATCH][COMPAT] {get,put}_compat_timspec 5/8 ia64 Stephen Rothwell
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 11:53 UTC (permalink / raw)
To: ak; +Cc: torvalds, linux-kernel
Hi Andi,
You asked for it ... x86_64 part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/x86_64/ia32/ipc32.c 2.5.54-200301081106-32bit.3/arch/x86_64/ia32/ipc32.c
--- 2.5.54-200301081106-32bit.2/arch/x86_64/ia32/ipc32.c 2003-01-08 11:40:39.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/x86_64/ia32/ipc32.c 2003-01-08 16:43:42.000000000 +1100
@@ -626,9 +626,7 @@
return -E2BIG;
if (!access_ok(VERIFY_READ, sb, nsops * sizeof(struct sembuf)))
return -EFAULT;
- if (ts32 &&
- (get_user(ts.tv_sec, &ts32->tv_sec) ||
- __get_user(ts.tv_nsec, &ts32->tv_nsec)))
+ if (ts32 && get_compat_timespec(&ts, ts32))
return -EFAULT;
set_fs(KERNEL_DS);
diff -ruN 2.5.54-200301081106-32bit.2/arch/x86_64/ia32/sys_ia32.c 2.5.54-200301081106-32bit.3/arch/x86_64/ia32/sys_ia32.c
--- 2.5.54-200301081106-32bit.2/arch/x86_64/ia32/sys_ia32.c 2003-01-08 11:40:39.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/x86_64/ia32/sys_ia32.c 2003-01-08 17:19:37.000000000 +1100
@@ -1271,9 +1271,7 @@
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
set_fs (old_fs);
- if (verify_area(VERIFY_WRITE, interval, sizeof(struct compat_timespec)) ||
- __put_user (t.tv_sec, &interval->tv_sec) ||
- __put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
@@ -1440,14 +1438,11 @@
case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
}
- if (uts) {
- if (verify_area(VERIFY_READ, uts, sizeof(struct compat_timespec)) ||
- __get_user (t.tv_sec, &uts->tv_sec) ||
- __get_user (t.tv_nsec, &uts->tv_nsec))
- return -EFAULT;
- }
+ if (uts && get_compat_timespec(&t, uts))
+ return -EFAULT;
set_fs (KERNEL_DS);
- ret = sys_rt_sigtimedwait(&s, &info, &t, sigsetsize);
+ ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
+ sigsetsize);
set_fs (old_fs);
if (ret >= 0 && uinfo) {
if (copy_to_user (uinfo, siginfo64to32(&info32, &info),
@@ -2300,20 +2295,13 @@
mm_segment_t oldfs = get_fs();
int err;
- if (utime32) {
- if (verify_area(VERIFY_READ, utime32, sizeof(*utime32)))
- return -EFAULT;
-
- if (__get_user(t.tv_sec, &utime32->tv_sec) ||
- __get_user(t.tv_nsec, &utime32->tv_nsec))
- return -EFAULT;
-
- }
+ if (utime32 && get_compat_timespec(&t, utime32))
+ return -EFAULT;
/* the set_fs is safe because futex doesn't use the seg limit
for valid page checking of uaddr. */
set_fs(KERNEL_DS);
- err = sys_futex(uaddr, op, val, &t);
+ err = sys_futex(uaddr, op, val, utime32 ? &t : NULL);
set_fs(oldfs);
return err;
}
@@ -2392,22 +2380,18 @@
{
long ret;
mm_segment_t oldfs;
- struct timespec t32;
+ struct timespec t;
/* Harden against bogus ptrace */
if (nr >= 0xffffffff ||
!access_ok(VERIFY_WRITE, events, nr * sizeof(struct io_event)))
return -EFAULT;
- if (timeout &&
- (get_user(t32.tv_sec, &timeout->tv_sec) ||
- __get_user(t32.tv_nsec, &timeout->tv_nsec)))
+ if (timeout && get_compat_timespec(&t, timeout))
return -EFAULT;
oldfs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_io_getevents(ctx_id,min_nr,nr,events,timeout ? &t32 : NULL);
+ ret = sys_io_getevents(ctx_id,min_nr,nr,events,timeout ? &t : NULL);
set_fs(oldfs);
- if (timeout &&
- (__put_user(t32.tv_sec, &timeout->tv_sec) ||
- __put_user(t32.tv_nsec, &timeout->tv_nsec)))
+ if (timeout && put_compat_timespec(&t, timeout))
return -EFAULT;
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 5/8 ia64
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
` (2 preceding siblings ...)
2003-01-08 11:53 ` [PATCH][COMPAT] {get,put}_compat_timspec 4/8 x86_64 Stephen Rothwell
@ 2003-01-08 12:01 ` Stephen Rothwell
2003-01-08 12:04 ` [PATCH][COMPAT] {get,put}_compat_timspec 6/8 s390x Stephen Rothwell
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 12:01 UTC (permalink / raw)
To: davidm; +Cc: torvalds, linux-kernel
Hi David,
Here is the ia64 part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/ia64/ia32/ia32_signal.c 2.5.54-200301081106-32bit.3/arch/ia64/ia32/ia32_signal.c
--- 2.5.54-200301081106-32bit.2/arch/ia64/ia32/ia32_signal.c 2002-12-27 15:15:38.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/ia64/ia32/ia32_signal.c 2003-01-08 17:05:48.000000000 +1100
@@ -607,14 +607,11 @@
if (copy_from_user(&s.sig, uthese, sizeof(sigset32_t)))
return -EFAULT;
- if (uts) {
- ret = get_user(t.tv_sec, &uts->tv_sec);
- ret |= get_user(t.tv_nsec, &uts->tv_nsec);
- if (ret)
- return -EFAULT;
- }
+ if (uts && get_compat_timespec(&t, uts))
+ return -EFAULT;
set_fs(KERNEL_DS);
- ret = sys_rt_sigtimedwait(&s, &info, &t, sigsetsize);
+ ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
+ sigsetsize);
set_fs(old_fs);
if (ret >= 0 && uinfo) {
if (copy_siginfo_to_user32(uinfo, &info))
diff -ruN 2.5.54-200301081106-32bit.2/arch/ia64/ia32/sys_ia32.c 2.5.54-200301081106-32bit.3/arch/ia64/ia32/sys_ia32.c
--- 2.5.54-200301081106-32bit.2/arch/ia64/ia32/sys_ia32.c 2003-01-08 12:03:33.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/ia64/ia32/sys_ia32.c 2003-01-08 17:08:05.000000000 +1100
@@ -3536,7 +3536,7 @@
set_fs(KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
set_fs(old_fs);
- if (put_user (t.tv_sec, &interval->tv_sec) || put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 6/8 s390x
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
` (3 preceding siblings ...)
2003-01-08 12:01 ` [PATCH][COMPAT] {get,put}_compat_timspec 5/8 ia64 Stephen Rothwell
@ 2003-01-08 12:04 ` Stephen Rothwell
2003-01-08 12:10 ` [PATCH][COMPAT] {get,put}_compat_timspec 7/8 mips64 Stephen Rothwell
2003-01-08 12:12 ` [PATCH][COMPAT] {get,put}_compat_timspec 8/8 parisc Stephen Rothwell
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 12:04 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, schwidefsky
Hi Linus,
Here is the s390x part of the patch. Martin has said that I should feed
these straight to you and he will fix up any problems later. Please apply
if you apply the gerneic part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/s390x/kernel/linux32.c 2.5.54-200301081106-32bit.3/arch/s390x/kernel/linux32.c
--- 2.5.54-200301081106-32bit.2/arch/s390x/kernel/linux32.c 2003-01-08 11:40:35.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/s390x/kernel/linux32.c 2003-01-08 17:14:08.000000000 +1100
@@ -1671,8 +1671,7 @@
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
set_fs (old_fs);
- if (put_user (t.tv_sec, &interval->tv_sec) ||
- __put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
@@ -1806,8 +1805,7 @@
signotset(&these);
if (uts) {
- if (get_user (ts.tv_sec, &uts->tv_sec) ||
- get_user (ts.tv_nsec, &uts->tv_nsec))
+ if (get_compat_timespec(&ts, uts))
return -EINVAL;
if (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0
|| ts.tv_sec < 0)
@@ -4149,13 +4147,12 @@
mm_segment_t old_fs;
int ret;
- if (get_user (tmp.tv_sec, &timeout32->tv_sec) ||
- get_user (tmp.tv_nsec, &timeout32->tv_nsec))
+ if (timeout32 && get_compat_timespec(&tmp, timeout32))
return -EINVAL;
old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_futex(uaddr, op, val, &tmp);
+ ret = sys_futex(uaddr, op, val, timeout32 ? &tmp : NULL);
set_fs(old_fs);
return ret;
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 7/8 mips64
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
` (4 preceding siblings ...)
2003-01-08 12:04 ` [PATCH][COMPAT] {get,put}_compat_timspec 6/8 s390x Stephen Rothwell
@ 2003-01-08 12:10 ` Stephen Rothwell
2003-01-08 12:12 ` [PATCH][COMPAT] {get,put}_compat_timspec 8/8 parisc Stephen Rothwell
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 12:10 UTC (permalink / raw)
To: ralf; +Cc: torvalds, linux-kernel
Hi Ralf,
Here is the mips64 part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/mips64/kernel/linux32.c 2.5.54-200301081106-32bit.3/arch/mips64/kernel/linux32.c
--- 2.5.54-200301081106-32bit.2/arch/mips64/kernel/linux32.c 2003-01-08 12:04:15.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/mips64/kernel/linux32.c 2003-01-08 17:09:19.000000000 +1100
@@ -1086,8 +1086,7 @@
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
set_fs (old_fs);
- if (put_user (t.tv_sec, &interval->tv_sec) ||
- __put_user (t.tv_nsec, &interval->tv_nsec))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH][COMPAT] {get,put}_compat_timspec 8/8 parisc
2003-01-08 11:37 [PATCH][COMPAT] {get,put}_compat_timspec 1/8 generic Stephen Rothwell
` (5 preceding siblings ...)
2003-01-08 12:10 ` [PATCH][COMPAT] {get,put}_compat_timspec 7/8 mips64 Stephen Rothwell
@ 2003-01-08 12:12 ` Stephen Rothwell
6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2003-01-08 12:12 UTC (permalink / raw)
To: matthew; +Cc: torvalds, linux-kernel
Hi Willy,
Here is the parisc part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.54-200301081106-32bit.2/arch/parisc/kernel/sys_parisc32.c 2.5.54-200301081106-32bit.3/arch/parisc/kernel/sys_parisc32.c
--- 2.5.54-200301081106-32bit.2/arch/parisc/kernel/sys_parisc32.c 2003-01-08 12:04:15.000000000 +1100
+++ 2.5.54-200301081106-32bit.3/arch/parisc/kernel/sys_parisc32.c 2003-01-08 17:10:25.000000000 +1100
@@ -490,15 +490,6 @@
}
#endif /* CONFIG_SYSCTL */
-static int
-put_compat_timespec(struct compat_timespec *u, struct timespec *t)
-{
- struct compat_timespec t32;
- t32.tv_sec = t->tv_sec;
- t32.tv_nsec = t->tv_nsec;
- return copy_to_user(u, &t32, sizeof t32);
-}
-
asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
struct compat_timespec *interval)
{
@@ -507,7 +498,7 @@
extern asmlinkage long sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, &t);
- if (put_compat_timespec(interval, &t))
+ if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread