Package: dietlibc / 0.34~cvs20160606-12

Metadata

Package Version Patches format
dietlibc 0.34~cvs20160606-12 3.0 (quilt)

Patch series

view the series file
Patch File delta Description
backports/bugfixes.diff | (download)

lib/__v_printf.c | 12 11 + 1 - 0 !
lib/__v_scanf.c | 3 3 + 0 - 0 !
lib/atoi.c | 2 1 + 1 - 0 !
lib/atol.c | 2 1 + 1 - 0 !
lib/siphash24.c | 14 7 + 7 - 0 !
lib/strchr.c | 16 12 + 4 - 0 !
lib/strtod.c | 6 3 + 3 - 0 !
lib/strtof.c | 6 3 + 3 - 0 !
lib/strtold.c | 6 3 + 3 - 0 !
lib/tcflush.c | 2 1 + 1 - 0 !
lib/vsprintf.c | 2 1 + 1 - 0 !
libcruft/dnscruft.c | 3 2 + 1 - 0 !
libregex/rx.c | 2 2 + 0 - 0 !
librpc/clnt_perror.c | 6 4 + 2 - 0 !
librpc/pmap_rmt.c | 2 2 + 0 - 0 !
librpc/xdr.c | 7 5 + 2 - 0 !
libstdio/fdglue2.c | 2 1 + 1 - 0 !
libstdio/freopen.c | 2 1 + 1 - 0 !
libstdio/vfdprintf.c | 6 3 + 3 - 0 !
libstdio/vprintf.c | 7 4 + 3 - 0 !
libugly/asprintf.c | 3 2 + 1 - 0 !
libugly/iconv.c | 1 1 + 0 - 0 !
libugly/vasprintf.c | 3 2 + 1 - 0 !
23 files changed, 75 insertions(+), 40 deletions(-)

 backport a number of general bugfixes from upstream
 some bounds checking, out of bounds writes, nil pointer dereference
 in error path, uninitialised variable, plus a few warning fixes for
 pointer casts and fallthroughs
backports/ia64 fix ftbfs.diff | (download)

ia64/Makefile.add | 2 1 + 1 - 0 !
ia64/clone.S | 1 0 + 1 - 0 !
ia64/unified.S | 16 16 + 0 - 0 !
include/asm/ia64-sigcontext.h | 2 2 + 0 - 0 !
4 files changed, 19 insertions(+), 2 deletions(-)

 fix ia64 build by backporting enough from upstream
workarounds/sparc64 tls errno.diff | (download)

include/errno.h | 4 4 + 0 - 0 !
lib/errno.c | 1 1 + 0 - 0 !
lib/errno_location.c | 2 2 + 0 - 0 !
3 files changed, 7 insertions(+)

 sparc64: work around compiler bug
 Work around sparc64 gcc6 bug that mis-optimizes TLS variable access
 to errno in certain situations.
 .
 When errno is accessed multiple times in a function, the relative
 offset of the variable to the thread pointer may be stored on the
 stack in some cases (because loading it from the stack takes only one
 instruction, whereas loading it from scratch takes 2-4).
 Unfortunately, in some cases the compiler will only generate 32 bit
 loads/stores (and not 64 bit), and while the offset is usually much
 smaller than 2^31, it is negative, and the load instruction the
 compiler generates does not sign-extend. This causes the compiler to
 load (tls-base + 2^31 - offset) instead of (tls-base - offset),
 resulting in a segfault.
 .
 The precise bug has not been tracked down so far, because in most
 cases the compiler will either re-use another register or indeed
 generate 64 bit loads/stores, making debugging the issue quite tricky.
 .
 This patch replaces errno with a define to (*__errno_location()),
 which circumvents this issue. But as this is slightly slower and
 typically produces larger code, only enable it on sparc64.
 .
 As soon as the compiler bug is tracked down further, this workaround
 should be removed.
workarounds/tcb on stack atexit.diff | (download)

lib/stackgap-common.h | 16 15 + 1 - 0 !
1 file changed, 15 insertions(+), 1 deletion(-)

 work around problem of atexit() functions accessing the tcb
 atexit() functions might want to access the TCB (such as libpthread's
 own internal atexit function), and they might be called from the
 startup code after the end of stackgap(), on whose stack the TCB is
 allocated.
 .
 This is a temporary workaround to make this work for most use cases,
 but this needs to be followed up with a proper fix.
bugfixes/missing socket syscalls.diff | (download)

