Hello community,

here is the log from the commit of package trinity for openSUSE:Factory checked 
in at 2015-02-18 11:39:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/trinity (Old)
 and      /work/SRC/openSUSE:Factory/.trinity.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "trinity"

Changes:
--------
--- /work/SRC/openSUSE:Factory/trinity/trinity.changes  2015-01-15 
15:59:08.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.trinity.new/trinity.changes     2015-02-18 
12:09:25.000000000 +0100
@@ -1,0 +2,5 @@
+Tue Feb 17 20:37:26 UTC 2015 - [email protected]
+
+- Update to 20150215
+
+-------------------------------------------------------------------

Old:
----
  trinity-20150107.tar.xz

New:
----
  trinity-20150215.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ trinity.spec ++++++
--- /var/tmp/diff_new_pack.SCOJby/_old  2015-02-18 12:09:26.000000000 +0100
+++ /var/tmp/diff_new_pack.SCOJby/_new  2015-02-18 12:09:26.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package trinity
 #
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           trinity
-Version:        20150107
+Version:        20150215
 Release:        0
 Summary:        A Linux System call fuzz tester
 License:        GPL-2.0

++++++ trinity-20150107.tar.xz -> trinity-20150215.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/Makefile 
new/trinity-20150215/Makefile
--- old/trinity-20150107/Makefile       2015-01-14 16:12:54.000000000 +0100
+++ new/trinity-20150215/Makefile       2015-02-17 21:35:00.000000000 +0100
@@ -2,6 +2,7 @@
 
 INSTALL_PREFIX ?= $(DESTDIR)
 INSTALL_PREFIX ?= $(HOME)
+NR_CPUS := $(shell grep ^processor /proc/cpuinfo | /usr/bin/wc -l)
 
 ifeq ($(CC),"")
 CC := gcc
@@ -140,6 +141,6 @@
 
 coverity:
        @rm -rf cov-int trinity-coverity.tar.xz
-       @cov-build --dir cov-int make
+       @cov-build --dir cov-int make -j $(NR_CPUS)
        @tar cJvf trinity-coverity.tar.xz cov-int
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/include/compat.h 
new/trinity-20150215/include/compat.h
--- old/trinity-20150107/include/compat.h       2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/include/compat.h       2015-02-17 21:35:00.000000000 
+0100
@@ -279,6 +279,11 @@
 #define PR_GET_THP_DISABLE      42
 #endif
 
+#ifndef PR_MPX_ENABLE_MANAGEMENT
+#define PR_MPX_ENABLE_MANAGEMENT  43
+#define PR_MPX_DISABLE_MANAGEMENT 44
+#endif
+
 /* linux/rds.h */
 #ifndef RDS_CANCEL_SENT_TO
 #define RDS_CANCEL_SENT_TO              1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/include/perf_event.h 
new/trinity-20150215/include/perf_event.h
--- old/trinity-20150107/include/perf_event.h   2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/include/perf_event.h   2015-02-17 21:35:00.000000000 
+0100
@@ -136,8 +136,9 @@
        PERF_SAMPLE_DATA_SRC                    = 1U << 15,
        PERF_SAMPLE_IDENTIFIER                  = 1U << 16,
        PERF_SAMPLE_TRANSACTION                 = 1U << 17,
+       PERF_SAMPLE_REGS_INTR                   = 1U << 18,
 
-       PERF_SAMPLE_MAX = 1U << 18,             /* non-ABI */
+       PERF_SAMPLE_MAX = 1U << 19,             /* non-ABI */
 };
 
 /*
@@ -237,6 +238,7 @@
 #define PERF_ATTR_SIZE_VER2    80      /* add: branch_sample_type */
 #define PERF_ATTR_SIZE_VER3    96      /* add: sample_regs_user */
                                        /* add: sample_stack_user */
+#define PERF_ATTR_SIZE_VER4    104     /* add: sample_regs_intr */
 
 /*
  * Hardware event_id to monitor via a performance monitoring event:
@@ -333,6 +335,15 @@
 
        /* Align to u64. */
        __u32   __reserved_2;
