From: Denys Vlasenko Date: Fri, 24 Feb 2012 23:43:22 +0000 (+0100) Subject: When accessing data blocks, truncate addr to wordsize X-Git-Tag: v4.7~162 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2a660f534d98169f60d50706cbb2ec15fa13cf8;p=strace When accessing data blocks, truncate addr to wordsize * util.c (umoven): Truncate addr to wordsize before use. --- diff --git a/util.c b/util.c index 3e6269fd..2abfce36 100644 --- a/util.c +++ b/util.c @@ -831,6 +831,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 (!process_vm_readv_not_supported) { struct iovec local[1], remote[1]; int r; @@ -855,11 +860,6 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr) } vm_readv_didnt_work: -#if SUPPORTED_PERSONALITIES > 1 - if (personality_wordsize[current_personality] < sizeof(addr)) - addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1; -#endif - started = 0; if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */