summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2011-12-26 20:12:02 +0000
committerDmitry V. Levin <ldv@altlinux.org>2011-12-26 21:09:29 +0000
commit856c7ed97bce524ade99bb1fc41e746973d45acc (patch)
treef216a0feda1354e2feefecd6a2224f64090f3dbb /util.c
parenta5a839a920da9d54c4174ebc82b29d7718839029 (diff)
downloadstrace-856c7ed97bce524ade99bb1fc41e746973d45acc.tar.gz
strace-856c7ed97bce524ade99bb1fc41e746973d45acc.tar.bz2
strace-856c7ed97bce524ade99bb1fc41e746973d45acc.tar.xz
Enhance decoding for personalities with small wordsize
* util.c (umoven, umovestr) [SUPPORTED_PERSONALITIES > 1]: If current personality's wordsize is less than sizeof(long), use only significant bits of the given address.
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.c b/util.c
index 3e83cb6..0283a9e 100644
--- a/util.c
+++ b/util.c
@@ -785,6 +785,11 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)
char x[sizeof(long)];
} u;
+#if SUPPORTED_PERSONALITIES > 1
+ if (personality_wordsize[current_personality] < sizeof(addr))
+ addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1;
+#endif
+
if (addr & (sizeof(long) - 1)) {
/* addr not a multiple of sizeof(long) */
n = addr - (addr & -sizeof(long)); /* residue */
@@ -902,6 +907,11 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr)
char x[sizeof(long)];
} u;
+#if SUPPORTED_PERSONALITIES > 1
+ if (personality_wordsize[current_personality] < sizeof(addr))
+ addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1;
+#endif
+
if (addr & (sizeof(long) - 1)) {
/* addr not a multiple of sizeof(long) */
n = addr - (addr & -sizeof(long)); /* residue */