]> granicus.if.org Git - strace/commitdiff
Enhance decoding for personalities with small wordsize
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2011 20:12:02 +0000 (20:12 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2011 21:09:29 +0000 (21:09 +0000)
* 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.

util.c

diff --git a/util.c b/util.c
index 3e83cb6199a1b3e60ce8dc36b9ce3a66c4fb4f07..0283a9eea4a9b1898b992c42a911637148426868 100644 (file)
--- 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 */