+       /*
+        * Defines set of regs to dump for each sample
+        * state captured on:
+        *  - precise = 0: PMU interrupt
+        *  - precise > 0: sampled instruction
+        *
+        * See asm/perf_regs.h for details.
+        */
+       __u64   sample_regs_intr;
 };
 
 #define perf_flags(attr)       (*(&(attr)->read_format + 1))
@@ -363,7 +374,7 @@
        /*
         * Bits needed to read the hw events in user-space.
         *
-        *   u32 seq, time_mult, time_shift, idx, width;
+        *   u32 seq, time_mult, time_shift, index, width;
         *   u64 count, enabled, running;
         *   u64 cyc, time_offset;
         *   s64 pmc = 0;
@@ -382,11 +393,11 @@
         *       time_shift  = pc->time_shift;
         *     }
         *
-        *     idx = pc->index;
+        *     index = pc->index;
         *     count = pc->offset;
-        *     if (pc->cap_usr_rdpmc && idx) {
+        *     if (pc->cap_user_rdpmc && index) {
         *       width = pc->pmc_width;
-        *       pmc = rdpmc(idx - 1);
+        *       pmc = rdpmc(index - 1);
         *     }
         *
         *     barrier();
@@ -414,7 +425,7 @@
        };
 
        /*
-        * If cap_usr_rdpmc this field provides the bit-width of the value
+        * If cap_user_rdpmc this field provides the bit-width of the value
         * read using the rdpmc() or equivalent instruction. This can be used
         * to sign extend the result like:
         *
@@ -438,10 +449,10 @@
         *
         * Where time_offset,time_mult,time_shift and cyc are read in the
         * seqcount loop described above. This delta can then be added to
-        * enabled and possible running (if idx), improving the scaling:
+        * enabled and possible running (if index), improving the scaling:
         *
         *   enabled += delta;
-        *   if (idx)
+        *   if (index)
         *     running += delta;
         *
         *   quot = count / running;
@@ -685,6 +696,8 @@
         *      { u64                   weight;   } && PERF_SAMPLE_WEIGHT
         *      { u64                   data_src; } && PERF_SAMPLE_DATA_SRC
         *      { u64                   transaction; } && 
PERF_SAMPLE_TRANSACTION
+        *      { u64                   abi; # enum perf_sample_regs_abi
+        *        u64                   regs[weight(mask)]; } && 
PERF_SAMPLE_REGS_INTR
         * };
         */
        PERF_RECORD_SAMPLE                      = 9,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/include/syscalls-arm.h 
new/trinity-20150215/include/syscalls-arm.h
--- old/trinity-20150107/include/syscalls-arm.h 2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/include/syscalls-arm.h 2015-02-17 21:35:00.000000000 
+0100
@@ -397,4 +397,5 @@
                { .entry = &syscall_getrandom },
 /* 385 */      { .entry = &syscall_memfd_create },
                { .entry = &syscall_bpf },
+               { .entry = &syscall_execveat },
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/include/utils.h 
new/trinity-20150215/include/utils.h
--- old/trinity-20150107/include/utils.h        2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/include/utils.h        2015-02-17 21:35:00.000000000 
+0100
@@ -48,6 +48,8 @@
 
 void kill_pid(pid_t pid);
 
+void freeptr(unsigned long *p);
+
 #define __stringify_1(x...)     #x
 #define __stringify(x...)       __stringify_1(x)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/random.c 
new/trinity-20150215/random.c
--- old/trinity-20150107/random.c       2015-01-14 16:12:54.000000000 +0100
+++ new/trinity-20150215/random.c       2015-02-17 21:35:00.000000000 +0100
@@ -90,51 +90,6 @@
 }
 
 /*
- * Based on very similar routine stolen from iknowthis. Thanks Tavis.
- */
-static unsigned long taviso(void)
-{
-       unsigned long r = 0;
-       unsigned long temp;
-
-       switch (rand() % 4) {
-       case 0: r = rand() & rand();
-#if __WORDSIZE == 64
-               r <<= 32;
-               r |= rand() & rand();
-#endif
-               break;
-
-       case 1: temp = rand();
-               r = rand();
-               if (temp) r %= temp;
-#if __WORDSIZE == 64
-               r <<= 32;
-
-               temp = rand();
-               if (temp) r |= rand() % temp;
-#endif
-               break;
-
-       case 2: r = rand() | rand();
-#if __WORDSIZE == 64
-               r <<= 32;
-               r |= rand() | rand();
-#endif
-               break;
-
-       case 3: r = rand();
-#if __WORDSIZE == 64
-               r <<= 32;
-               r |= rand();
-#endif
-               break;
-       }
-
-       return r;
-}
-
-/*
  * Pick 8 random bytes, and concatenate them into a long.
  */
 static unsigned long rand8x8(void)
