From: Dmitry V. Levin Date: Mon, 26 Dec 2011 20:12:02 +0000 (+0000) Subject: Enhance decoding for personalities with small wordsize X-Git-Tag: v4.7~220 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=856c7ed97bce524ade99bb1fc41e746973d45acc;p=strace 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. --- diff --git a/util.c b/util.c index 3e83cb61..0283a9ee 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 */