times(2) sys call bug?
Joakim Tjernlund
joakim.tjernlund at transmode.se
Fri Nov 21 20:53:49 EST 2008
On Fri, 2008-11-21 at 10:31 +0100, Joakim Tjernlund wrote:
> On Fri, 2008-11-21 at 10:52 +1100, Paul Mackerras wrote:
> > Joakim Tjernlund writes:
> >
> > > This little hack changes the kernel sys call handling in an crude
> > > way and then it works. Apperently the kernel thinks is an error if the
> > > syscall returns a value between -_LAST_ERRNO and -1.
> >
> > Try this patch and let me if it fixes it. If it does I'll push it
> > upstream.
> >
> > Paul.
> [SNIP]
> > + force_successful_syscall_return();
> > return (long) jiffies_64_to_clock_t(get_jiffies_64());
>
> Why is 64 bits ops used here when you only use 32 bits?
>
> BTW, I think time(2) needs this:
>
> diff --git a/kernel/time.c b/kernel/time.c
[SNIP]
Oh, and compat needs fixing too.
For both my patches:
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
BTW, why is sys_time() impl. differently in compat:
do_gettimeofday(&tv);
vs.
get_seconds();
same for sys_times():
compat_jiffies_to_clock_t(jiffies);
vs.
jiffies_64_to_clock_t(get_jiffies_64());
diff --git a/kernel/compat.c b/kernel/compat.c
index 32c254a..c6346ec 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -23,6 +23,7 @@
#include <linux/timex.h>
#include <linux/migrate.h>
#include <linux/posix-timers.h>
+#include <linux/ptrace.h>
#include <asm/uaccess.h>
@@ -196,6 +197,7 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf)
if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
return -EFAULT;
}
+ force_successful_syscall_return();
return compat_jiffies_to_clock_t(jiffies);
}
@@ -850,8 +852,9 @@ asmlinkage long compat_sys_time(compat_time_t __user * tloc)
if (tloc) {
if (put_user(i,tloc))
- i = -EFAULT;
+ return -EFAULT;
}
+ force_successful_syscall_return();
return i;
}
More information about the Linuxppc-dev
mailing list