aarch64/recv.c | 2 2 + 0 - 0 !
aarch64/send.c | 2 2 + 0 - 0 !
arm/syscalls.h | 2 1 + 1 - 0 !
ia64/syscalls.h | 3 2 + 1 - 0 !
include/sys/socket.h | 2 2 + 0 - 0 !
lib/__accept4.c | 17 17 + 0 - 0 !
mips64/recv.c | 2 2 + 0 - 0 !
mips64/send.c | 2 2 + 0 - 0 !
parisc/__sendto.S | 3 3 + 0 - 0 !
parisc/sendto.S | 3 0 + 3 - 0 !
parisc/syscalls.h | 8 6 + 2 - 0 !
syscalls.s/accept4.S | 2 1 + 1 - 0 !
syscalls.s/ppoll.S | 5 5 + 0 - 0 !
13 files changed, 45 insertions(+), 8 deletions(-)

 add missing socket-related syscalls on various platforms
 Various platforms were missng socket-related syscalls (e.g. send(),
 recv()); make sure they are available.
 .
  - define accept4() in sys/socket.h
  - generic: define ppoll() syscall, been available since 2.6.16 (a
    decade ago)
  - aarch64, mips64: re-use x86_64's recv/send implementation that
    defers to recvfrom()/sendto()
  - parisc: fix weak syscalls (wrong order in macro definition),
    declare sendto in __sendto.S not sendto.S to properly override the
    generic version (need syscall6 here)
  - arm, ia64: define __NR_ppoll
  - add generic __accept4 implementation via socketcall if that's what
    the architecture supports (currently s390[x] only)
bugfixes/pthread dont override errno location.diff | (download)

libpthread/pthread_internal.c | 3 3 + 0 - 0 !
libpthread/thread_internal.h | 2 1 + 1 - 0 !
2 files changed, 4 insertions(+), 1 deletion(-)

 don't override errno_location in libpthread if tls is enabled
 If TLS is enabled, errno is already thread-safe. Don't override
 errno_location in that case, otherwise the errno external code sees is not
 the same as the errno syscalls see (that call __errno_location directly).
bugfixes/aarch64 define __clone.diff | (download)

aarch64/clone.S | 4 3 + 1 - 0 !
1 file changed, 3 insertions(+), 1 deletion(-)

 aarch64: define __clone, make clone weak
 libpthread requires an internal __clone to be defined and clone to be
 a weak alias against it. Otherwise linking against -lpthread would
 fail in many cases.
bugfixes/x32 define munmap and exit.diff | (download)

x32/Makefile.add | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

 build __munmap_and_exit on x32
 __munmap_and_exit is required by libpthread, so build it. (The x86_64
 variant thereof is compatible with x32, so just reference it from
 Makefile.add.)
bugfixes/libc_waitpid.diff | (download)

ia64/__waitpid.c | 6 5 + 1 - 0 !
s390/__waitpid.c | 6 5 + 1 - 0 !
s390x/__waitpid.c | 6 5 + 1 - 0 !
3 files changed, 15 insertions(+), 3 deletions(-)

 fix waitpid with -lpthread on s390{,x}, mips64, ia64
 On these four architectures waitpid() was defined as a strong function
 in libc directly, instead of having a weak alias to __libc_waitpid.
 Due to the unavailability of __libc_waitpid for this reason, linking
 against -lpthread was not possible in many cases. Follow the scheme
 for waitpid that is used on other architectures to make linking
 against -lpthread work again.
bugfixes/s390x testandset.diff | (download)

s390x/__testandset.S | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

 fix __testandset on s390x.
 __testandset was broken on s390x, because it assumed 32bit as well
 (the code was identical to s390) - this would cause lockups on spin
 locks.
bugfixes/parisc getsockopt.diff | (download)

parisc/__getsockopt.S | 3 3 + 0 - 0 !
parisc/getsockopt.S | 3 0 + 3 - 0 !
2 files changed, 3 insertions(+), 3 deletions(-)

 fix getsockopt() on hppa
 PA-RISC overrides getsockopt() because it requires the last parameter
 to be passed on the stack to the function, and that needs to be
 translated to the kernel system call - and a recent renaming of
 getsockopt.S to __getsockopt.S (including a change to a weak symbol)
 was not done for PA-RISC, causing getsockopt() to always fail with
 "Bad Address".
bugfixes/parisc atfork.diff | (download)

libpthread/pthread_atfork.c | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

 properly initialize pthread_atfork's spinlock
 On PA-RISC (due to some quirk of the instruction set) an unlocked
 spinlock is initialized with a 1, not a 0, as on other platforms. But
 pthread_atfork's spinlock wasn't properly initialized with
 PTHREAD_SPIN_UNLOCKED, instead it was just zero'd out, causing the
 code to loop endlessly on fork() whenever -lpthread was linked in.
bugfixes/thread self vs tcb.diff | (download)

