]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
converted a few more
authorNicholas Nethercote <n.nethercote@gmail.com>
Sun, 14 Nov 2004 13:42:51 +0000 (13:42 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Sun, 14 Nov 2004 13:42:51 +0000 (13:42 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2987

coregrind/vg_syscalls.c
include/x86-linux/vki_arch.h
memcheck/tests/scalar.c
memcheck/tests/scalar.stderr.exp

index afd1890eab04ea2a74bbec7c0a087ed903284f4b..ffa78860b9d945e77609107e4f425cabb628ffd7 100644 (file)
@@ -2325,23 +2325,34 @@ POST(getdents64)
       POST_MEM_WRITE( arg2, res );
 }
 
-PRE(getgroups)
+PREx(sys_getgroups16, 0)
+{
+   PRINT("sys_getgroups16 ( %d, %p )", arg1, arg2);
+   PRE_REG_READ2(long, "getgroups16", int, size, vki_old_gid_t *, list);
+   if (arg1 > 0)
+      PRE_MEM_WRITE( "getgroups16(list)", arg2, arg1 * sizeof(vki_old_gid_t) );
+}
+
+POSTx(sys_getgroups16)
+{
+   if (arg1 > 0 && res > 0)
+      POST_MEM_WRITE( arg2, res * sizeof(vki_old_gid_t) );
+}
+
+PREx(sys_getgroups, 0)
 {
-   /* int getgroups(int size, gid_t list[]); */
    PRINT("getgroups ( %d, %p )", arg1, arg2);
+   PRE_REG_READ2(long, "getgroups", int, size, vki_gid_t *, list);
    if (arg1 > 0)
       PRE_MEM_WRITE( "getgroups(list)", arg2, arg1 * sizeof(vki_gid_t) );
 }
 
-POST(getgroups)
+POSTx(sys_getgroups)
 {
    if (arg1 > 0 && res > 0)
       POST_MEM_WRITE( arg2, res * sizeof(vki_gid_t) );
 }
 
-PREALIAS(getgroups32, getgroups);
-POSTALIAS(getgroups32, getgroups);
-
 PRE(getcwd)
 {
    // Note that this prototype is the kernel one, with a different return
@@ -2548,16 +2559,17 @@ POST(getrusage)
       VG_TRACK( post_mem_write,arg2, sizeof(struct vki_rusage) );
 }
 
-PRE(gettimeofday)
+PREx(sys_gettimeofday, 0)
 {
-   /* int gettimeofday(struct timeval *tv, struct timezone *tz); */
-   PRINT("gettimeofday ( %p, %p )",arg1,arg2);
+   PRINT("sys_gettimeofday ( %p, %p )", arg1,arg2);
+   PRE_REG_READ2(long, "gettimeofday",
+                 struct timeval *, tv, struct timezone *, tz);
    PRE_MEM_WRITE( "gettimeofday(tv)", arg1, sizeof(struct vki_timeval) );
    if (arg2 != 0)
       PRE_MEM_WRITE( "gettimeofday(tz)", arg2, sizeof(struct vki_timezone) );
 }
 
-POST(gettimeofday)
+POSTx(sys_gettimeofday)
 {
    if (res == 0) {
       POST_MEM_WRITE( arg1, sizeof(struct vki_timeval) );
@@ -2566,6 +2578,18 @@ POST(gettimeofday)
    }
 }
 
+PREx(sys_settimeofday, 0)
+{
+   PRINT("sys_settimeofday ( %p, %p )", arg1,arg2);
+   PRE_REG_READ2(long, "settimeofday",
+                 struct timeval *, tv, struct timezone *, tz);
+   PRE_MEM_READ( "settimeofday(tv)", arg1, sizeof(struct vki_timeval) );
+   if (arg2 != 0) {
+      PRE_MEM_READ( "settimeofday(tz)", arg2, sizeof(struct vki_timezone) );
+      /* maybe should warn if tz->tz_dsttime is non-zero? */
+   }
+}
+
 PREx(sys_getuid16, 0)
 {
    PRINT("sys_getuid16 ( )");
@@ -4883,24 +4907,28 @@ PREx(sys_setgid, 0)
    PRE_REG_READ1(long, "setgid", vki_gid_t, gid);
 }
 
-PREALIAS(setgid32, setgid);
-
 PREx(sys_setsid, 0)
 {
    PRINT("sys_setsid ( )");
    PRE_REG_READ0(long, "setsid");
 }
 
-PRE(setgroups)
+PREx(sys_setgroups16, 0)
+{
+   PRINT("sys_setgroups16 ( %llu, %p )", (ULong)arg1, arg2);
+   PRE_REG_READ2(long, "setgroups16", int, size, vki_old_gid_t *, list);
+   if (arg1 > 0)
+      PRE_MEM_READ( "setgroups16(list)", arg2, arg1 * sizeof(vki_old_gid_t) );
+}
+
+PREx(sys_setgroups, 0)
 {
-   /* int setgroups(size_t size, const gid_t *list); */
    PRINT("setgroups ( %llu, %p )", (ULong)arg1, arg2);
+   PRE_REG_READ2(long, "setgroups", int, size, vki_gid_t *, list);
    if (arg1 > 0)
       PRE_MEM_READ( "setgroups(list)", arg2, arg1 * sizeof(vki_gid_t) );
 }
 
-PREALIAS(setgroups32, setgroups);
-
 PREx(sys_setpgid, 0)
 {
    PRINT("setpgid ( %d, %d )", arg1, arg2);
@@ -4936,8 +4964,6 @@ PREx(sys_setreuid, 0)
    PRE_REG_READ2(long, "setreuid", vki_uid_t, ruid, vki_uid_t, euid);
 }
 
-PREALIAS(setreuid32, setreuid);
-
 PREx(sys_setrlimit, 0)
 {
    PRINT("sys_setrlimit ( %d, %p )", arg1,arg2);
@@ -4978,17 +5004,6 @@ PREx(sys_setrlimit, 0)
    }
 }
 
