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

vivi glen glen4linux at gmail.com
Wed May 21 13:20:31 UTC 2014


Hi Khimov:

     In glibc, it does align 16, and many other code also does,such as
sigpause and so on.
     but i think ,uClibc dose not 16 align maybe for size. and I tested
this code ,it work well.  so i remove the "align 16" asm code.

thanks!


2014-05-21 16:23 GMT+08:00 Roman Khimov <khimov at altell.ru>:

> В письме от 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
>


More information about the uClibc mailing list