libpthread/pthread_internal.c | 15 1 + 14 - 0 !
1 file changed, 1 insertion(+), 14 deletions(-)

 fix libpthread's __thread_self on most non-x86 platforms
 The thread descriptor is (in general) not to be found at the thread
 pointer register (that's where the TCB is). The code for x86 (both 32
 and 64 bit) does this correctly because it directly reads the ->self
 data member (via a segment register based memory access). However, the
 other platforms would just return the thread pointer directly - and
 hence the wrong data structure.
 .
 Since there are open questions w.r.t. the TCB layout on msot platforms
 fall back to the less efficient (but working) global search on non-x86
 for now.
bugfixes/alpha testandset.diff | (download)

alpha/__testandset.S | 3 3 + 0 - 0 !
1 file changed, 3 insertions(+)

 fix return value of __testandset on alpha
 __testandset would always return 1, irrespective of whether the lock
 was previously set or not, causing an endless loop even with an
 unlocked spinlock. Fix this by returning 0 in the case where the lock
 could be taken.
bugfixes/arm64 testandset.diff | (download)

aarch64/__testandset.S | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

 fix register reuse in __testandset on arm64
 In the case where the stlxr instruction fails on arm64 (either due to
 another thread having accesed that memory location or spuriously) the
 register x2 (which stores the pointer to the memory location) is now
 useless because the original implementation reused it (which it should
 not have).
 .
 Just use the unused w3 register for the status result instead.
bugfixes/alpha setjmp.diff | (download)

alpha/setjmp.S | 22 20 + 2 - 0 !
1 file changed, 20 insertions(+), 2 deletions(-)

 alpha: fix broken setjmp()
 setjmp() on alpha was broken (due to the way the GP was handled). This
 patch adds a proper prologue to all setjmp variants, and ensures that
 the jump to __sigjmp_save includes the information that the GP hasn't
 changed, so __sigjmp_save doesn't erroneously try to reload it in its
 own prologue, reading a wrong value and crashing.
bugfixes/offsetof typo.diff | (download)

include/stddef.h | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

---
bugfixes/newer linux headers.diff | (download)

include/linux/types.h | 41 41 + 0 - 0 !
1 file changed, 41 insertions(+)

 support newer linux headers
 Copy some definitions from /usr/include/linux/types.h to make
 applications using them not FTBFS.
bugfixes/mips tls.diff | (download)

include/sys/tls.h | 4 4 + 0 - 0 !
1 file changed, 4 insertions(+)

 add mips-specific stub prototype for build log scanner
bugfixes/use cflags also for dummy.diff | (download)

Makefile | 3 2 + 1 - 0 !
1 file changed, 2 insertions(+), 1 deletion(-)

 never compile any file without cppflags/cflags
 discovered by build log scanner
bugfixes/utime test.diff | (download)

test/utime.c | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

 fix atime comparisons in utime test
 When I look at the source code in test/utime.c, that test
 (and the following one) looks backwards. Computers are fast
 enough that the usual case is st.st_atime == now.
bugfixes/regex stack overflow.diff | (download)

libregex/rx.c | 6 3 + 3 - 0 !
1 file changed, 3 insertions(+), 3 deletions(-)

 fix regex stack overflow
 this only caused an FTBFS due to a testsuite failure on alpha
 but overwrote the stack on any architecture
bugfixes/ia64 fix weaks.diff | (download)

ia64/fork.S | 5 2 + 3 - 0 !
ia64/syscalls.h | 6 4 + 2 - 0 !
2 files changed, 6 insertions(+), 5 deletions(-)

 fix weak symbols on ia64
bugfixes/testandset size and alignment.diff | (download)

include/pthread.h | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

 change anything passed to __testandset to at least long
 some architectures need at least 64 bit (alpha) space, and some need
 64 bit alignent (IA64) even if 32 bit space might be enough; make it
 consistent (except hppa) with the testsuites use of a long
bugfixes/cflags.diff | (download)

x32/Makefile.add | 5 4 + 1 - 0 !
x86_64/Makefile.add | 11 6 + 5 - 0 !
2 files changed, 10 insertions(+), 6 deletions(-)

 do not override main cflags for amd64 or x32
 Fixes, at least, stack smashing on x32 due to missing EXTRACFLAGS.
 .
 We need the GCC include path restored (main CFLAGS contain -nostdinc)
 for building a file that uses GCC vector math intrinsics, though.
bugfixes/x32 struct member sizes.diff | (download)

include/asm/x86_64-sigcontext.h | 51 27 + 24 - 0 !
include/sys/resource.h | 33 29 + 4 - 0 !
include/sys/time.h | 6 6 + 0 - 0 !
include/sys/types.h | 8 6 + 2 - 0 !
4 files changed, 68 insertions(+), 30 deletions(-)

 fix some struct member sizes on x32
 These need to be of the same size as amd64 uses.
 .
 Also fix signedness of useconds_t.
