lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 21 Apr 2014 09:33:10 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Hui Zhu <teawater@...il.com>, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
	eparis@...hat.com, ak@...ux.intel.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:	"gdb@...rceware.org" <gdb@...rceware.org>
Subject: Re: [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@...esourcery.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