init_module does not have compat on x32/n32, so its parameters should be
parsed as kernel_ulong_t.

* util.c (printaddr): Change type of addr parameter to kernel_ulong_t.
(printstr_ex): Change type of addr parameter to kernel_ulong_t, change
type of len parameter to kernel_long_t.
* defs.h: Include kernel_types.h. Update declaration of printaddr and
printstr_ex functions.
* bjm.c (SYS_FUNC(init_module)): Use getarg_ull for module_image and
param_values parameters.
---
 bjm.c  |    4 ++--
 defs.h |    7 ++++---
 util.c |   11 ++++++-----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/bjm.c b/bjm.c
index c8e8470..a6f30b3 100644
--- a/bjm.c
+++ b/bjm.c
@@ -44,9 +44,9 @@ SYS_FUNC(delete_module)
 
 SYS_FUNC(init_module)
 {
-       printaddr(tcp->u_arg[0]);
+       printaddr(getarg_ull(tcp, 0));
        tprintf(", %llu, ", getarg_ull(tcp, 1));
-       printstr(tcp, tcp->u_arg[2], -1);
+       printstr(tcp, getarg_ull(tcp, 2), -1);
 
        return RVAL_DECODED;
 }
diff --git a/defs.h b/defs.h
index 8f34679..04900e1 100644
--- a/defs.h
+++ b/defs.h
@@ -53,6 +53,7 @@
 #include <sys/time.h>
 #include <asm/unistd.h>
 
+#include "kernel_types.h"
 #include "mpers_type.h"
 #include "gcc_compat.h"
 
@@ -542,7 +543,7 @@ 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(long);
+extern void printaddr(kernel_ulong_t addr);
 extern void printxvals(const uint64_t, const char *, const struct xlat *, ...)
        ATTRIBUTE_SENTINEL;
 extern long long getarg_ll(struct tcb *tcp, int argn);
@@ -564,7 +565,7 @@ extern void dumpiov_upto(struct tcb *, int, long, unsigned 
long);
 #define dumpiov(tcp, len, addr) \
        dumpiov_upto((tcp), (len), (addr), (unsigned long) -1L)
 extern void dumpstr(struct tcb *, long, int);
-extern void printstr_ex(struct tcb *, long addr, long len,
+extern void printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_long_t len,
        unsigned int user_style);
 extern bool printnum_short(struct tcb *, long, const char *)
        ATTRIBUTE_FORMAT((printf, 3, 0));
@@ -673,7 +674,7 @@ extern void unwind_capture_stacktrace(struct tcb* tcp);
 #endif
 
 static inline void
-printstr(struct tcb *tcp, long addr, long len)
+printstr(struct tcb *tcp, kernel_ulong_t addr, kernel_long_t len)
 {
        printstr_ex(tcp, addr, len, 0);
 }
diff --git a/util.c b/util.c
index e580eb2..59a65de 100644
--- a/util.c
+++ b/util.c
@@ -406,12 +406,12 @@ printflags64(const struct xlat *xlat, uint64_t flags, 
const char *dflt)
 }
 
 void
-printaddr(const long addr)
+printaddr(const kernel_ulong_t addr)
 {
        if (!addr)
                tprints("NULL");
        else
-               tprintf("%#lx", addr);
+               tprintf("%#llx", (unsigned long long) addr);
 }
 
 #define DEF_PRINTNUM(name, type) \
@@ -798,7 +798,8 @@ printpath(struct tcb *tcp, long addr)
  * If string length exceeds `max_strlen', append `...' to the output.
  */
 void
-printstr_ex(struct tcb *tcp, long addr, long len, unsigned int user_style)
+printstr_ex(struct tcb *tcp, kernel_ulong_t addr, kernel_long_t len,
+       unsigned int user_style)
 {
        static char *str = NULL;
        static char *outstr;
@@ -833,8 +834,8 @@ printstr_ex(struct tcb *tcp, long addr, long len, unsigned 
int user_style)
                style = QUOTE_0_TERMINATED;
        }
        else {
-               if (size > (unsigned long)len)
-                       size = (unsigned long)len;
+               if (size > (kernel_ulong_t) len)
+                       size = (kernel_ulong_t) len;
                if (umoven(tcp, addr, size, str) < 0) {
                        printaddr(addr);
                        return;
-- 
1.7.10.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to