diff mbox

[uclibc-ng-devel] uclibc-ng 1.0.18 - libc.a binaries freeze

Message ID 20161009174513.GR2052@waldemar-brodkorb.de
State Accepted
Headers show

Commit Message

Waldemar Brodkorb Oct. 9, 2016, 5:45 p.m. UTC
Hi Lance,
Lance Fredrickson wrote,

> Using uclibc-ng 1.0.18, binaries linked against dynamic libc.so seems to
> work just fine.  Binaries created completely statically are non-responsive,
> and freeze up on the console.  A few binaries I've tried are openvpn, tinc,
> transmission-daemon.  I have to send SIGKILL to terminate the process.  A
> simple hello world did compile and run fine though, so possibly having to do
> with additional functionality placed into libc.a.
> 
> Here's a strace of one binary if that offers any insight.
> 
> root@R7000:~/src/tinc-1.1pre14/src# strace ./tinc --version
> execve("./tinc", ["./tinc", "--version"], [/* 24 vars */]) = 0
> brk(NULL)                               = 0x1ef000
> brk(0x1efcb4)                           = 0x1efcb4
> set_tls(0x1ef490, 0x1c4220, 0x1e9418, 0x1e8bd8, 0x4) = 0
> set_tid_address(0x1ef068)               = 9961
> set_robust_list(0x1ef070, 12)           = -1 ENOSYS (Function not
> implemented)
> rt_sigaction(SIGRTMIN, {0x165014, [], SA_RESTORER|SA_SIGINFO, 0x14f058},
> NULL, 8) = 0
> rt_sigaction(SIGRT_1, {0x164ea0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO,
> 0x14f058}, NULL, 8) = 0
> rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
> ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
> open("/dev/urandom", O_RDONLY)          = 3
> read(3, "\\\177t)", 4)                  = 4
> close(3)                                = 0
> ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
> ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
> rt_sigprocmask(SIG_SETMASK, ~[ILL TRAP BUS FPE SEGV RTMIN RT_1], [], 8) = 0
> rt_sigaction(SIGILL, {0x98734, ~[ILL TRAP BUS FPE SEGV RTMIN RT_1],
> SA_RESTORER, 0x14f04c}, {SIG_DFL, [], 0}, 8) = 0
> rt_sigprocmask(SIG_BLOCK, NULL, ~[ILL TRAP BUS FPE KILL SEGV STOP RTMIN
> RT_1], 8) = 0
> --- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPC, si_addr=0x98800} ---
> futex(0x1e5df0, FUTEX_WAIT_PRIVATE, 2, NULL

Can you try attached patch it should fix your issue.

best regards
 Waldemar

Comments

Lance Fredrickson Oct. 10, 2016, 5:19 a.m. UTC | #1
On 10/9/2016 11:45 AM, Waldemar Brodkorb wrote:
> Can you try attached patch it should fix your issue.
>
> best regards
>   Waldemar
This appears to resolve the issue.  Binaries seem to be working as expected.

thanks,
Lance
diff mbox

Patch

From 2f1697430527e960d86107cfc134d62a1ee8a15b Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@uclibc-ng.org>
Date: Sun, 9 Oct 2016 10:08:08 +0200
Subject: [PATCH] cleanup and fix static linking issues

There was a deadlock hanging in a sycall to futex,
which should be solved now.

Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
---
 libpthread/nptl/sysdeps/pthread/Makefile.in        |  1 -
 libpthread/nptl/sysdeps/pthread/pt-longjmp.c       | 30 ----------------------
 .../sysdeps/unix/sysv/linux/Makefile.commonarch    |  2 +-
 .../nptl/sysdeps/unix/sysv/linux/jmp-unwind.c      |  1 +
 .../sysdeps/unix/sysv/linux/libc-lowlevellock.c    | 20 ---------------
 .../nptl/sysdeps/unix/sysv/linux/lowlevellock.c    |  3 ---
 6 files changed, 2 insertions(+), 55 deletions(-)
 delete mode 100644 libpthread/nptl/sysdeps/pthread/pt-longjmp.c
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c

diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index a501b64..6c09e7b 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -32,7 +32,6 @@  libpthread_pthread_CSRC = \
 	pthread_spin_destroy.c \
 	pthread_spin_init.c \
 	pthread_spin_unlock.c \
-	pt-longjmp.c \
 	pt-sigaction.c \
 	tpp.c
 
diff --git a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c
deleted file mode 100644
index 9fcea04..0000000
--- a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c
+++ /dev/null
@@ -1,30 +0,0 @@ 
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <setjmp.h>
-#include <stdlib.h>
-#include "pthreadP.h"
-
-extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
-
-void
-longjmp (jmp_buf env, int val)
-{
-  __libc_longjmp (env, val);
-}
-weak_alias (longjmp, siglongjmp)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
index 649d188..a438e97 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
@@ -69,7 +69,7 @@  libpthread_linux_SSRC := #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-
 
 libc_linux_CSRC += libc_pthread_init.c libc_multiple_threads.c		\
 	register-atfork.c unregister-atfork.c getpid.c		\
-	raise.c jmp-unwind.c libc-lowlevellock.c
+	raise.c jmp-unwind.c
 
 librt_linux_CSRC += mq_notify.c timer_create.c timer_delete.c		\
 	timer_getoverr.c timer_gettime.c timer_routines.c		\
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c
index 6013ab0..965327c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c
@@ -27,6 +27,7 @@  extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe);
 void
 _longjmp_unwind (jmp_buf env, int val)
 {
+  if (__pthread_cleanup_upto != NULL)
     __pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME);
 }
 libc_hidden_def(_longjmp_unwind)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c
deleted file mode 100644
index 28672a6..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c
+++ /dev/null
@@ -1,20 +0,0 @@ 
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* No difference to lowlevellock.c, except we lose a couple of functions.  */
-#include "lowlevellock.c"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
index 75369bd..4294a20 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
@@ -24,9 +24,6 @@ 
 #include <tls.h>
 
 void
-#ifndef IS_IN_libpthread
-weak_function
-#endif
 __lll_lock_wait_private (int *futex)
 {
   if (*futex == 2)
-- 
2.1.4