-PRE(settimeofday)
-{
-   /* int settimeofday(const struct timeval *tv, const struct timezone *tz); */
-   PRINT("settimeofday ( %p, %p )",arg1,arg2);
-   PRE_MEM_READ( "settimeofday(tv)", arg1, sizeof(struct vki_timeval) );
-   if (arg2 != 0) {
-      PRE_MEM_READ( "settimeofday(tz)", arg2, sizeof(struct vki_timezone) );
-      /* maybe should warn if tz->tz_dsttime is non-zero? */
-   }
-}
-
 PREx(sys_setuid16, 0)
 {
    PRINT("sys_setuid16 ( %d )", arg1);
@@ -5751,9 +5766,9 @@ PREx(sys_sigaction, SIG_SIM)
                  int, signum, const struct old_sigaction *, act,
                  struct old_sigaction *, oldact)
    if (arg2 != (UWord)NULL)
-      PRE_MEM_READ( "sigaction(act)", arg2, sizeof(struct vki_sigaction));
+      PRE_MEM_READ( "sigaction(act)", arg2, sizeof(struct vki_old_sigaction));
    if (arg3 != (UWord)NULL)
-      PRE_MEM_WRITE( "sigaction(oldact)", arg3, sizeof(struct vki_sigaction));
+      PRE_MEM_WRITE( "sigaction(oldact)", arg3, sizeof(struct vki_old_sigaction));
 
    if (SIGNAL_SIMULATION)
       VG_(do_sys_sigaction)(tid);
@@ -5762,11 +5777,33 @@ PREx(sys_sigaction, SIG_SIM)
 POSTx(sys_sigaction)
 {
    if (res == 0 && arg3 != (UWord)NULL)
-      POST_MEM_WRITE( arg3, sizeof(struct vki_sigaction));
+      POST_MEM_WRITE( arg3, sizeof(struct vki_old_sigaction));
 }
 
