Debian Patches

Status for dietlibc/0.34~cvs20160606-14

Patch Description Author Forwarded Bugs Origin Last update
backports/bugfixes.diff 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
mirabilos <> no
backports/ia64-fix-ftbfs.diff fix IA64 build by backporting enough from upstream mirabilos <> no
workarounds/sparc64-tls-errno.diff 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.
Shouldn't be forwarded, as it only works around the errno case, but
not other cases of TLS variables.
Christian Seiler <> no 2016-05-29
workarounds/tcb-on-stack-atexit.diff 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
This is a temporary workaround to make this work for most use cases,
but this needs to be followed up with a proper fix.
Christian Seiler <> no 2017-01-05
bugfixes/missing-socket-syscalls.diff 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)
Christian Seiler <> invalid 2018-10-06
bugfixes/pthread-dont-override-errno-location.diff 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).
Christian Seiler <> no debian 2017-01-05
bugfixes/aarch64-define-__clone.diff 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.
Christian Seiler <> no 2017-01-05
bugfixes/x32-define-munmap-and-exit.diff 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
Christian Seiler <> no 2017-01-05
bugfixes/libc_waitpid.diff 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.
Christian Seiler <> no debian 2017-01-05
bugfixes/s390x-testandset.diff 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
Christian Seiler <> no 2017-01-05
bugfixes/parisc-getsockopt.diff 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".
Christian Seiler <> no 2017-01-25
bugfixes/parisc-atfork.diff 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.
Christian Seiler <> no 2017-01-25
bugfixes/thread-self-vs-tcb.diff 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.
Christian Seiler <> no 2017-01-06
bugfixes/alpha-testandset.diff 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.
Christian Seiler <> no 2017-01-25
bugfixes/arm64-testandset.diff 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.
Christian Seiler <> no debian 2017-02-18
bugfixes/alpha-setjmp.diff 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.
Christian Seiler <> no 2017-01-25
bugfixes/offsetof-typo.diff # DP: fix typo preventing the compiler builtin from being used no
bugfixes/newer-linux-headers.diff Support newer Linux headers Copy some definitions from /usr/include/linux/types.h to make
applications using them not FTBFS.
mirabilos <> no debian
bugfixes/mips-tls.diff add MIPS-specific stub prototype for build log scanner mirabilos <> no
bugfixes/use-cflags-also-for-dummy.diff never compile any file without CPPFLAGS/CFLAGS discovered by build log scanner mirabilos <> no
bugfixes/utime-test.diff 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.
Larry Doolittle <> invalid
bugfixes/regex-stack-overflow.diff fix regex stack overflow this only caused an FTBFS due to a testsuite failure on alpha
but overwrote the stack on any architecture
mirabilos <> no
bugfixes/ia64-fix-weaks.diff fix weak symbols on IA64 mirabilos <> no
bugfixes/testandset-size-and-alignment.diff 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 testsuiteā€™s use of a long
mirabilos <> no
bugfixes/cflags.diff 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.
mirabilos <> invalid debian 2019-10-24
bugfixes/x32-struct-member-sizes.diff Fix some struct member sizes on x32 These need to be of the same size as amd64 uses.
Also fix signedness of useconds_t.
mirabilos <> invalid debian 2019-10-24
bugfixes/hppa-socketcalls.diff Fix fifth and sixth syscall argument in setsockopt Also uses implicit space register selection in generic syscall code. John David Anglin <> invalid debian 2019-11-10
features/unshare.diff add unshare syscall Larry Doolittle <> no
debian/sparc32-mcpu-v9.diff 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
supersparc isn't supported anymore anyway, and multisparc and niagara
are v9.
Gerrit Pape <> no 2010-04-20
debian/native-x32.diff Support native x32 builds Christian Seiler <> invalid
debian/buildflags.diff 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.
Maybe we should forward this?
Christian Seiler <> no 2016-10-31
debian/multiarch.diff 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
easier than patching dietlibc to use different short architecture
names for the cases where the same name is used for multiple Debian
archs (powerpc/powerpcspe: ppc, armel/armhf: arm, etc.), all the
while still retaining some degree of compatibility with upstream.
If no cross compiler is detected, the native architecture is used, if
an unknown cross compiler is detected, /usr/lib/diet is used as the
default fallback. Setting the DIETHOME environment variable can
override this, of course.
Christian Seiler <> invalid 2016-05-02
debian/reproducible-buildpath.diff 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:
Christian Seiler <> invalid
security/insecure-default-PATH.diff Fix insecure default PATH Throsten Glaser <> discovered that the default PATH
(absent the environment variable) contains the local directory.
Christian Seiler <> yes upstream 2016-07-20

All known versions for source package 'dietlibc'