[PATCH] fix pthread_cancel lead to segmentation fault for x86_64.

Roman Khimov khimov at altell.ru
Wed May 21 08:23:08 UTC 2014


В письме от 21 мая 2014 00:52:55 пользователь ZhangPu написал:
> --- a/libc/sysdeps/linux/x86_64/sigaction.c
> +++ b/libc/sysdeps/linux/x86_64/sigaction.c
> @@ -116,6 +116,7 @@ libc_hidden_weak(sigaction)
>  #define RESTORE(name, syscall) RESTORE2(name, syscall)
>  #define RESTORE2(name, syscall) \
>  __asm__ (						\
> +	"	nop\n"					\
>  	".text\n"					\
>  	"__" #name ":\n"				\
>  	"	movq	$" #syscall ", %rax\n"		\

I think it should be aligned, like:

--- a/libc/sysdeps/linux/x86_64/sigaction.c
+++ b/libc/sysdeps/linux/x86_64/sigaction.c
@@ -117,6 +117,8 @@ libc_hidden_weak(sigaction)
 #define RESTORE2(name, syscall) \
 __asm__ (                                              \
        ".text\n"                                       \
+       "nop\n" \
+       ".align 16\n" \
        "__" #name ":\n"                                \
        "       movq    $" #syscall ", %rax\n"          \
        "       syscall\n"                              \

At least that's what we've used internally for quite some time and it works 
good (yep, should've forwarded it here earlier). See also:
http://git.alpinelinux.org/cgit/aports/tree/main/libc0.9.32/0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch?h=v2.5.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3778 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20140521/609854f5/attachment.p7s>


More information about the uClibc mailing list