uint16_t err;
};
-#if defined LINUX_MIPSN32 || defined X32
-# define HAVE_STRUCT_TCB_EXT_ARG 1
-#else
-# define HAVE_STRUCT_TCB_EXT_ARG 0
-#endif
-
/* Trace Control Block */
struct tcb {
int flags; /* See below for TCB_ values */
int pid; /* If 0, this tcb is free */
int qual_flg; /* qual_flags[scno] or DEFAULT_QUAL_FLAGS + RAW */
unsigned long u_error; /* Error code */
- kernel_scno_t scno; /* System call number */
- kernel_ureg_t u_arg[MAX_ARGS]; /* System call arguments */
-#if HAVE_STRUCT_TCB_EXT_ARG
- unsigned long long ext_arg[MAX_ARGS];
- long long u_lrval; /* long long return value */
-#endif
- long u_rval; /* Return value */
+ kernel_ulong_t scno; /* System call number */
+ kernel_ulong_t u_arg[MAX_ARGS]; /* System call arguments */
+ kernel_long_t u_rval; /* Return value */
#if SUPPORTED_PERSONALITIES > 1
unsigned int currpers; /* Personality at the time of scno update */
#endif
#define RVAL_HEX 001 /* hex format */
#define RVAL_OCTAL 002 /* octal format */
#define RVAL_UDECIMAL 003 /* unsigned decimal format */
-#if HAVE_STRUCT_TCB_EXT_ARG
-# if 0 /* unused so far */
-# define RVAL_LDECIMAL 004 /* long decimal format */
-# define RVAL_LHEX 005 /* long hex format */
-# define RVAL_LOCTAL 006 /* long octal format */
-# endif
-# define RVAL_LUDECIMAL 007 /* long unsigned decimal format */
-#endif /* HAVE_STRUCT_TCB_EXT_ARG */
#define RVAL_FD 010 /* file descriptor */
-#define RVAL_MASK 017 /* mask for these values */
+#define RVAL_MASK 013 /* mask for these values */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
#define RVAL_NONE 040 /* Print nothing */
* @return String literal corresponding to the syscall number in case latter
* is valid; NULL otherwise.
*/
-extern const char *syscall_name(kernel_scno_t scno);
+extern const char *syscall_name(kernel_ulong_t scno);
extern const char *err_name(unsigned long err);
extern bool is_erestart(struct tcb *);
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_ulong_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_ulong_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, kernel_ulong_t addr,
+ unsigned int len, void *laddr);
+
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 *);
-extern int upeek(int pid, long, long *);
-extern int upoke(int pid, long, long);
+umovestr(struct tcb *tcp, kernel_ulong_t addr, unsigned int len, char *laddr);
+
+extern int upeek(int pid, unsigned long, kernel_ulong_t *);
+extern int upoke(int pid, unsigned long, kernel_ulong_t);
extern bool
print_array(struct tcb *tcp,
- const unsigned long start_addr,
- const size_t nmemb,
- void *const elem_buf,
- const size_t elem_size,
- int (*const umoven_func)(struct tcb *,
- long,
+ kernel_ulong_t start_addr,
+ size_t nmemb,
+ void *elem_buf,
+ size_t elem_size,
+ int (*umoven_func)(struct tcb *,
+ kernel_ulong_t,
unsigned int,
void *),
- bool (*const print_func)(struct tcb *,
+ bool (*print_func)(struct tcb *,
void *elem_buf,
size_t elem_size,
void *opaque_data),
- void *const opaque_data);
+ void *opaque_data);
#if defined ALPHA || defined IA64 || defined MIPS \
|| defined SH || defined SPARC || defined SPARC64
* b refers to the higher numbered u_arg
*/
#ifdef WORDS_BIGENDIAN
-# define LONG_LONG(a,b) \
- ((long long)((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)))
+# define ULONG_LONG(a,b) \
+ ((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32))
#else
-# define LONG_LONG(a,b) \
- ((long long)((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)))
+# define ULONG_LONG(a,b) \
+ ((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32))
#endif
extern int getllval(struct tcb *, unsigned long long *, int);
extern int printllval(struct tcb *, const char *, int)
ATTRIBUTE_FORMAT((printf, 2, 0));
-extern void printaddr_klu(kernel_ulong_t addr);
+extern void printaddr(kernel_ulong_t addr);
extern int printxvals(const uint64_t, const char *, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern int printxval_searchn(const struct xlat *xlat, size_t xlat_size,
uint64_t val, const char *dflt);
#define printxval_search(xlat__, val__, dflt__) \
printxval_searchn(xlat__, ARRAY_SIZE(xlat__), val__, dflt__)
-extern kernel_ulong_t getarg_klu(struct tcb *tcp, int argn);
extern int printargs(struct tcb *);
extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
extern void print_symbolic_mode_t(unsigned int);
extern void print_numeric_umode_t(unsigned short);
extern void print_numeric_long_umask(unsigned long);
-extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long);
-extern void dumpiov_in_mmsghdr(struct tcb *, long);
-extern void dumpiov_upto(struct tcb *, int, long, unsigned long);
-extern void dumpstr(struct tcb *, long, int);
-extern void printstr_ex(struct tcb *, long addr, long len,
- unsigned int user_style);
-extern bool printnum_short(struct tcb *, long, const char *)
- ATTRIBUTE_FORMAT((printf, 3, 0));
-extern bool printnum_int(struct tcb *, long, const char *)
- ATTRIBUTE_FORMAT((printf, 3, 0));
-extern bool printnum_int64(struct tcb *, long, const char *)
- ATTRIBUTE_FORMAT((printf, 3, 0));
+
+extern void
+dumpiov_in_msghdr(struct tcb *, kernel_ulong_t addr, kernel_ulong_t data_size);
+
+extern void
+dumpiov_in_mmsghdr(struct tcb *, kernel_ulong_t addr);
+
+extern void
+dumpiov_upto(struct tcb *, int len, kernel_ulong_t addr, kernel_ulong_t data_size);
+
+extern void
+dumpstr(struct tcb *, kernel_ulong_t addr, int len);
+
+extern void
+printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len,
+ unsigned int user_style);
+
+#define DECL_PRINTNUM(name) \
+extern bool \
+printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
+ ATTRIBUTE_FORMAT((printf, 3, 0))
+DECL_PRINTNUM(short);
+DECL_PRINTNUM(int);
+DECL_PRINTNUM(int64);
+#undef DECL_PRINTNUM
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
-extern bool printnum_long_int(struct tcb *, long, const char *, const char *)
+extern bool
+printnum_long_int(struct tcb *, kernel_ulong_t addr,
+ const char *fmt_long, const char *fmt_int)
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 4, 0));
# define printnum_slong(tcp, addr) \
printnum_int((tcp), (addr), "%#x")
#endif
-extern bool printpair_int(struct tcb *, long, const char *)
- ATTRIBUTE_FORMAT((printf, 3, 0));
-extern bool printpair_int64(struct tcb *, long, const char *)
- ATTRIBUTE_FORMAT((printf, 3, 0));
-extern void printpath(struct tcb *, long);
-extern void printpathn(struct tcb *, long, unsigned int);
+#define DECL_PRINTPAIR(name) \
+extern bool \
+printpair_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
+ ATTRIBUTE_FORMAT((printf, 3, 0))
+DECL_PRINTPAIR(int);
+DECL_PRINTPAIR(int64);
+#undef DECL_PRINTPAIR
+
+extern void
+printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n);
+
+extern void
+printpath(struct tcb *, kernel_ulong_t addr);
+
#define TIMESPEC_TEXT_BUFSIZE \
(sizeof(intmax_t)*3 * 2 + sizeof("{tv_sec=%jd, tv_nsec=%jd}"))
extern void printfd(struct tcb *, int);
extern bool print_sockaddr_by_inode(const unsigned long, const enum sock_proto);
extern bool print_sockaddr_by_inode_cached(const unsigned long);
extern void print_dirfd(struct tcb *, int);
-extern int decode_sockaddr(struct tcb *, long, int);
+
+extern int
+decode_sockaddr(struct tcb *, kernel_ulong_t addr, int addrlen);
+
extern void printuid(const char *, const unsigned int);
-extern void print_sigset_addr_len(struct tcb *, long, long);
+
+extern void
+print_sigset_addr_len(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len);
+
extern const char *sprintsigmask_n(const char *, const void *, unsigned int);
#define tprintsigmask_addr(prefix, mask) \
tprints(sprintsigmask_n((prefix), (mask), sizeof(mask)))
extern void printsignal(int);
-extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long,
- enum iov_decode, unsigned long);
-extern void decode_netlink(struct tcb *, unsigned long, unsigned long);
+
+extern void
+tprint_iov_upto(struct tcb *, kernel_ulong_t len, kernel_ulong_t addr,
+ enum iov_decode, kernel_ulong_t data_size);
+
+extern void
+decode_netlink(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len);
+
extern void tprint_open_modes(unsigned int);
extern const char *sprint_open_modes(unsigned int);
-extern void print_seccomp_filter(struct tcb *, unsigned long);
-extern void print_seccomp_fprog(struct tcb *, unsigned long, unsigned short);
+
+extern void
+print_seccomp_filter(struct tcb *, kernel_ulong_t addr);
+
+extern void
+print_seccomp_fprog(struct tcb *, kernel_ulong_t addr, unsigned short len);
struct strace_stat;
extern void print_struct_stat(struct tcb *tcp, const struct strace_stat *const st);
struct strace_statfs;
-extern void print_struct_statfs(struct tcb *tcp, long);
-extern void print_struct_statfs64(struct tcb *tcp, long, unsigned long);
+
+extern void
+print_struct_statfs(struct tcb *, kernel_ulong_t addr);
+
+extern void
+print_struct_statfs64(struct tcb *, kernel_ulong_t addr, kernel_ulong_t size);
extern void print_ifindex(unsigned int);
extern void qualify(const char *);
extern unsigned int qual_flags(const unsigned int);
-extern int dm_ioctl(struct tcb *, const unsigned int, long);
-extern int file_ioctl(struct tcb *, const unsigned int, long);
-extern int fs_x_ioctl(struct tcb *, const unsigned int, long);
-extern int loop_ioctl(struct tcb *, const unsigned int, long);
-extern int ptp_ioctl(struct tcb *, const unsigned int, long);
-extern int scsi_ioctl(struct tcb *, const unsigned int, long);
-extern int sock_ioctl(struct tcb *, const unsigned int, long);
-extern int term_ioctl(struct tcb *, const unsigned int, long);
-extern int ubi_ioctl(struct tcb *, const unsigned int, long);
-extern int uffdio_ioctl(struct tcb *, const unsigned int, long);
+#define DECL_IOCTL(name) \
+extern int \
+name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg)
+DECL_IOCTL(dm);
+DECL_IOCTL(file);
+DECL_IOCTL(fs_x);
+DECL_IOCTL(loop);
+DECL_IOCTL(ptp);
+DECL_IOCTL(scsi);
+DECL_IOCTL(sock);
+DECL_IOCTL(term);
+DECL_IOCTL(ubi);
+DECL_IOCTL(uffdio);
+#undef DECL_IOCTL
extern int tv_nz(const struct timeval *);
extern int tv_cmp(const struct timeval *, const struct timeval *);
#endif
static inline void
-printaddr(kernel_ureg_t addr)
+printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len)
{
- printaddr_klu(addr);
+ printstr_ex(tcp, addr, len, 0);
}
static inline void
-printstr(struct tcb *tcp, long addr, long len)
+printstr(struct tcb *tcp, kernel_ulong_t addr)
{
- printstr_ex(tcp, addr, len, 0);
+ printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
}
static inline int
return printflags64(x, flags, dflt);
}
-static inline int
-printflags_long(const struct xlat *x, unsigned long flags, const char *dflt)
-{
- return printflags64(x, flags, dflt);
-}
-
static inline int
printxval64(const struct xlat *x, const uint64_t val, const char *dflt)
{
return printxvals(val, dflt, x, NULL);
}
-static inline int
-printxval_long(const struct xlat *x, const unsigned long val, const char *dflt)
-{
- return printxvals(val, dflt, x, NULL);
-}
-
static inline void
-tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr,
+tprint_iov(struct tcb *tcp, kernel_ulong_t len, kernel_ulong_t addr,
enum iov_decode decode_iov)
{
- tprint_iov_upto(tcp, len, addr, decode_iov, -1UL);
+ tprint_iov_upto(tcp, len, addr, decode_iov, -1);
}
#ifdef ALPHA
} timeval32_t;
extern void print_timeval32_t(const timeval32_t *);
-extern void printrusage32(struct tcb *, long);
-extern const char *sprint_timeval32(struct tcb *tcp, long);
-extern void print_timeval32(struct tcb *tcp, long);
-extern void print_timeval32_pair(struct tcb *tcp, long);
-extern void print_itimerval32(struct tcb *tcp, long);
+extern void printrusage32(struct tcb *, kernel_ulong_t);
+extern const char *sprint_timeval32(struct tcb *tcp, kernel_ulong_t);
+extern void print_timeval32(struct tcb *tcp, kernel_ulong_t);
+extern void print_timeval32_pair(struct tcb *tcp, kernel_ulong_t);
+extern void print_itimerval32(struct tcb *tcp, kernel_ulong_t);
+#endif
+
+#ifdef HAVE_STRUCT_USER_DESC
+extern void print_user_desc(struct tcb *, kernel_ulong_t addr);
#endif
/* Strace log generation machinery.
# define widen_to_ulong(v) ((unsigned long)(v))
#endif
+/*
+ * Cast a pointer or a pointer-sized integer to kernel_ulong_t.
+ */
+#define ptr_to_kulong(v) ((kernel_ulong_t) (unsigned long) (v))
+
/*
* Zero-extend a signed integer type to unsigned long long.
*/
/* Checks that sysent[scno] is not out of range. */
static inline bool
-scno_in_range(kernel_scno_t scno)
+scno_in_range(kernel_ulong_t scno)
{
return scno < nsyscalls;
}
* and its sysent[scno].sys_flags has no TRACE_INDIRECT_SUBCALL flag set.
*/
static inline bool
-scno_is_valid(kernel_scno_t scno)
+scno_is_valid(kernel_ulong_t scno)
{
return scno_in_range(scno)
&& sysent[scno].sys_func