x32: Switch to a 64-bit clock_t
authorH. Peter Anvin <hpa@zytor.com>
Mon, 5 Mar 2012 21:40:24 +0000 (13:40 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 5 Mar 2012 23:35:18 +0000 (15:35 -0800)
clock_t is used mainly to give the number of jiffies a certain process
has burned.  It is entirely feasible for a long-running process to
consume more than 2^32 jiffies especially in a multiprocess system.
As such, switch to a 64-bit clock_t for x32, just as we already
switched to a 64-bit time_t.

clock_t is only used in a handful of places, and as such it is really
not a very significant change.  The one that has the biggest impact is
in struct siginfo, but since the *size* of struct siginfo doesn't
change (it is padded to the hilt) it is fairly easy to make this a
localized change.

This also gets rid of sys_x32_times, however since this is a pretty
late change don't compactify the system call numbers; we can reuse
system call slot 521 next time we need an x32 system call.

Reported-by: Gregory M. Lueck <gregory.m.lueck@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: H. J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
arch/x86/ia32/ia32_signal.c
arch/x86/include/asm/ia32.h
arch/x86/syscalls/syscall_64.tbl

index 25d80f3faf2ea0102cd24ef21b3999dd2b26268c..bc09ed2a8b973ec748d6a885ab80f0392d29ba70 100644 (file)
@@ -37,6 +37,7 @@
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
        int err = 0;
+       bool ia32 = !is_ia32_task();
 
        if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
                return -EFAULT;
@@ -66,8 +67,13 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
                        case __SI_FAULT >> 16:
                                break;
                        case __SI_CHLD >> 16:
-                               put_user_ex(from->si_utime, &to->si_utime);
-                               put_user_ex(from->si_stime, &to->si_stime);
+                               if (ia32) {
+                                       put_user_ex(from->si_utime, &to->si_utime);
+                                       put_user_ex(from->si_stime, &to->si_stime);
+                               } else {
+                                       put_user_ex(from->si_utime, &to->_sifields._sigchld_x32._utime);
+                                       put_user_ex(from->si_stime, &to->_sifields._sigchld_x32._stime);
+                               }
                                put_user_ex(from->si_status, &to->si_status);
                                /* FALL THROUGH */
                        default:
index c6435ab1cc130b2a8a7916955cff7088b473c826..7d0c185877098bff30fe0b4ccdbacf9babde7d31 100644 (file)
@@ -125,6 +125,15 @@ typedef struct compat_siginfo {
                        compat_clock_t _stime;
                } _sigchld;
 
+               /* SIGCHLD (x32 version) */
+               struct {
+                       unsigned int _pid;      /* which child */
+                       unsigned int _uid;      /* sender's uid */
+                       int _status;            /* exit code */
+                       s64 _utime;
+                       s64 _stime;
+               } _sigchld_x32;
+
                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
                struct {
                        unsigned int _addr;     /* faulting insn/memory ref. */
index 4aecc7e311660d27e2145b5e4185fb84d1228969..0d778b80088492fcdadf531dcc1ec7a30aeb82e0 100644 (file)
 97     common  getrlimit               sys_getrlimit
 98     common  getrusage               sys_getrusage
 99     common  sysinfo                 sys_sysinfo
-100    64      times                   sys_times
+100    common  times                   sys_times
 101    common  ptrace                  sys_ptrace
 102    common  getuid                  sys_getuid
 103    common  syslog                  sys_syslog
 518    x32     sendmsg                 compat_sys_sendmsg
 519    x32     recvmsg                 compat_sys_recvmsg
 520    x32     execve                  stub_x32_execve
-521    x32     times                   compat_sys_times
+# 521 available
 522    x32     rt_sigpending           sys32_rt_sigpending
 523    x32     rt_sigtimedwait         compat_sys_rt_sigtimedwait
 524    x32     rt_sigqueueinfo         sys32_rt_sigqueueinfo