bugfixes/hppa socketcalls.diff | (download)

parisc/__setsockopt.S | 3 3 + 0 - 0 !
parisc/unified.S | 8 4 + 4 - 0 !
2 files changed, 7 insertions(+), 4 deletions(-)

 fix fifth and sixth syscall argument in setsockopt
 Also uses implicit space register selection in generic syscall code.
features/unshare.diff | (download)

syscalls.s/unshare.S | 3 3 + 0 - 0 !
1 file changed, 3 insertions(+)

 add unshare syscall
debian/sparc32 mcpu v9.diff | (download)

diet.c | 2 1 + 1 - 0 !
sparc/Makefile.add | 2 1 + 1 - 0 !
2 files changed, 2 insertions(+), 2 deletions(-)

 sparc: use -mcpu=v9 instead of -mcpu=supersparc
 This fixes a build failure of libowfat on sparc:
 .
 diet -v -Os gcc -g -o t t.o libowfat.a `cat libsocket` -lpthread
 gcc -nostdlib -static -L/usr/lib/diet/lib-sparc /usr/lib/diet/lib-sparc/start.o -g -o t t.o libowfat.a -lpthread -isystem /usr/lib/diet/include -D__dietlibc__ -Os -mcpu=supersparc /usr/lib/diet/lib-sparc/libc.a -lgcc /usr/lib/diet/lib-sparc/libc.a
 /usr/lib/diet/lib-sparc/libc.a(vprintf.o): In function `vprintf':
 vprintf.c:(.text+0x1c): warning: warning: the printf functions add several kilobytes of bloat.
 t.o: In function `main':
 t.c:(.text+0x30): undefined reference to `__sync_add_and_fetch_4'
 t.c:(.text+0x48): undefined reference to `__sync_add_and_fetch_4'
 t.c:(.text+0x64): undefined reference to `__sync_bool_compare_and_swap_4'
 t.c:(.text+0x80): undefined reference to `__sync_bool_compare_and_swap_4'
 collect2: ld returned 1 exit status
 .
 According to http://www.debian.org/releases/stable/sparc/ch02s01.html.en
 supersparc isn't supported anymore anyway, and multisparc and niagara
 are v9.
debian/native x32.diff | (download)

Makefile | 4 4 + 0 - 0 !
diet.c | 4 4 + 0 - 0 !
2 files changed, 8 insertions(+)

 support native x32 builds
debian/buildflags.diff | (download)

Makefile | 65 33 + 32 - 0 !
1 file changed, 33 insertions(+), 32 deletions(-)

 allow useful passing-in of external cflags
 Make it possible to pass in external CFLAGS to the compiler. This way
 we can use dpkg-buildflags in debian/rules.
debian/multiarch.diff | (download)

diet.c | 107 105 + 2 - 0 !
1 file changed, 105 insertions(+), 2 deletions(-)

 add debian multiarch to diet wrapper
 In order to properly support Debian-style multiarch, make the diet
 wrapper use /usr/lib/<triplet>/diet instead of /usr/lib/diet as its
 default diethome, while still detecting cross compilers. This is far
debian/reproducible buildpath.diff | (download)

aarch64/start.S | 2 2 + 0 - 0 !
alpha/start.S | 2 2 + 0 - 0 !
arm/start.S | 2 2 + 0 - 0 !
i386/start.S | 2 2 + 0 - 0 !
ia64/start.S | 2 2 + 0 - 0 !
mips/start.S | 2 2 + 0 - 0 !
parisc/start.S | 2 2 + 0 - 0 !
ppc/start.S | 2 2 + 0 - 0 !
ppc64/start.S | 2 2 + 0 - 0 !
s390/start.S | 2 2 + 0 - 0 !
s390x/start.S | 2 2 + 0 - 0 !
sparc/start.S | 2 2 + 0 - 0 !
sparc64/start.S | 2 2 + 0 - 0 !
x32/start.S | 2 2 + 0 - 0 !
x86_64/start.S | 2 2 + 0 - 0 !
15 files changed, 30 insertions(+)

 add .file tags to all start.s files
 When linking raw object files, if they don't have a FILE entry _and_
 they contain local symbols, ld.bfd will add FILE entries itself, but
 with the file name specified on the command line. As the diet wrapper
 adds an absolute path for the startup file here, this causes an
 implicit encoding of the build path. Simply add .file "start.S at the
 beginning of all start.S startup files to avoid this problem.
 .
 See also: https://bugs.debian.org/857315
security/insecure default PATH.diff | (download)

include/paths.h | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

 fix insecure default path
 Throsten Glaser <t.glaser@tarent.de> discovered that the default PATH
 (absent the environment variable) contains the local directory.