-PREALIASx(rt_sigaction, sys_sigaction);
-POSTALIASx(rt_sigaction, sys_sigaction);
+// XXX: x86-specific
+PREx(sys_rt_sigaction, SIG_SIM)
+{
+   PRINT("sys_rt_sigaction ( %d, %p, %p, %d )", arg1,arg2,arg3,arg4);
+   PRE_REG_READ4(long, "rt_sigaction",
+                 int, signum, const struct sigaction *, act,
+                 struct sigaction *, oldact,
+                 vki_size_t, sigsetsize);
+
+   if (arg2 != (UWord)NULL)
+      PRE_MEM_READ( "rt_sigaction(act)", arg2, sizeof(struct vki_sigaction));
+   if (arg3 != (UWord)NULL)
+      PRE_MEM_WRITE( "rt_sigaction(oldact)", arg3, sizeof(struct vki_sigaction));
+
+   // XXX: hmm... doesn't seem quite right...
+   if (SIGNAL_SIMULATION)
+      VG_(do_sys_sigaction)(tid);
+}
+
+POSTx(sys_rt_sigaction)
+{
+   if (res == 0 && arg3 != (UWord)NULL)
+      POST_MEM_WRITE( arg3, sizeof(struct vki_sigaction));
+}
 
 PRE(sigprocmask)
 {
@@ -6302,11 +6339,11 @@ static const struct sys_info sys_info[] = {
    SYSX_(__NR_setrlimit,        sys_setrlimit),       // 75 * (SVr4,BSD4.3)
    SYSXY(__NR_getrlimit,        sys_old_getrlimit),   // 76 * (SVr4,BSD4.3)
    SYSBA(__NR_getrusage,        sys_getrusage, 0),    // 77 *
-   SYSBA(__NR_gettimeofday,     sys_gettimeofday, 0), // 78 *
-   SYSB_(__NR_settimeofday,     sys_settimeofday, 0), // 79 *
+   SYSXY(__NR_gettimeofday,     sys_gettimeofday),    // 78 * P
+   SYSX_(__NR_settimeofday,     sys_settimeofday),    // 79 * almost-P
 
-   SYSBA(__NR_getgroups,        sys_getgroups16, 0), // 80 ##
-   SYSB_(__NR_setgroups,        sys_setgroups16, 0), // 81 ##
+   SYSXY(__NR_getgroups,        sys_getgroups16),     // 80 ## P
+   SYSX_(__NR_setgroups,        sys_setgroups16),     // 81 ## almost-P
    SYSB_(__NR_select,           old_select, MayBlock), // 82 old_select
    SYSB_(__NR_symlink,          sys_symlink, MayBlock), // 83 *
    //   (__NR_oldlstat,         sys_lstat),        // 84 * L -- obsolete
@@ -6418,8 +6455,8 @@ static const struct sys_info sys_info[] = {
    SYSB_(__NR_setresgid,        sys_setresgid16, 0), // 170 ##
    SYSBA(__NR_getresgid,        sys_getresgid16, 0), // 171 ##
    SYSB_(__NR_prctl,            sys_prctl, MayBlock), // 172 *
-   //   (__NR_rt_sigreturn,     sys_rt_sigreturn), // 173 () ()
-   SYSBA(__NR_rt_sigaction,     sys_rt_sigaction, SIG_SIM), // 174 
+   //   (__NR_rt_sigreturn,     sys_rt_sigreturn), // 173 (x86) ()
+   SYSXY(__NR_rt_sigaction,     sys_rt_sigaction), // 174 (x86) ()
 
    SYSBA(__NR_rt_sigprocmask,   sys_rt_sigprocmask, SIG_SIM), // 175 *
    SYSBA(__NR_rt_sigpending,    sys_rt_sigpending, NBRunInLWP), // 176 *
@@ -6458,8 +6495,8 @@ static const struct sys_info sys_info[] = {
    SYSX_(__NR_setreuid32,       sys_setreuid),     // 203 * (BSD4.3)
    SYSX_(__NR_setregid32,       sys_setregid),     // 204 * (BSD4.3)
 
-   SYSBA(__NR_getgroups32,      sys_getgroups, 0), // 205 *
-   SYSB_(__NR_setgroups32,      sys_setgroups, 0), // 206 *
+   SYSXY(__NR_getgroups32,      sys_getgroups),    // 205 * P
+   SYSX_(__NR_setgroups32,      sys_setgroups),    // 206 * almost-P
    SYSX_(__NR_fchown32,         sys_fchown),       // 207 * (SVr4,BSD4.3)
    SYSB_(__NR_setresuid32,      sys_setresuid, 0), // 208 *
    SYSBA(__NR_getresuid32,      sys_getresuid, 0), // 209 *
index aed2b725add37c7ccccedc3aacc3939b02e6e547..4f8b2ebd951f9d941c1e0ea044c476a9675eceb4 100644 (file)
@@ -156,11 +156,19 @@ typedef struct {
 #define VKI_SS_ONSTACK 1
 #define VKI_SS_DISABLE 2
 
-struct vki_sigaction {
+struct vki_old_sigaction {
         // [[Nb: a 'k' prefix is added to "sa_handler" because
         // bits/sigaction.h (which gets dragged in somehow via signal.h)
         // #defines it as something else.  Since that is done for glibc's
         // purposes, which we don't care about here, we use our own name.]]
+        __vki_sighandler_t ksa_handler;
+        vki_old_sigset_t sa_mask;
+        unsigned long sa_flags;
+        __vki_sigrestore_t sa_restorer;
+};
+
+struct vki_sigaction {
+        // [[See comment about extra 'k' above]]
        __vki_sighandler_t ksa_handler;
        unsigned long sa_flags;
        __vki_sigrestore_t sa_restorer;
index afd819d3cf80efe51af9d7cd63e3cd9ccd4156c2..ff316bbe3a5f7a4f6031a3950744c8203dfba017 100644 (file)
@@ -313,21 +313,22 @@ int main(void)
  //GO(__NR_getrusage, ".s .m");
  //SY(__NR_getrusage);
 
-   // __NR_gettimeofday 78
- //GO(__NR_gettimeofday, ".s .m");
- //SY(__NR_gettimeofday);
+   // __NR_gettimeofday 78 --> sys_gettimeofday()
+   // XXX: it succeeds when I give it two NULL pointers... kernel bug?
+// GO(__NR_gettimeofday, "2s 2m");
+// SY(__NR_gettimeofday, x0, x0);
 
-   // __NR_settimeofday 79
//GO(__NR_settimeofday, ".s .m");
//SY(__NR_settimeofday);
+   // __NR_settimeofday 79 --> sys_settimeofday()
  GO(__NR_settimeofday, "2s 2m");
  SY(__NR_settimeofday, x0, x0+1);
 
-   // __NR_getgroups 80
//GO(__NR_getgroups, ".s .m");
//SY(__NR_getgroups);
+   // __NR_getgroups 80 --> sys_getgroups16()
  GO(__NR_getgroups, "2s 1m");
  SY(__NR_getgroups, x0+1, x0+1);
 
-   // __NR_setgroups 81
//GO(__NR_setgroups, ".s .m");
//SY(__NR_setgroups);
+   // __NR_setgroups 81 --> sys_setgroups16()
  GO(__NR_setgroups, "2s 1m");
  SY(__NR_setgroups, x0+1, x0+1);
 
    // __NR_select 82
  //GO(__NR_select, ".s .m");
@@ -691,9 +692,9 @@ int main(void)
  //GO(__NR_rt_sigreturn, ".s .m");
  //SY(__NR_rt_sigreturn);
 
-   // __NR_rt_sigaction 174
//GO(__NR_rt_sigaction, ".s .m");
//SY(__NR_rt_sigaction);
+   // __NR_rt_sigaction 174 --> sys_rt_sigaction()
  GO(__NR_rt_sigaction, "4s 2m");
  SY(__NR_rt_sigaction, x0, x0+1, x0+1, x0);
 
    // __NR_rt_sigprocmask 175
  //GO(__NR_rt_sigprocmask, ".s .m");
@@ -815,13 +816,13 @@ int main(void)
    GO(__NR_setregid32, "2s 0m");
    SY(__NR_setregid32, x0, x0);
 
-   // __NR_getgroups32 205
//GO(__NR_getgroups32, ".s .m");
//SY(__NR_getgroups32);
+   // __NR_getgroups32 205 --> sys_getgroups()
  GO(__NR_getgroups32, "2s 1m");
  SY(__NR_getgroups32, x0+1, x0+1);
 
-   // __NR_setgroups32 206
//GO(__NR_setgroups32, ".s .m");
//SY(__NR_setgroups32);
+   // __NR_setgroups32 206 --> sys_setgroups()
  GO(__NR_setgroups32, "2s 1m");
  SY(__NR_setgroups32, x0+1, x0+1);
 
    // __NR_fchown32 207 --> sys_fchown()
    GO(__NR_fchown32, "3s 0m");
index c59c47332a36f601e70e13cfb1e22c2b91646794..ae3d491db87ecb247469b21e5fcf318265202e14 100644 (file)
@@ -846,6 +846,69 @@ Syscall param old_getrlimit(rlim) points to unaddressable byte(s)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+ 79:   __NR_settimeofday 2s 2m
+-----------------------------------------------------
+
+Syscall param settimeofday(tv) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param settimeofday(tz) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param settimeofday(tv) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param settimeofday(tz) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+ 80:      __NR_getgroups 2s 1m
+-----------------------------------------------------
+
+Syscall param getgroups16(size) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param getgroups16(list) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param getgroups16(list) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+ 81:      __NR_setgroups 2s 1m
+-----------------------------------------------------
+
+Syscall param setgroups16(size) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param setgroups16(list) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param setgroups16(list) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
 -----------------------------------------------------
  95:         __NR_fchown 3s 0m
 -----------------------------------------------------
@@ -985,6 +1048,41 @@ Syscall param setfsgid16(gid) contains uninitialised byte(s)
 167:   __NR_query_module 0e
 -----------------------------------------------------
 -----------------------------------------------------
+174:   __NR_rt_sigaction 4s 2m
+-----------------------------------------------------
+
+Syscall param rt_sigaction(signum) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param rt_sigaction(act) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param rt_sigaction(oldact) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param rt_sigaction(sigsetsize) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param rt_sigaction(act) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param rt_sigaction(oldact) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
 182:          __NR_chown 3s 1m
 -----------------------------------------------------
 
@@ -1159,6 +1257,44 @@ Syscall param setregid(egid) contains uninitialised byte(s)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 -----------------------------------------------------
+205:    __NR_getgroups32 2s 1m
+-----------------------------------------------------
+
+Syscall param getgroups(size) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param getgroups(list) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param getgroups(list) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+206:    __NR_setgroups32 2s 1m
+-----------------------------------------------------
+
+Syscall param setgroups(size) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param setgroups(list) contains uninitialised byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+
+Syscall param setgroups(list) points to unaddressable byte(s)
+   at 0x........: syscall (in /...libc...)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
 207:       __NR_fchown32 3s 0m
 -----------------------------------------------------