From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1922 invoked by alias); 30 Apr 2014 17:49:39 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 1911 invoked by uid 89); 30 Apr 2014 17:49:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Apr 2014 17:49:38 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3UHnPPt014848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Apr 2014 13:49:26 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3UHnBnD005888; Wed, 30 Apr 2014 13:49:13 -0400 Message-ID: <53613793.6070600@redhat.com> Date: Wed, 30 Apr 2014 20:43:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Mark Kettenis CC: hpa@zytor.com, pinskia@gmail.com, teawater@gmail.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, eparis@redhat.com, ak@linux.intel.com, linux-kernel@vger.kernel.org, gdb@sourceware.org Subject: Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB References: <53554846.3070608@zytor.com> <53608125.2020103@zytor.com> <536085B7.5070002@zytor.com> <201404301335.s3UDZX4J017978@glazunov.sibelius.xs4all.nl> In-Reply-To: <201404301335.s3UDZX4J017978@glazunov.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-04/txt/msg00100.txt.bz2 On 04/30/2014 02:35 PM, Mark Kettenis wrote: >> Date: Tue, 29 Apr 2014 22:10:15 -0700 >> From: "H. Peter Anvin" >> >> On 04/29/2014 10:08 PM, Andrew Pinski wrote: >>> >>> restoring the values is hard since even the ptrace interface does not >>> allow for that. >>> >> >> So that begs the ultimate question, which is: given the fact that there >> is *state missing* from the state vector (this is the core of the >> problem), is there a way we can add that state so that gdb will be able >> to save and restore it? > > Carrying around additional state in GDB is complicated; I'd rather > avoid it. Agreed very much. > arch/x86/kernel/ptrace.c:putreg32() has this bit of code: > > case offsetof(struct user32, regs.orig_eax): > /* > * A 32-bit debugger setting orig_eax means to restore > * the state of the task restarting a 32-bit syscall. > * Make sure we interpret the -ERESTART* codes correctly > * in case the task is not actually still sitting at the > * exit from a 32-bit syscall with TS_COMPAT still set. > */ > regs->orig_ax = value; > if (syscall_get_nr(child, regs) >= 0) > task_thread_info(child)->status |= TS_COMPAT; > break; > > which gets used for 32-bit compat ptrace(2). Perhaps the same logic > should be added to putreg() if the child is a 32-bit process? Sounds like the right fix to me. -- Pedro Alves