lkml.org 
[lkml]   [2014]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
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



\
 
 \ /
  Last update: 2014-04-21 19:01    [W:0.429 / U:0.844 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site