Introduce umoven_or_printaddr64* functions

Counterparts for umoven_or_printaddr/umoven_or_printaddr_ignore_syserror
that always print 64 bits of addr (as this is needed in bpf and btrfs
decoders).

* util.c (umoven_or_printaddr64): Rename from umoven_or_printaddr,
change addr argument type to uint64_t, call printaddr64 instead of
printaddr.
(umoven_or_printaddr64_ignore_syserror): Rename from
umoven_or_printaddr_ignore_syserror, change addr argument type to
uint64_t, call printaddr64 instead of printaddr.
* defs.h (umoven_or_printaddr64): Rename from umoven_or_printaddr,
change addr argument type to uint64_t.
(umoven_or_printaddr64_ignore_syserror): Rename from
umoven_or_printaddr_ignore_syserror, change addr argument type to
uint64_t.
(umove_or_printaddr64): New macro, a wrapper for umoven_or_printaddr64.
(umoven_or_printaddr): New function, a wrapper for
umoven_or_printaddr64.
(umoven_or_printaddr_ignore_syserror): New function, a wrapper for
umoven_or_printaddr64_ignore_syserror.
This commit is contained in:
Eugene Syromyatnikov 2018-03-25 11:54:18 +02:00 committed by Dmitry V. Levin
parent 94ea427a31
commit 1aee6198c7
2 changed files with 26 additions and 10 deletions

24
defs.h
View File

@ -462,14 +462,30 @@ umoven(struct tcb *, kernel_ulong_t addr, unsigned int len, void *laddr);
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int
umoven_or_printaddr(struct tcb *, kernel_ulong_t addr,
unsigned int len, void *laddr);
umoven_or_printaddr64(struct tcb *, uint64_t addr,
unsigned int len, void *laddr);
#define umove_or_printaddr64(pid, addr, objp) \
umoven_or_printaddr64((pid), (addr), sizeof(*(objp)), (void *) (objp))
static inline int
umoven_or_printaddr(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return umoven_or_printaddr64(tcp, addr, len, 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 *, kernel_ulong_t addr,
unsigned int len, void *laddr);
umoven_or_printaddr64_ignore_syserror(struct tcb *, uint64_t addr,
unsigned int len, void *laddr);
static inline int
umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return umoven_or_printaddr64_ignore_syserror(tcp, addr, len, laddr);
}
extern int
umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr);

12
util.c
View File

@ -984,25 +984,25 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, const int len)
}
int
umoven_or_printaddr(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned int len, void *const our_addr)
umoven_or_printaddr64(struct tcb *const tcp, const uint64_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) {
printaddr(addr);
printaddr64(addr);
return -1;
}
return 0;
}
int
umoven_or_printaddr_ignore_syserror(struct tcb *const tcp,
const kernel_ulong_t addr,
umoven_or_printaddr64_ignore_syserror(struct tcb *const tcp,
const uint64_t addr,
const unsigned int len,
void *const our_addr)
{
if (!addr || !verbose(tcp) || umoven(tcp, addr, len, our_addr) < 0) {
printaddr(addr);
printaddr64(addr);
return -1;
}
return 0;