From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26795 invoked by alias); 21 Apr 2014 16:33:52 -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 26786 invoked by uid 89); 21 Apr 2014 16:33:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail.zytor.com Received: from terminus.zytor.com (HELO mail.zytor.com) (198.137.202.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 21 Apr 2014 16:33:50 +0000 Received: from hanvin-mobl6.amr.corp.intel.com (fmdmzpr03-ext.fm.intel.com [192.55.54.38]) (authenticated bits=0) by mail.zytor.com (8.14.7/8.14.5) with ESMTP id s3LGXF6a022144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 21 Apr 2014 09:33:15 -0700 Message-ID: <53554846.3070608@zytor.com> Date: Tue, 22 Apr 2014 12:37:00 -0000 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Hui Zhu , Thomas Gleixner , Ingo Molnar , x86@kernel.org, eparis@redhat.com, ak@linux.intel.com, "linux-kernel@vger.kernel.org" CC: "gdb@sourceware.org" Subject: Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-04/txt/msg00069.txt.bz2 On 04/21/2014 09:19 AM, Hui Zhu wrote: > } > Now ax is in 32 bits now, need sign-extend to 64 bits. But > current_thread_info()->status TS_COMPAT is cleared when GDB call "call func1()". > Linux kernel don't know this is a 32 bits task and will not extend it. > Then -ERESTARTSYS is not be handled and go back to user space. > > Then the syscall "read" get a errno in ERESTARTSYS. > > To fix this issue, I tried to add a local variable to "do_signal" but > it is not works. The stack is cleared before GDB "continue". > so I make a patch that add "test_thread_flag (TIF_IA32)" to syscall_get_error. > > Signed-off-by: Hui Zhu > --- > --- a/arch/x86/include/asm/syscall.h > +++ b/arch/x86/include/asm/syscall.h > @@ -48,7 +48,8 @@ static inline long syscall_get_error(str > * TS_COMPAT is set for 32-bit syscall entries and then > * remains set until we return to user mode. > */ > - if (task_thread_info(task)->status & TS_COMPAT) > + if ((task_thread_info(task)->status & TS_COMPAT) > + || test_thread_flag (TIF_IA32)) > /* > * Sign-extend the value so (int)-EFOO becomes (long)-EFOO > * and will match correctly in comparisons. > No, this is definitely not the right fix. Your description is incredibly hard to follow, but I feel pretty strongly that the above is at the very best a last resort fix. TS_COMPAT is a local property whereas TIF_IA32 is global; it is important to keep their respective uses correct. Mixing them is almost guaranteed to be just plain wrong. -hpa