@@ -172,20 +127,18 @@
 {
        unsigned long r = 0;
 
-       switch (rand() % 7) {
+       switch (rand() % 6) {
        case 0: r = rand_single_bit(32);
                break;
        case 1: r = randbits(32);
                break;
        case 2: r = rand();
                break;
-       case 3: r = taviso();
-               break;
-       case 4: r = rand8x8();
+       case 3: r = rand8x8();
                break;
-       case 5: r = rept8(4);
+       case 4: r = rept8(4);
                break;
-       case 6: return get_interesting_32bit_value();
+       case 5: return get_interesting_32bit_value();
        }
 
        return r;
@@ -258,21 +211,19 @@
 
        } else {
                /* 33:64-bit ranges. */
-               switch (rand() % 7) {
+               switch (rand() % 6) {
                case 0: r = rand_single_bit(64);
                        break;
                case 1: r = randbits(64);
                        break;
                case 2: r = rand32() | rand32() << 31;
                        break;
-               case 3: r = taviso();
-                       break;
-               case 4: r = rand8x8();
+               case 3: r = rand8x8();
                        break;
-               case 5: r = rept8(8);
+               case 4: r = rept8(8);
                        break;
                /* Sometimes pick a not-so-random number. */
-               case 6: return get_interesting_value();
+               case 5: return get_interesting_value();
                }
 
                /* limit the size */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/mincore.c 
new/trinity-20150215/syscalls/mincore.c
--- old/trinity-20150107/syscalls/mincore.c     2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/mincore.c     2015-02-17 21:35:00.000000000 
+0100
@@ -24,7 +24,7 @@
 
 static void post_mincore(struct syscallrecord *rec)
 {
-       free((void *) rec->a3);
+       freeptr(&rec->a3);
 }
 
 struct syscallentry syscall_mincore = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/modify_ldt.c 
new/trinity-20150215/syscalls/modify_ldt.c
--- old/trinity-20150107/syscalls/modify_ldt.c  2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/modify_ldt.c  2015-02-17 21:35:00.000000000 
+0100
@@ -16,11 +16,10 @@
 
 #define ALLOCSIZE LDT_ENTRIES * LDT_ENTRY_SIZE
 
-static void *ldt;
-
 static void sanitise_modify_ldt(struct syscallrecord *rec)
 {
        //struct user_desc *desc;
+       void *ldt;
 
        switch (rec->a1) {
        case 0:
@@ -32,6 +31,7 @@
                break;
 
        case 1:
+               rec->a2 = 0L;
                /* modify one ldt entry.
                 * ptr points to a user_desc structure
                 * bytecount must equal the size of this structure. */
@@ -49,14 +49,14 @@
        */
                break;
        default:
+               rec->a2 = 0L;
                break;
        }
 }
 
 static void post_modify_ldt(__unused__ struct syscallrecord *rec)
 {
-       free(ldt);
-       ldt = NULL;
+       freeptr(&rec->a2);
 }
 
 struct syscallentry syscall_modify_ldt = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/move_pages.c 
new/trinity-20150215/syscalls/move_pages.c
--- old/trinity-20150107/syscalls/move_pages.c  2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/move_pages.c  2015-02-17 21:35:00.000000000 
+0100
@@ -62,9 +62,9 @@
 
 static void post_move_pages(struct syscallrecord *rec)
 {
-       free((void *) rec->a3);
-       free((void *) rec->a4);
-       free((void *) rec->a5);
+       freeptr(&rec->a3);
+       freeptr(&rec->a4);
+       freeptr(&rec->a5);
 }
 
 struct syscallentry syscall_move_pages = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/perf_event_open.c 
new/trinity-20150215/syscalls/perf_event_open.c
--- old/trinity-20150107/syscalls/perf_event_open.c     2015-01-14 
16:12:54.000000000 +0100
+++ new/trinity-20150215/syscalls/perf_event_open.c     2015-02-17 
21:35:00.000000000 +0100
@@ -870,6 +870,8 @@
                sample_type |= PERF_SAMPLE_IDENTIFIER;
        if (rand_bool())
                sample_type |= PERF_SAMPLE_TRANSACTION;
+       if (rand_bool())
+               sample_type |= PERF_SAMPLE_REGS_INTR;
 
        return sample_type;
 }
@@ -898,7 +900,7 @@
 
        int size=0;
 
-       switch(rand() % 8) {
+       switch(rand() % 9) {
        case 0: size = PERF_ATTR_SIZE_VER0;
                break;
        case 1: size = PERF_ATTR_SIZE_VER1;
@@ -907,13 +909,15 @@
                break;
        case 3: size = PERF_ATTR_SIZE_VER3;
                break;
-       case 4: size = sizeof(struct perf_event_attr);
+       case 4: size = PERF_ATTR_SIZE_VER4;
+               break;
+       case 5: size = sizeof(struct perf_event_attr);
                break;
-       case 5: size = rand32();
+       case 6: size = rand32();
                break;
-       case 6: size = get_len();
+       case 7: size = get_len();
                break;
-       case 7: size = 0;
+       case 8: size = 0;
                break;
        default:
                break;
@@ -1302,7 +1306,7 @@
 
 static void post_perf_event_open(struct syscallrecord *rec)
 {
-       free((void *) rec->a1);
+       freeptr(&rec->a1);
 }
 
 struct syscallentry syscall_perf_event_open = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/poll.c 
new/trinity-20150215/syscalls/poll.c
--- old/trinity-20150107/syscalls/poll.c        2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/poll.c        2015-02-17 21:35:00.000000000 
+0100
@@ -30,7 +30,7 @@
 
 static void post_poll(struct syscallrecord *rec)
 {
-       free((void *) rec->a1);
+       freeptr(&rec->a1);
 }
 
 struct syscallentry syscall_poll = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/prctl.c 
new/trinity-20150215/syscalls/prctl.c
--- old/trinity-20150107/syscalls/prctl.c       2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/prctl.c       2015-02-17 21:35:00.000000000 
+0100
@@ -21,18 +21,20 @@
 #include "utils.h"
 #include "compat.h"
 
-#define NR_PRCTL_OPTS 36
-static int prctl_opts[NR_PRCTL_OPTS] = {
-       PR_CAPBSET_READ, PR_CAPBSET_DROP, PR_SET_DUMPABLE, PR_GET_DUMPABLE,
-       PR_SET_ENDIAN, PR_GET_ENDIAN, PR_SET_FPEMU, PR_GET_FPEMU,
-       PR_SET_FPEXC, PR_GET_FPEXC, PR_SET_KEEPCAPS, PR_GET_KEEPCAPS,
-       PR_SET_NAME, PR_GET_NAME, PR_SET_PDEATHSIG, PR_GET_PDEATHSIG,
-       PR_SET_SECCOMP, PR_GET_SECCOMP, PR_SET_SECUREBITS, PR_GET_SECUREBITS,
-       PR_SET_TIMING, PR_GET_TIMING, PR_SET_TSC, PR_GET_TSC,
-       PR_SET_UNALIGN, PR_GET_UNALIGN, PR_MCE_KILL, PR_MCE_KILL_GET,
+static int prctl_opts[] = {
+       PR_SET_PDEATHSIG, PR_GET_PDEATHSIG, PR_GET_DUMPABLE, PR_SET_DUMPABLE,
+       PR_GET_UNALIGN, PR_SET_UNALIGN, PR_GET_KEEPCAPS, PR_SET_KEEPCAPS,
+       PR_GET_FPEMU, PR_SET_FPEMU, PR_GET_FPEXC, PR_SET_FPEXC,
+       PR_GET_TIMING, PR_SET_TIMING, PR_SET_NAME, PR_GET_NAME,
+       PR_GET_ENDIAN, PR_SET_ENDIAN, PR_GET_SECCOMP, PR_SET_SECCOMP,
+       PR_CAPBSET_READ, PR_CAPBSET_DROP, PR_GET_TSC, PR_SET_TSC,
+       PR_GET_SECUREBITS, PR_SET_SECUREBITS, PR_SET_TIMERSLACK, 
PR_GET_TIMERSLACK,
+       PR_TASK_PERF_EVENTS_DISABLE, PR_TASK_PERF_EVENTS_ENABLE, PR_MCE_KILL, 
PR_MCE_KILL_GET,
        PR_SET_MM, PR_SET_CHILD_SUBREAPER, PR_GET_CHILD_SUBREAPER, 
PR_SET_NO_NEW_PRIVS,
        PR_GET_NO_NEW_PRIVS, PR_GET_TID_ADDRESS, PR_SET_THP_DISABLE, 
PR_GET_THP_DISABLE,
+       PR_MPX_ENABLE_MANAGEMENT, PR_MPX_DISABLE_MANAGEMENT,
 };
+#define NR_PRCTL_OPTS ARRAY_SIZE(prctl_opts)
 
 
 #ifdef USE_SECCOMP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/select.c 
new/trinity-20150215/syscalls/select.c
--- old/trinity-20150107/syscalls/select.c      2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/select.c      2015-02-17 21:35:00.000000000 
+0100
@@ -49,10 +49,10 @@
 
 static void post_select(struct syscallrecord *rec)
 {
-       free((void *) rec->a2);
-       free((void *) rec->a3);
-       free((void *) rec->a4);
-       free((void *) rec->a5);
+       freeptr(&rec->a2);
+       freeptr(&rec->a3);
+       freeptr(&rec->a4);
+       freeptr(&rec->a5);
 }
 
 struct syscallentry syscall_select = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/send.c 
new/trinity-20150215/syscalls/send.c
--- old/trinity-20150107/syscalls/send.c        2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/send.c        2015-02-17 21:35:00.000000000 
+0100
@@ -14,15 +14,40 @@
 #include "utils.h"
 #include "compat.h"
 
+static void sanitise_send(struct syscallrecord *rec)
+{
+       unsigned int size;
+       void *ptr;
+
+       if (rand_bool())
+               size = 1;
+       else
+               size = rand() % page_size;
+
+       ptr = malloc(size);
+       if (ptr == NULL)
+               return;
+
+       rec->a2 = (unsigned long) ptr;
+       rec->a3 = size;
+
+       // TODO: only use this as a fallback, and actually have
+       // some per-proto generators here.
+       generate_rand_bytes(ptr, size);
+}
+
+static void post_send(struct syscallrecord *rec)
+{
+       freeptr(&rec->a2);
+}
+
 struct syscallentry syscall_send = {
        .name = "send",
        .num_args = 4,
        .arg1name = "fd",
        .arg1type = ARG_FD,
        .arg2name = "buff",
-       .arg2type = ARG_ADDRESS,
        .arg3name = "len",
-       .arg3type = ARG_LEN,
        .arg4name = "flags",
         .arg4type = ARG_LIST,
        .arg4list = {
@@ -34,6 +59,8 @@
                            MSG_WAITFORONE, MSG_FASTOPEN, MSG_CMSG_CLOEXEC, 
MSG_CMSG_COMPAT,
                },
        },
+       .sanitise = sanitise_send,
+       .post = post_send,
 };
 
 
@@ -66,15 +93,16 @@
        .arg6name = "addr_len",
        .arg6type = ARG_SOCKADDRLEN,
        .flags = NEED_ALARM,
+       .sanitise = sanitise_send,
+       .post = post_send,
 };
 
-static struct msghdr *msg;
-
 /*
  * SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, 
flags)
  */
 static void sanitise_sendmsg(struct syscallrecord *rec)
 {
+       struct msghdr *msg;
        struct sockaddr *sa = NULL;
        socklen_t salen;
 
@@ -96,9 +124,11 @@
 
 static void post_sendmsg(__unused__ struct syscallrecord *rec)
 {
+       struct msghdr *msg = (struct msghdr *) rec->a2;
+
        if (msg != NULL) {
                free(msg->msg_name);    // free sockaddr
-               free(msg);
+               freeptr(&rec->a2);
        }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/setsockopt.c 
new/trinity-20150215/syscalls/setsockopt.c
--- old/trinity-20150107/syscalls/setsockopt.c  2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/setsockopt.c  2015-02-17 21:35:00.000000000 
+0100
@@ -131,7 +131,7 @@
 
 static void post_setsockopt(struct syscallrecord *rec)
 {
-       free((void *) rec->a4);
+       freeptr(&rec->a4);
 }
 
 struct syscallentry syscall_setsockopt = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/socketpair.c 
new/trinity-20150215/syscalls/socketpair.c
--- old/trinity-20150107/syscalls/socketpair.c  2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/socketpair.c  2015-02-17 21:35:00.000000000 
+0100
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <sys/socket.h>
 #include "sanitise.h"
+#include "utils.h"
 
 static void sanitise_socketpair(struct syscallrecord *rec)
 {
@@ -13,13 +14,10 @@
 
 static void post_socketpair(struct syscallrecord *rec)
 {
-       void *ptr;
-
        //TODO: on success we should put the fd's that
        // were created into a child-local fd array.
 
-       ptr = (void *) rec->a4;
-       free(ptr);
+       freeptr(&rec->a4);
 }
 
 struct syscallentry syscall_socketpair = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/syscalls/write.c 
new/trinity-20150215/syscalls/write.c
--- old/trinity-20150107/syscalls/write.c       2015-01-14 16:12:54.000000000 
+0100
+++ new/trinity-20150215/syscalls/write.c       2015-02-17 21:35:00.000000000 
+0100
@@ -9,19 +9,36 @@
 #include "shm.h"
 #include "syscall.h"
 #include "trinity.h"
+#include "utils.h"
 
 static void sanitise_write(struct syscallrecord *rec)
 {
+       unsigned int size;
+       void *ptr;
+
        if (rand_bool())
-               rec->a3 = 1;
+               size = 1;
        else
-               rec->a3 = rand() % page_size;
+               size = rand() % page_size;
+
+       ptr = malloc(size);
+       if (ptr == NULL)
+               return;
+
+       generate_rand_bytes(ptr, size);
+
+       rec->a2 = (unsigned long) ptr;
+       rec->a3 = size;
+}
+
+static void post_write(struct syscallrecord *rec)
+{
+       freeptr(&rec->a2);
 }
 
 struct syscallentry syscall_write = {
        .name = "write",
        .num_args = 3,
-       .sanitise = sanitise_write,
        .arg1name = "fd",
        .arg1type = ARG_FD,
        .arg2name = "buf",
@@ -29,6 +46,8 @@
        .arg3name = "count",
        .arg3type = ARG_LEN,
        .flags = NEED_ALARM,
+       .sanitise = sanitise_write,
+       .post     = post_write,
 };
 
 /*
@@ -54,6 +73,7 @@
 
 static void sanitise_pwrite64(struct syscallrecord *rec)
 {
+       sanitise_write(rec);
 
 retry_pos:
        if ((int) rec->a4 < 0) {
@@ -65,7 +85,6 @@
 struct syscallentry syscall_pwrite64 = {
        .name = "pwrite64",
        .num_args = 4,
-       .sanitise = sanitise_pwrite64,
        .arg1name = "fd",
        .arg1type = ARG_FD,
        .arg2name = "buf",
@@ -74,6 +93,8 @@
        .arg3type = ARG_LEN,
        .arg4name = "pos",
        .flags = NEED_ALARM,
+       .sanitise = sanitise_pwrite64,
+       .post     = post_write,
 };
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trinity-20150107/utils.c new/trinity-20150215/utils.c
--- old/trinity-20150107/utils.c        2015-01-14 16:12:54.000000000 +0100
+++ new/trinity-20150215/utils.c        2015-02-17 21:35:00.000000000 +0100
@@ -86,3 +86,12 @@
        if (ret != 0)
                debugf("couldn't kill pid %d [%s]\n", pid, strerror(errno));
 }
+
+void freeptr(unsigned long *p)
+{
+       void *ptr = (void *) *p;
+
+       if (ptr != NULL)
+               free(ptr);
+       *p = 0L;
+}

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to