Hello community, here is the log from the commit of package trinity for openSUSE:Factory checked in at 2018-03-11 15:25:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/trinity (Old) and /work/SRC/openSUSE:Factory/.trinity.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "trinity" Sun Mar 11 15:25:56 2018 rev:50 rq:585238 version:1.9+git.20180228 Changes: -------- --- /work/SRC/openSUSE:Factory/trinity/trinity.changes 2018-02-09 15:51:10.867558336 +0100 +++ /work/SRC/openSUSE:Factory/.trinity.new/trinity.changes 2018-03-11 15:26:09.673256693 +0100 @@ -1,0 +2,14 @@ +Sat Mar 10 07:18:00 UTC 2018 - [email protected] + +- Update to version 1.9+git.20180228: + * suppress packed warning + * add sgxv2 + * add ioctl pattern for sgx driver + * trinity: Add support for s390_sthyi svc + * trinity: Add support for s390_guarded_storage svc + * trinity: Add support for s390_pci_mmio_read and write + * trinity: Add support for runtime_instr svc +- add memfd-do-not-redefine-memfd_create.patch +- add mlock-move-MLOCK_ONFAULT-to-compat.h.patch + +------------------------------------------------------------------- Old: ---- trinity-1.9+git.20180206.tar.xz New: ---- memfd-do-not-redefine-memfd_create.patch mlock-move-MLOCK_ONFAULT-to-compat.h.patch trinity-1.9+git.20180228.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ trinity.spec ++++++ --- /var/tmp/diff_new_pack.7h7cHC/_old 2018-03-11 15:26:10.361232012 +0100 +++ /var/tmp/diff_new_pack.7h7cHC/_new 2018-03-11 15:26:10.361232012 +0100 @@ -16,15 +16,17 @@ # -%define version_unconverted 1.9+git.20180206 +%define version_unconverted 1.9+git.20180228 Name: trinity -Version: 1.9+git.20180206 +Version: 1.9+git.20180228 Release: 0 Summary: A Linux System call fuzz tester License: GPL-2.0 Group: Development/Tools/Other -URL: http://codemonkey.org.uk/projects/trinity/ +Url: http://codemonkey.org.uk/projects/trinity/ Source0: %{name}-%{version}.tar.xz +Patch0: memfd-do-not-redefine-memfd_create.patch +Patch1: mlock-move-MLOCK_ONFAULT-to-compat.h.patch ExcludeArch: %ix86 %arm %description @@ -35,6 +37,8 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build export CFLAGS="%{optflags}" ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.7h7cHC/_old 2018-03-11 15:26:10.405230434 +0100 +++ /var/tmp/diff_new_pack.7h7cHC/_new 2018-03-11 15:26:10.409230291 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/kernelslacker/trinity</param> - <param name="changesrevision">b9a7bd002a384513f230ffa21cc785e7dbf32fdb</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">c07cd60f942e2b4b96bd9a401d3129760a6ac308</param></service></servicedata> \ No newline at end of file ++++++ memfd-do-not-redefine-memfd_create.patch ++++++ From: Jiri Slaby <[email protected]> Date: Sat, 10 Mar 2018 08:14:35 +0100 Subject: memfd: do not redefine memfd_create Patch-mainline: submitted on 10/03/2018 memfd_create got defined in mman-shared.h and we get errors now: fds/memfd.c:19:12: error: static declaration of 'memfd_create' follows non-static declaration static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag) ^~~~~~~~~~~~ In file included from /usr/include/bits/mman-linux.h:115:0, from /usr/include/bits/mman.h:45, from /usr/include/sys/mman.h:41, from include/utils.h:4, from include/syscall.h:7, from include/child.h:7, from include/fd.h:3, from fds/memfd.c:9: /usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here int memfd_create (const char *__name, unsigned int __flags) __THROW; ^~~~~~~~~~~~ So define the local "memfd_create" as "trin_memfd_create" instead. Signed-off-by: Jiri Slaby <[email protected]> --- fds/memfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fds/memfd.c b/fds/memfd.c index 210678e4571c..9d04bf97c632 100644 --- a/fds/memfd.c +++ b/fds/memfd.c @@ -16,7 +16,7 @@ #include "trinity.h" #include "udp.h" -static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag) +static int trin_memfd_create(__unused__ const char *uname, __unused__ unsigned int flag) { #ifdef SYS_memfd_create return syscall(SYS_memfd_create, uname, flag); @@ -69,7 +69,7 @@ static int open_memfd_fds(void) sprintf(namestr, "memfd%u", i + 1); - fd = memfd_create(namestr, flags[i]); + fd = trin_memfd_create(namestr, flags[i]); if (fd < 0) continue; -- 2.16.2 ++++++ mlock-move-MLOCK_ONFAULT-to-compat.h.patch ++++++ From: Jiri Slaby <[email protected]> Date: Sat, 10 Mar 2018 08:23:03 +0100 Subject: mlock: move MLOCK_ONFAULT to compat.h Patch-mainline: no It got defined in our headers, so it causes build failures: syscalls/mlock.c:30:0: error: "MLOCK_ONFAULT" redefined [-Werror] #define MLOCK_ONFAULT 0x01 In file included from /usr/include/bits/mman-linux.h:115:0, from /usr/include/bits/mman.h:45, from /usr/include/sys/mman.h:41, from include/utils.h:4, from include/syscall.h:7, from include/child.h:7, from include/shm.h:4, from syscalls/mlock.c:6: /usr/include/bits/mman-shared.h:33:0: note: this is the location of the previous definition # define MLOCK_ONFAULT 1U So move it out of our way. Signed-off-by: Jiri Slaby <[email protected]> --- include/compat.h | 5 +++++ syscalls/mlock.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/compat.h b/include/compat.h index fc9a1b95ac4c..fce3a873e415 100644 --- a/include/compat.h +++ b/include/compat.h @@ -1186,6 +1186,11 @@ struct kvm_get_htab_fd { #define POLL_BUSY_LOOP 0x8000 #endif +/* asm/mman.h */ +#ifndef MLOCK_ONFAULT +#define MLOCK_ONFAULT 0x01 +#endif + /* linux/nvme_ioctl.h */ #ifndef NVME_IOCTL_RESET #define NVME_IOCTL_RESET _IO('N', 0x44) diff --git a/syscalls/mlock.c b/syscalls/mlock.c index a08836ffdc43..6a2aef16ed27 100644 --- a/syscalls/mlock.c +++ b/syscalls/mlock.c @@ -7,6 +7,7 @@ #include "sanitise.h" #include "syscall.h" #include "trinity.h" +#include "compat.h" static void sanitise_mlock(__unused__ struct syscallrecord *rec) { @@ -27,8 +28,6 @@ struct syscallentry syscall_mlock = { * SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags) */ -#define MLOCK_ONFAULT 0x01 - struct syscallentry syscall_mlock2 = { .name = "mlock2", .num_args = 2, -- 2.16.2 ++++++ trinity-1.9+git.20180206.tar.xz -> trinity-1.9+git.20180228.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/Makefile new/trinity-1.9+git.20180228/Makefile --- old/trinity-1.9+git.20180206/Makefile 2018-02-06 16:06:28.000000000 +0100 +++ new/trinity-1.9+git.20180228/Makefile 2018-03-01 05:54:30.000000000 +0100 @@ -87,6 +87,7 @@ syscalls/x86/x86_64/*.c;; \ (i?86*) echo syscalls/x86/*.c \ syscalls/x86/i386/*.c;; \ + (s390x*) echo syscalls/s390x/*.c ;; \ esac) VERSION_H := include/version.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/include/syscalls-s390.h new/trinity-1.9+git.20180228/include/syscalls-s390.h --- old/trinity-1.9+git.20180206/include/syscalls-s390.h 2018-02-06 16:06:28.000000000 +0100 +++ new/trinity-1.9+git.20180228/include/syscalls-s390.h 2018-03-01 05:54:30.000000000 +0100 @@ -349,7 +349,7 @@ { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_runtime_instr */ + { .entry = &syscall_runtime_instr }, /* s390_runtime_instr svc */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, @@ -363,8 +363,8 @@ #else { .entry = NULL }, #endif - { .entry = &syscall_ni_syscall }, /* TODO: s390_pci_mmio_write svc */ - { .entry = &syscall_ni_syscall }, /* TODO: s390_pci_mmio_read svc */ + { .entry = &syscall_s390_pci_mmio_write }, + { .entry = &syscall_s390_pci_mmio_read }, { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, @@ -389,7 +389,7 @@ { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_guarded_storage svc */ + { .entry = &syscall_s390_guarded_storage }, { .entry = &syscall_statx }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_sthyi svc */ + { .entry = &syscall_s390_sthyi }, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/include/syscalls-s390x.h new/trinity-1.9+git.20180228/include/syscalls-s390x.h --- old/trinity-1.9+git.20180206/include/syscalls-s390x.h 2018-02-06 16:06:28.000000000 +0100 +++ new/trinity-1.9+git.20180228/include/syscalls-s390x.h 2018-03-01 05:54:30.000000000 +0100 @@ -349,7 +349,7 @@ { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_runtime_instr */ + { .entry = &syscall_runtime_instr }, /* s390_runtime_instr svc */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, @@ -363,8 +363,8 @@ #else { .entry = NULL }, #endif - { .entry = &syscall_ni_syscall }, /* TODO: s390_pci_mmio_write svc */ - { .entry = &syscall_ni_syscall }, /* TODO: s390_pci_mmio_read svc */ + { .entry = &syscall_s390_pci_mmio_write }, + { .entry = &syscall_s390_pci_mmio_read }, { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, @@ -389,7 +389,7 @@ { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_guarded_storage svc */ + { .entry = &syscall_s390_guarded_storage }, { .entry = &syscall_statx }, - { .entry = &syscall_ni_syscall }, /* TODO: s390_sthyi svc */ + { .entry = &syscall_s390_sthyi }, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/ioctls/sgx.c new/trinity-1.9+git.20180228/ioctls/sgx.c --- old/trinity-1.9+git.20180206/ioctls/sgx.c 1970-01-01 01:00:00.000000000 +0100 +++ new/trinity-1.9+git.20180228/ioctls/sgx.c 2018-03-01 05:54:30.000000000 +0100 @@ -0,0 +1,112 @@ +/* + * ioctl fuzzing for Intel SGX kernel driver (isgx) + * based on intel_sgx: Intel SGX Driver v0.10 + * Feb 25, 2018 + * Add support for SGXv2 + * Feb 26, 2018 + * [email protected] + */ +#include <linux/types.h> +#include <linux/ioctl.h> +#include "ioctls.h" +#include "utils.h" + +#define SGX_MAGIC 0xA4 + +#define SGX_IOC_ENCLAVE_CREATE \ + _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) +#define SGX_IOC_ENCLAVE_ADD_PAGE \ + _IOW(SGX_MAGIC, 0x01, struct sgx_enclave_add_page) +#define SGX_IOC_ENCLAVE_INIT \ + _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) + +/* SGXv2 */ +#define SGX_IOC_ENCLAVE_EMODPR \ + _IOW(SGX_MAGIC, 0x09, struct sgx_modification_param) +#define SGX_IOC_ENCLAVE_MKTCS \ + _IOW(SGX_MAGIC, 0x0a, struct sgx_range) +#define SGX_IOC_ENCLAVE_TRIM \ + _IOW(SGX_MAGIC, 0x0b, struct sgx_range) +#define SGX_IOC_ENCLAVE_NOTIFY_ACCEPT \ + _IOW(SGX_MAGIC, 0x0c, struct sgx_range) +#define SGX_IOC_ENCLAVE_PAGE_REMOVE \ + _IOW(SGX_MAGIC, 0x0d, unsigned long) + +#pragma GCC diagnostic ignored "-Wpacked" +/** + * struct sgx_enclave_create - parameter structure for the + * %SGX_IOC_ENCLAVE_CREATE ioctl + * @src: address for the SECS page data + */ +struct sgx_enclave_create { + __u64 src; +} __attribute__((__packed__)); + +/** + * struct sgx_enclave_add_page - parameter structure for the + * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl + * @addr: address in the ELRANGE + * @src: address for the page data + * @secinfo: address for the SECINFO data + * @mrmask: bitmask for the 256 byte chunks that are to be measured + */ +struct sgx_enclave_add_page { + __u64 addr; + __u64 src; + __u64 secinfo; + __u16 mrmask; +} __attribute__((__packed__)); + +/** + * struct sgx_enclave_init - parameter structure for the + * %SGX_IOC_ENCLAVE_INIT ioctl + * @addr: address in the ELRANGE + * @sigstruct: address for the page data + * @einittoken: EINITTOKEN + */ +struct sgx_enclave_init { + __u64 addr; + __u64 sigstruct; + __u64 einittoken; +} __attribute__((__packed__)); + + +/* SGXv2 */ +struct sgx_range { + unsigned long start_addr; + unsigned int nr_pages; +}; + +struct sgx_modification_param { + struct sgx_range range; + unsigned long flags; +}; +#pragma GCC diagnostic pop + +static const struct ioctl sgx_ioctls[] = { + IOCTL(SGX_IOC_ENCLAVE_CREATE), + IOCTL(SGX_IOC_ENCLAVE_ADD_PAGE), + IOCTL(SGX_IOC_ENCLAVE_INIT), +#ifdef SGXv2 + IOCTL(SGX_IOC_ENCLAVE_EMODPR), + IOCTL(SGX_IOC_ENCLAVE_MKTCS), + IOCTL(SGX_IOC_ENCLAVE_TRIM), + IOCTL(SGX_IOC_ENCLAVE_NOTIFY_ACCEPT), + IOCTL(SGX_IOC_ENCLAVE_PAGE_REMOVE), +#endif +}; + +static const char *const sgx_devs[] = { + "isgx", +}; + +static const struct ioctl_group sgx_grp = { + .devtype = DEV_CHAR, + .devs = sgx_devs, + .devs_cnt = ARRAY_SIZE(sgx_devs), + .sanitise = pick_random_ioctl, + .ioctls = sgx_ioctls, + .ioctls_cnt = ARRAY_SIZE(sgx_ioctls), +}; + +REG_IOCTL_GROUP(sgx_grp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/syscalls/s390x/runtime_instr.c new/trinity-1.9+git.20180228/syscalls/s390x/runtime_instr.c --- old/trinity-1.9+git.20180206/syscalls/s390x/runtime_instr.c 1970-01-01 01:00:00.000000000 +0100 +++ new/trinity-1.9+git.20180228/syscalls/s390x/runtime_instr.c 2018-03-01 05:54:30.000000000 +0100 @@ -0,0 +1,25 @@ +/* + * int runtime_instr(int on_off, int sig_nr) + */ + +#include "sanitise.h" + +#define S390_RUNTIME_INSTR_START 0x1 +#define S390_RUNTIME_INSTR_STOP 0x2 + +static unsigned long syscall_runtime_instr_arg1[] = { + 0, S390_RUNTIME_INSTR_START, S390_RUNTIME_INSTR_STOP, 3 +}; + +struct syscallentry syscall_runtime_instr = { + .name = "runtime_instr", + .num_args = 2, + .arg1name = "on_off", + .arg1type = ARG_LIST, + .arg1list = ARGLIST(syscall_runtime_instr_arg1), + .arg2name = "sig_nr", + .arg2type = ARG_RANGE, + .low2range = 0, + .hi2range = 128, + .rettype = RET_ZERO_SUCCESS +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/syscalls/s390x/s390_guarded_storage.c new/trinity-1.9+git.20180228/syscalls/s390x/s390_guarded_storage.c --- old/trinity-1.9+git.20180206/syscalls/s390x/s390_guarded_storage.c 1970-01-01 01:00:00.000000000 +0100 +++ new/trinity-1.9+git.20180228/syscalls/s390x/s390_guarded_storage.c 2018-03-01 05:54:30.000000000 +0100 @@ -0,0 +1,48 @@ +/* + * int s390_guarded_storage(int command, struct gs_cb *gs_cb) + */ + +#include <asm/guarded_storage.h> + +#include "random.h" +#include "sanitise.h" + +static unsigned long syscall_s390_guarded_storage_arg1[] = { + GS_ENABLE, + GS_DISABLE, + GS_SET_BC_CB, + GS_CLEAR_BC_CB, + GS_BROADCAST, + GS_BROADCAST + 1, + -1 +}; + +/* Allocate buffer and generate random data. */ +static void sanitise_s390_gs(struct syscallrecord *rec) +{ + size_t size = sizeof(struct gs_cb); + void *addr = malloc(size); + + if (addr) { + generate_rand_bytes(addr, size); + rec->a2 = (unsigned long)addr; + } +} + +/* Free buffer, freeptr takes care of NULL */ +static void post_s390_gs(struct syscallrecord *rec) +{ + freeptr(&rec->a2); +} + +struct syscallentry syscall_s390_guarded_storage = { + .name = "s390_guarded_storage", + .sanitise = sanitise_s390_gs, + .post = post_s390_gs, + .num_args = 2, + .arg1name = "command", + .arg1type = ARG_LIST, + .arg1list = ARGLIST(syscall_s390_guarded_storage_arg1), + .arg2name = "gs_cb", + .arg2type = ARG_NON_NULL_ADDRESS +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/syscalls/s390x/s390_pci_mmio.c new/trinity-1.9+git.20180228/syscalls/s390x/s390_pci_mmio.c --- old/trinity-1.9+git.20180206/syscalls/s390x/s390_pci_mmio.c 1970-01-01 01:00:00.000000000 +0100 +++ new/trinity-1.9+git.20180228/syscalls/s390x/s390_pci_mmio.c 2018-03-01 05:54:30.000000000 +0100 @@ -0,0 +1,70 @@ +/* + * int s390_pci_mmio_read(unsigned long mmio_addr, + * void *user_buffer, size_t length); + * int s390_pci_mmio_write(unsigned long mmio_addr, + * void *user_buffer, size_t length); + */ + +#include "arch.h" +#include "random.h" +#include "sanitise.h" + +/* + * Allocate buffer which fits the svc requirements: + * - length must be lower or equal to page size. + * - transfer must no cross page boundary. + */ +static void sanitise_s390_pci_mmio(struct syscallrecord *rec) +{ + size_t offset = rec->a1 % page_size; + + if (offset + rec->a3 > page_size) + rec->a3 = page_size - offset; + rec->a2 = (unsigned long)malloc(rec->a3); +} + +/* Allocate buffer and generate random data. */ +static void sanitise_s390_pci_mmio_write(struct syscallrecord *rec) +{ + sanitise_s390_pci_mmio(rec); + if (rec->a2) /* Buffer allocated */ + generate_rand_bytes((void *)rec->a2, rec->a3); +} + +/* Free buffer, freeptr takes care of NULL */ +static void post_s390_pci_mmio(struct syscallrecord *rec) +{ + freeptr(&rec->a2); +} + +struct syscallentry syscall_s390_pci_mmio_read = { + .name = "s390_pci_mmio_read", + .sanitise = sanitise_s390_pci_mmio, + .post = post_s390_pci_mmio, + .num_args = 3, + .arg1name = "mmio_addr", + .arg1type = ARG_UNDEFINED, + .arg2name = "user_buffer", + .arg2type = ARG_NON_NULL_ADDRESS, + .arg3name = "length", + .arg3type = ARG_RANGE, + .low3range = 0, + .hi3range = 1 << PAGE_SHIFT, + .rettype = RET_ZERO_SUCCESS +}; + +struct syscallentry syscall_s390_pci_mmio_write = { + .name = "s390_pci_mmio_write", + .sanitise = sanitise_s390_pci_mmio_write, + .post = post_s390_pci_mmio, + .num_args = 3, + .arg1name = "mmio_addr", + .arg1type = ARG_UNDEFINED, + .arg2name = "user_buffer", + .arg2type = ARG_NON_NULL_ADDRESS, + .arg3name = "length", + .arg3type = ARG_RANGE, + .low3range = 0, + .hi3range = 1 << PAGE_SHIFT, + .rettype = RET_ZERO_SUCCESS +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/syscalls/s390x/s390_sthyi.c new/trinity-1.9+git.20180228/syscalls/s390x/s390_sthyi.c --- old/trinity-1.9+git.20180206/syscalls/s390x/s390_sthyi.c 1970-01-01 01:00:00.000000000 +0100 +++ new/trinity-1.9+git.20180228/syscalls/s390x/s390_sthyi.c 2018-03-01 05:54:30.000000000 +0100 @@ -0,0 +1,60 @@ +/* + * int s390_sthyi(unsigned long function_code, void *resp_buffer, + * uint64_t *return_code, unsigned long flags); + */ + +#include <asm/sthyi.h> + +#include "arch.h" +#include "random.h" +#include "sanitise.h" + +static unsigned long syscall_s390_sthyi_arg1[] = { + STHYI_FC_CP_IFL_CAP, + -1 +}; + +static u64 syscall_s390_sthyi_return_code; + +/* Allocate buffer. */ +static void sanitise_s390_sthyi(struct syscallrecord *rec) +{ + size_t size = RAND_RANGE(0, page_size); + void *addr = size ? malloc(size) : NULL; + + rec->a2 = (unsigned long)addr; + + /* Use NULL, random or valid address */ + switch (rnd() % 3) { + case 0: rec->a3 = 0; + break; + case 1: rec->a3 = rnd(); + break; + case 2: rec->a3 = (unsigned long)&syscall_s390_sthyi_return_code; + break; + } +} + +/* Free buffer, freeptr takes care of NULL */ +static void post_s390_sthyi(struct syscallrecord *rec) +{ + freeptr(&rec->a2); +} + +struct syscallentry syscall_s390_sthyi = { + .name = "s390_sthyi", + .sanitise = sanitise_s390_sthyi, + .post = post_s390_sthyi, + .num_args = 4, + .arg1name = "function_code", + .arg1type = ARG_LIST, + .arg1list = ARGLIST(syscall_s390_sthyi_arg1), + .arg2name = "resp_buffer", + .arg2type = ARG_NON_NULL_ADDRESS, + .arg3name = "return_code", + .arg3type = ARG_ADDRESS, + .arg4name = "resp_buffer", + .arg4type = ARG_RANGE, + .low4range = 0, + .hi4range = 128 +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trinity-1.9+git.20180206/syscalls/syscalls.h new/trinity-1.9+git.20180228/syscalls/syscalls.h --- old/trinity-1.9+git.20180206/syscalls/syscalls.h 2018-02-06 16:06:28.000000000 +0100 +++ new/trinity-1.9+git.20180228/syscalls/syscalls.h 2018-03-01 05:54:30.000000000 +0100 @@ -386,5 +386,10 @@ extern struct syscallentry syscall_pkey_alloc; extern struct syscallentry syscall_pkey_free; extern struct syscallentry syscall_statx; +extern struct syscallentry syscall_runtime_instr; +extern struct syscallentry syscall_s390_pci_mmio_write; +extern struct syscallentry syscall_s390_pci_mmio_read; +extern struct syscallentry syscall_s390_guarded_storage; +extern struct syscallentry syscall_s390_sthyi; unsigned int random_fcntl_setfl_flags(void);
