From: "H. Peter Anvin" <hpa@zytor.com>
To: Hui Zhu <teawater@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, eparis@redhat.com, ak@linux.intel.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
Date: Mon, 21 Apr 2014 09:33:10 -0700 [thread overview]
Message-ID: <53554846.3070608@zytor.com> (raw)
In-Reply-To: <CANFwon0oLO+qCtpewc=BxKBOm05aBMpV=yG0CxwW1isWHfnZqw@mail.gmail.com>
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 <hui@codesourcery.com>
> ---
> --- 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
next prev parent reply other threads:[~2014-04-21 16:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 16:19 [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB Hui Zhu
2014-04-21 16:33 ` H. Peter Anvin [this message]
2014-04-30 3:44 ` Hui Zhu
2014-04-30 4:50 ` H. Peter Anvin
2014-04-30 5:08 ` Andrew Pinski
2014-04-30 5:10 ` H. Peter Anvin
2014-04-30 13:35 ` Mark Kettenis
2014-04-30 16:28 ` Hui Zhu
2014-04-30 16:35 ` Hui Zhu
2014-04-30 20:43 ` H. Peter Anvin
2014-04-30 16:35 ` H. Peter Anvin
2014-04-30 17:49 ` Pedro Alves
2014-04-30 20:44 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53554846.3070608@zytor.com \
--to=hpa@zytor.com \
--cc=ak@linux.intel.com \
--cc=eparis@redhat.com \
--cc=gdb@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=teawater@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox