From patchwork Fri Nov 21 09:53:49 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 9974 X-Patchwork-Delegate: paulus@samba.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 1F409DDEEF for ; Fri, 21 Nov 2008 20:55:04 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mail.transmode.se (mail.transmode.se [83.241.175.147]) by ozlabs.org (Postfix) with ESMTP id 35BD7DDE0A for ; Fri, 21 Nov 2008 20:53:51 +1100 (EST) Received: mail.transmode.se 192.168.46.15 from 192.168.1.15 192.168.1.15 via HTTP with MS-WebStorage 6.0.6249 Received: from gentoo-jocke by mail.transmode.se; 21 Nov 2008 10:53:49 +0100 Subject: Re: times(2) sys call bug? From: Joakim Tjernlund To: Paul Mackerras In-Reply-To: <1227259869.5224.123.camel@gentoo-jocke.transmode.se> References: <1227193640.5224.90.camel@gentoo-jocke.transmode.se> <20081120103733.6f347180@zod.rchland.ibm.com> <1227199742.5224.99.camel@gentoo-jocke.transmode.se> <18725.63534.3316.841949@cargo.ozlabs.ibm.com> <1227259869.5224.123.camel@gentoo-jocke.transmode.se> Organization: Transmode AB Date: Fri, 21 Nov 2008 10:53:49 +0100 Message-Id: <1227261229.5224.131.camel@gentoo-jocke.transmode.se> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Cc: linuxppc-dev Development X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: joakim.tjernlund@transmode.se List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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 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 #include #include +#include #include @@ -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; }