From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30550 invoked by alias); 15 May 2005 18:28:43 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30208 invoked from network); 15 May 2005 18:28:28 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 15 May 2005 18:28:28 -0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1DXNqk-0004ET-U7; Sun, 15 May 2005 14:28:27 -0400 Date: Sun, 15 May 2005 19:39:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] gdbserver fetch/store registers problem on s390x Message-ID: <20050515182826.GB1949@nevyn.them.org> Mail-Followup-To: Ulrich Weigand , gdb-patches@sources.redhat.com References: <200505101654.j4AGsTCj028703@53v30g15.boeblingen.de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200505101654.j4AGsTCj028703@53v30g15.boeblingen.de.ibm.com> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-05/txt/msg00381.txt.bz2 On Tue, May 10, 2005 at 06:54:28PM +0200, Ulrich Weigand wrote: > Hello, > > this patch fixes another problem with gdbserver on s390x occurring > on recent kernels. The problem is that some registers accessed by > ptrace (notably the access registers and the floating-point status > register) are still 32 bits wide, even though the PTRACE_PEEKUSER > and PTRACE_POKEUSER commands always transfer 64 bits. > > This is a problem for two reasons: when fetching those registers, > a 4-byte buffer is allocated via alloca, but then 8 bytes are > written to that buffer (which just happens to work because alloca > rounds the size up to the next multiple of 8 anyway). The same > holds for storing the register; but in this case the second 4 bytes > have just random contents, and recent kernels won't allow the POKEUSER > command to succeed unless those extra bytes are zero. > > The following patch fixes this problem by always allocating a buffer > that has multiple of sizeof (PTRACE_XFER_TYPE) as size, and by > zeroing out the excess bytes of the buffer when storing the register. > > Tested on s390-ibm-linux and s390x-ibm-linux. > OK? This is OK. Thank you! -- Daniel Jacobowitz CodeSourcery, LLC