From 956e3a34a34bb5944187ee2d133227eaa74dd217 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 20 Dec 2016 21:23:39 +0000 Subject: [PATCH] umove*: change tracee address argument type from long to kernel_ureg_t * defs.h (umovestr, umoven, umoven_or_printaddr, umoven_or_printaddr_ignore_syserror): Change tracee address argument type from long to kernel_ureg_t. (print_array): Change the type of tracee address argument of umoven_func from long to kernel_ureg_t. * util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr, umoven_or_printaddr_ignore_syserror): Change tracee address argument type from long to kernel_ureg_t. (print_array): Change the type of tracee address argument of umoven_func from long to kernel_ureg_t. * desc.c (umove_kulong_array_or_printaddr): Change tracee address argument type from long to kernel_ureg_t. * mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise. --- defs.h | 20 ++++++++++++++------ desc.c | 4 ++-- mmsghdr.c | 3 ++- util.c | 20 ++++++++++++-------- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/defs.h b/defs.h index 0a4c616f..ea14b007 100644 --- a/defs.h +++ b/defs.h @@ -493,16 +493,24 @@ static inline int set_tcb_priv_ulong(struct tcb *tcp, unsigned long val) return set_tcb_priv_data(tcp, (void *) val, 0); } -extern int umoven(struct tcb *, long, unsigned int, void *); +extern int +umoven(struct tcb *tcp, kernel_ureg_t addr, unsigned int len, void *laddr); #define umove(pid, addr, objp) \ umoven((pid), (addr), sizeof(*(objp)), (void *) (objp)) -extern int umoven_or_printaddr(struct tcb *, long, unsigned int, void *); + +extern int +umoven_or_printaddr(struct tcb *tcp, kernel_ureg_t addr, + unsigned int len, void *laddr); #define umove_or_printaddr(pid, addr, objp) \ umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp)) + extern int -umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr, - const unsigned int len, void *our_addr); -extern int umovestr(struct tcb *, long, unsigned int, char *); +umoven_or_printaddr_ignore_syserror(struct tcb *tcp, kernel_ureg_t addr, + unsigned int len, void *laddr); + +extern int +umovestr(struct tcb *tcp, kernel_ureg_t addr, unsigned int len, char *laddr); + extern int upeek(int pid, long, long *); extern int upoke(int pid, long, long); @@ -513,7 +521,7 @@ print_array(struct tcb *tcp, void *elem_buf, size_t elem_size, int (*umoven_func)(struct tcb *, - long, + kernel_ureg_t, unsigned int, void *), bool (*print_func)(struct tcb *, diff --git a/desc.c b/desc.c index ebf5b7e4..5b8b7dfd 100644 --- a/desc.c +++ b/desc.c @@ -227,8 +227,8 @@ SYS_FUNC(select) } static int -umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr, - kernel_ulong_t *ptr, size_t n) +umove_kulong_array_or_printaddr(struct tcb *const tcp, const kernel_ureg_t addr, + kernel_ulong_t *const ptr, const size_t n) { #ifndef current_klongsize if (current_klongsize < sizeof(*ptr)) { diff --git a/mmsghdr.c b/mmsghdr.c index 5ab3e0b8..6b02774a 100644 --- a/mmsghdr.c +++ b/mmsghdr.c @@ -33,7 +33,8 @@ #include static int -fetch_struct_mmsghdr_or_printaddr(struct tcb *tcp, const long addr, +fetch_struct_mmsghdr_or_printaddr(struct tcb *const tcp, + const kernel_ureg_t addr, const unsigned int len, void *const mh) { if ((entering(tcp) || !syserror(tcp)) diff --git a/util.c b/util.c index ff65e8ad..02bb3bc1 100644 --- a/util.c +++ b/util.c @@ -1082,7 +1082,8 @@ static bool process_vm_readv_not_supported = 1; #endif /* end of hack */ static ssize_t -vm_read_mem(pid_t pid, void *laddr, long raddr, size_t len) +vm_read_mem(const pid_t pid, void *const laddr, + const kernel_ureg_t raddr, const size_t len) { const struct iovec local = { .iov_base = laddr, @@ -1101,7 +1102,8 @@ vm_read_mem(pid_t pid, void *laddr, long raddr, size_t len) * at address `addr' to our space at `our_addr' */ int -umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr) +umoven(struct tcb *const tcp, kernel_ureg_t addr, unsigned int len, + void *const our_addr) { char *laddr = our_addr; int pid = tcp->pid; @@ -1208,8 +1210,8 @@ umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr) } int -umoven_or_printaddr(struct tcb *tcp, const long addr, const unsigned int len, - void *our_addr) +umoven_or_printaddr(struct tcb *const tcp, const kernel_ureg_t addr, + const unsigned int len, void *const our_addr) { if (!addr || !verbose(tcp) || (exiting(tcp) && syserror(tcp)) || umoven(tcp, addr, len, our_addr) < 0) { @@ -1220,8 +1222,10 @@ umoven_or_printaddr(struct tcb *tcp, const long addr, const unsigned int len, } int -umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr, - const unsigned int len, void *our_addr) +umoven_or_printaddr_ignore_syserror(struct tcb *const tcp, + const kernel_ureg_t addr, + const unsigned int len, + void *const our_addr) { if (!addr || !verbose(tcp) || umoven(tcp, addr, len, our_addr) < 0) { printaddr(addr); @@ -1243,7 +1247,7 @@ umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr, * we never write past laddr[len-1]). */ int -umovestr(struct tcb *tcp, long addr, unsigned int len, char *laddr) +umovestr(struct tcb *const tcp, kernel_ureg_t addr, unsigned int len, char *laddr) { const unsigned long x01010101 = (unsigned long) 0x0101010101010101ULL; const unsigned long x80808080 = (unsigned long) 0x8080808080808080ULL; @@ -1426,7 +1430,7 @@ print_array(struct tcb *const tcp, void *const elem_buf, const size_t elem_size, int (*const umoven_func)(struct tcb *, - long, + kernel_ureg_t, unsigned int, void *), bool (*const print_func)(struct tcb *, -- 2.40.0