From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2974 invoked by alias); 22 May 2012 20:42:56 -0000 Received: (qmail 2966 invoked by uid 22791); 22 May 2012 20:42:56 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 May 2012 20:42:43 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4MKgeW8024060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 May 2012 16:42:40 -0400 Received: from host2.jankratochvil.net (ovpn-116-78.ams2.redhat.com [10.36.116.78]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4MKgZdd011095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 22 May 2012 16:42:38 -0400 Date: Tue, 22 May 2012 20:42:00 -0000 From: Jan Kratochvil To: "Maciej W. Rozycki" Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [patch] Re: Regression for gdbserver [Re: [PATCH] Linux/gdbserver: Fix memory read ptrace fallback issues] Message-ID: <20120522204235.GA31756@host2.jankratochvil.net> References: <4FB67E6D.2040406@redhat.com> <4FB6ACEF.2030600@redhat.com> <20120522080321.GA18378@host2.jankratochvil.net> <20120522193521.GA26213@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00849.txt.bz2 On Tue, 22 May 2012 22:05:30 +0200, Maciej W. Rozycki wrote: > it's difficult to chase something you can't reproduce. I see that patch [RFC patch] non-release srctrees: --enable-targets=all & 64bit & -lmcheck http://sourceware.org/ml/gdb-patches/2012-05/msg00714.html should include also better CFLAGS. But the patch does not seem to go in so far so we may continue with mail threads like this one. > I think however, that this memcpy call needs a rewrite now, I find your > proposal unreadable. I find the whole function unreadable but this was true also before your patch. But I did not try to change that in this fix up. It also has 64-bit unsafe bug using 'int' for memory sizes. I find always more clear to calculate everything as START ADDRESS and ONE BYTE AFTER THE LAST ADDRESS till the very last moment. > /* Copy appropriate bytes out of the buffer. */ > if (i > 0) > { > i *= sizeof (PTRACE_XFER_TYPE); > i -= memaddr & (sizeof (PTRACE_XFER_TYPE) - 1); > memcpy (myaddr, > (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), > i < len ? i : len); > } > > ? This code has equal functionality in my local testing. Regards, Jan