klibc.git
4 years agoMerge klibc (2.0.4-9+deb9u1) import into refs/heads/workingbranch
Ben Hutchings [Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)]
Merge klibc (2.0.4-9+deb9u1) import into refs/heads/workingbranch

4 years ago[klibc] cpio: Fix possible crash on 64-bit systems
Ben Hutchings [Wed, 28 Apr 2021 17:46:47 +0000 (19:46 +0200)]
[klibc] cpio: Fix possible crash on 64-bit systems

Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=2e48a12ab1e30d43498c2d53e878a11a1b5102d5
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-31871

copyin_link() tries to allocate (unsigned int)c_filesize + 1 bytes.
If c_filesize == UINT_MAX, this works out as 0 bytes, resulting in a
null pointer and a subsequent SIGSEGV.

The previous commit made this impossible on 32-bit systems.

CVE-2021-31871

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name 0040-klibc-cpio-Fix-possible-crash-on-64-bit-systems.patch

4 years ago[klibc] cpio: Fix possible integer overflow on 32-bit systems
Ben Hutchings [Wed, 28 Apr 2021 03:16:34 +0000 (05:16 +0200)]
[klibc] cpio: Fix possible integer overflow on 32-bit systems

Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=9b1c91577aef7f2e72c3aa11a27749160bd278ff
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-31872

The maximum name and file sizes in the "new" header format are 32-bit
unsigned values.  However, the I/O functions mostly use long for sizes
and offsets, so that sizes >= 2^31 are handled wrongly on 32-bit
systems.

The current GNU cpio code doesn't seem to have this problem, but the
divergence between this version and that is large enough that I can't
simply cherry-pick a fix for it.

As a short-term fix, in read_in_new_ascii(), fail if c_namesize or
c_filesize is > LONG_MAX.

CVE-2021-31872

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name 0039-klibc-cpio-Fix-possible-integer-overflow-on-32-bit-s.patch

4 years ago[klibc] calloc: Fail if multiplication overflows
Ben Hutchings [Wed, 28 Apr 2021 02:29:50 +0000 (04:29 +0200)]
[klibc] calloc: Fail if multiplication overflows

Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=292650f04c2b5348b4efbad61fb014ed09b4f3f2
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-31870

calloc() multiplies its 2 arguments together and passes the result to
malloc().  Since the factors and product both have type size_t, this
can result in an integer overflow and subsequent buffer overflow.
Check for this and fail if it happens.

CVE-2021-31870

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name 0037-klibc-calloc-Fail-if-multiplication-overflows.patch

4 years ago[klibc] malloc: Fail if requested size > PTRDIFF_MAX
Ben Hutchings [Wed, 28 Apr 2021 02:03:49 +0000 (04:03 +0200)]
[klibc] malloc: Fail if requested size > PTRDIFF_MAX

Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=a31ae8c508fc8d1bca4f57e9f9f88127572d5202
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-31873

malloc() adds some overhead to the requested size, which may result in
an integer overflow and subsequent buffer overflow if it is close to
SIZE_MAX.  It should fail if size is large enough for this to happen.

Further, it's not legal for a C object to be larger than
PTRDIFF_MAX (half of SIZE_MAX) as pointer arithmetic within it could
overflow.  So return failure immediately if size is greater than that.

CVE-2021-31873

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name 0036-klibc-malloc-Fail-if-requested-size-PTRDIFF_MAX.patch

4 years ago[klibc] malloc: Set errno on failure
Ben Hutchings [Wed, 28 Apr 2021 01:57:39 +0000 (03:57 +0200)]
[klibc] malloc: Set errno on failure

Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=7f6626d12daa2f1efd9953d1f4ba2065348dc5cd

malloc() is specified to set errno = ENOMEM on failure, so do that.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name 0035-klibc-malloc-Set-errno-on-failure.patch

4 years agorun-init: Add dry-run mode
Ben Hutchings [Sun, 17 Jan 2016 19:50:28 +0000 (19:50 +0000)]
run-init: Add dry-run mode

Bug-Debian: https://bugs.debian.org/810965

initramfs-tools wants to validate the real init program before running
it, as there is no way out once it has exec'd run-init.  This is
complicated by the increasing use of symlinks for /sbin/init and for
/sbin itself.  We can't simply resolve them with 'readlink -f' because
any absolute symlinks will be resolved using the wrong root.  Add a
dry-run mode (-n option) to run-init that goes as far as possible to
validate that the given init is executable.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name run-init-add-dry-run-mode.patch

4 years agosyscalls: Override detection of direct socket syscalls on i386, m68k, s390
Ben Hutchings [Tue, 5 Jan 2016 21:11:41 +0000 (21:11 +0000)]
syscalls: Override detection of direct socket syscalls on i386, m68k, s390

Bug-Debian: https://bugs.debian.org/809423
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003882.html

The direct socket syscalls are now implemented on i386, m68k and s390,
making socketcall() obsolete.  However we need to keep klibc/unstable
working with the last stable kernel version (3.16) so we shouldn't use
them yet.

Gbp-Pq: Name syscalls-override-detection-of-direct-socket-syscalls-on-i386-m68k-s390.patch

4 years ago[klibc] mips/setjmp.S: don't save and restore floating-point registers
YunQiang Su [Sat, 5 Sep 2015 13:39:25 +0000 (06:39 -0700)]
[klibc] mips/setjmp.S: don't save and restore floating-point registers

Bug-Debian: https://bugs.debian.org/789683
Forwarded: http://www.zytor.com/pipermail/klibc/2015-September/003833.html

Klibc FTBFS with '-mno-odd-spreg' on mips32(el) platforms,
As it try to save/restore odd-number FPR.

Indeed no other architectures save/restore FPR at all.
It shouldn't be needed.

Gbp-Pq: Name klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch

4 years agogzip: Fix silent fallback to decompression
Ben Hutchings [Fri, 18 Sep 2015 19:59:17 +0000 (21:59 +0200)]
gzip: Fix silent fallback to decompression

Bug-Debian: https://bugs.debian.org/355809
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003892.html

If the gzip utilities are built without support for compression,
they will always attempt to carry out decompression even if the
command name and options don't imply that.  Instead they should
fail with an explicit error in this case.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name gzip-fix-silent-fallback-to-decompression.patch

4 years ago[PATCH] ppc64: fix struct stat
Aurelien Jarno [Sat, 25 Apr 2015 12:16:16 +0000 (14:16 +0200)]
[PATCH] ppc64: fix struct stat

Bug-Debian: https://bugs.debian.org/783292
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003881.html

On ppc64 the struct stat defined by klibc matches the kernel one.
However it contains implicit padding before the st_rdev field due to the
64-bit alignement. For internal reasons, klibc defines st_rdev as a pair
of 32-bit values (using the __stdev64 macro). They only need to be
32-bit aligned and as a consequence st->st_rdev is incorrectly defined.

The solution is to add an explicit padding in the structure. This fixes
the resume binary on ppc64 BE and LE, and probably other things.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Gbp-Pq: Name klibc-ppc64-fix-struct-stat.patch

4 years ago[klibc] Add pread and pwrite 32bit syscall wrappers for parisc
Helge Deller [Wed, 23 Apr 2014 20:52:53 +0000 (22:52 +0200)]
[klibc] Add pread and pwrite 32bit syscall wrappers for parisc

Bug-Debian: https://bugs.debian.org/745660
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003880.html

On the hppa arch (32bit userspace and 32 or 64bit kernel), the fstype
program fails to detect the filesystem.  The reason for this failure
is, that fstype calls the pread() syscall, which has on some
architectures with 32bit userspace a different calling syntax.  I
noticed this bug on hppa, but I assume s390 (32bit) and others might
run into similiar issues.

Signed-off-by: Helge Deller <deller@gmx.de>
Gbp-Pq: Name klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch

4 years agodash: mkbuiltins: Fix sort order harder
Ben Hutchings [Wed, 9 Sep 2015 01:12:40 +0000 (02:12 +0100)]
dash: mkbuiltins: Fix sort order harder

Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003890.html

LC_COLLATE can be overriden by LC_ALL, so set LC_ALL instead when
running sort.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name dash-mkbuiltins-fix-sort-order-harder.patch

4 years agoInstall headers with consistent mode
Ben Hutchings [Wed, 9 Sep 2015 00:24:56 +0000 (01:24 +0100)]
Install headers with consistent mode

Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003891.html

Currently we ensure the installed headers are readable by everyone,
but write permissions will depend on the current umask.  Turn off the
group and other writable bits to ensure consistent results.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name install-headers-with-consistent-mode.patch

4 years ago[PATCH 3/3] add-mips64-support-arch-mips64-specific
Dejan Latinovic [Fri, 6 Mar 2015 00:51:45 +0000 (16:51 -0800)]
[PATCH 3/3] add-mips64-support-arch-mips64-specific

Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=3438d861da2e6939a6b0d454ffe247c19ead5993

Description: Adding mips64 specific chagnes.
Modeled on mips 32 and adapted for 64 bit ABI.
 - MCONFIG:  using existing klibc.ld scrpit
 - crt0.S:   adapted gp initialization
 - setjmp.S: do not save floating-point state

Gbp-Pq: Name 0003-add-mips64-support-arch-mips64-specific.patch

4 years ago[PATCH 2/3] add-mips64-support-arch-mips32
Dejan Latinovic [Fri, 6 Mar 2015 00:51:44 +0000 (16:51 -0800)]
[PATCH 2/3] add-mips64-support-arch-mips32

Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=ccd50880175e79fb9bc544c96d72b8971303cc0a

Description: Add mips64 support, using existing mips32 code.
 - using mips32 assembler source files: pipe.S vfork.S syscall.S
 - sysstub.ph: copied over from klibc/arch/mips

Gbp-Pq: Name 0002-add-mips64-support-arch-mips32.patch

4 years ago[PATCH 1/3] add-mips64-support-headers
Dejan Latinovic [Fri, 6 Mar 2015 00:51:44 +0000 (16:51 -0800)]
[PATCH 1/3] add-mips64-support-headers

Origin: https://git.kernel.org/cgit/libs/klibc/klibc.git/commit/?id=493f9a99220aed4eb7c6e3dd9018c037d45b13e2

Description: Added header files for mips64.
Modeled on mips 32 header files and adapted for 64 bit ABI.
 - archsetjmp.h: do not save floating-point state
 - asm.h:        Symbolic register names for 64 bit ABI

Gbp-Pq: Name 0001-add-mips64-support-headers.patch

4 years ago[klibc] MIPS: Update archfcntl.h
Ben Hutchings [Sun, 5 Oct 2014 00:08:21 +0000 (01:08 +0100)]
[klibc] MIPS: Update archfcntl.h

Bug-Debian: https://bugs.debian.org/763049
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003879.html

Update usr/include/arch/mips/archfcntl.h from kernel headers:

- Add definitions of O_PATH, O_TMPFILE
- Update value of O_SYNC to include __O_SYNC
- Add definitions of F_{SET,GET}OWN_EX, F_GETOWNER_UIDS,
  F_OFD_{GETLK,SETLK,SETLKW}, F_OWNER_{TID,PID,PGRP}

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mips-update-archfcntl-h.patch

4 years agomount: Implement -o defaults
Ben Hutchings [Sat, 4 Oct 2014 15:32:39 +0000 (16:32 +0100)]
mount: Implement -o defaults

Bug-Debian: https://bugs.debian.org/763049
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003887.html

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mount-implement-o-defaults.patch

4 years agoreadlink: Add -f option
Ben Hutchings [Sat, 27 Sep 2014 14:18:21 +0000 (15:18 +0100)]
readlink: Add -f option

Bug-Debian: https://bugs.debian.org/763049
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003886.html

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name readlink-add-f-option.patch

4 years ago[klibc] Implement realpath()
Ben Hutchings [Sat, 27 Sep 2014 14:04:15 +0000 (15:04 +0100)]
[klibc] Implement realpath()

Bug-Debian: https://bugs.debian.org/763049
Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003885.html

This is needed as the basis for the readlink -f option.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name implement-realpath.patch

4 years ago[klibc] [PATCH] ppc64: ELFv2: Load TOC value in system call stub
Mauricio Faria de Oliveira [Tue, 9 Sep 2014 22:17:19 +0000 (15:17 -0700)]
[klibc] [PATCH] ppc64: ELFv2: Load TOC value in system call stub

Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003878.html

This fixes a segmentation fault in the system call's error handling path with
dynamically-linked binaries on PowerPC64 little endian.  The system call stub
wasn't loading up r2 with the appropriate TOC value in its global entry point.

The r2 setup code comes from the FUNC_START macro in gcc [1] and an equivalent
one can also be found in the LOCALENTRY macro in glibc [2].

On the ELFv2 ABI (see [1]):
 - The global entry point is expected to load up r2 with the appropriate TOC
   value for this function.
 - The local entry point expects r2 to be set up to the current TOC.

The problem happened with dynamically-linked binaries because:
 - the system call is an indirect call (via global entry point) from the binary
   to the shared library, landing in the syscall stub  (which didn't load up r2
   with the TOC of the shared library)
 - its branch to __syscall_error is a direct call (via local entry point) within
   the shared library, landing in the function (which expects r2 to be set up to
   that TOC)
 - when the function attempts to store errno (in an address relative to the TOC),
   that address incorrectly pointed to a read-only segment -- segmentation fault.

The problem didn't happen with statically-linked binaries because the TOC value
wasn't different on that case.

Thanks and credits to Alan Modra and Ulrich Weigand, for helping with this and
pointing out the solution.

[1] https://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html
[2] https://www.sourceware.org/ml/libc-alpha/2013-11/msg00315.html

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Gbp-Pq: Name ppc64el-load-toc-syscall-stub.patch

4 years ago[PATCH] [klibc] Fix minimal mv to work across fs
maximilian attems [Mon, 4 Jul 2011 15:51:52 +0000 (17:51 +0200)]
[PATCH] [klibc] Fix minimal mv to work across fs

Forwarded: not-needed

This is the use case in initramfs to keep data from /run to /root/run
before calling switch_root().

copy_file() doesn't yet catch EINTR, but that seems less of an issue
in initramfs.

copy_file() and much logic out of copy() is from Ulrich Dangel.
Thank you for the collaboration on this blocker for
http://bugs.debian.org/627808

While we are it require move to have mv at least 2 arguments passed.

Signed-off-by: Ulrich Dangel <uli@spamt.net>
Signed-off-by: maximilian attems <max@stro.at>
[bwh: This is no longer needed by initramfs-tools starting with version 0.121,
 so can be dropped after the stretch release]

Gbp-Pq: Name Fix-minimal-mv-to-work-across-fs

4 years agoInclude the multiarch include directory in klcc's path
Steve Langasek [Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)]
Include the multiarch include directory in klcc's path

The multiarch include directory, /usr/include/<triplet>, needs to be
explicitly added to klcc's path; without this, klcc is incompatible
with recent Ubuntu versions of linux-libc-dev and fails to find any asm/
headers.

This change is safe to apply on non-multiarch-enabled systems, since
$(DEB_HOST_MULTIARCH) will evaluate empty.  However, upstreaming should
probably wait until we have a way to get this path information in a
vendor-neutral manner.

Gbp-Pq: Name multiarch-include-path

4 years agoFix klibc Debian specific build trouble
Ben Hutchings [Sun, 14 Mar 2010 18:41:56 +0000 (18:41 +0000)]
Fix klibc Debian specific build trouble

Simply remove the headers_install invocation and rely on linux-libc-dev.

With these changes:

(the extra chmod was needed to allow for umask > 022) I could compile,
link and run this program:

#include <unistd.h>

int main(void)
{
write(1, "Hello world\n", 12);
return 0;
}

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[ added multi arch support ]
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: maximilian attems <max@stro.at>
[ fixed cross building ]
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Gbp-Pq: Name klibc-linux-libc-dev

4 years agoNever clean files in quilt status directory
Ben Hutchings [Sun, 15 Jul 2018 20:53:39 +0000 (21:53 +0100)]
Never clean files in quilt status directory

The top-level "distclean" and "mrproper" targets delete zero-size
files in the source, perhaps assumed to be stamp files.  This is fine
for actual source direcgtories, but disastrous for a quilt status
directory.

For each patch, quilt stores the previous versions of the modified
files in a subdirectory of .pc.  If the patch creates a file, this
file will be empty.  Removing it effectively removes the file creation
from the patch.

The .git directory is already excluded from the clean rules for
a similar reason, so do the same for .pc.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name never-clean-files-in-quilt-status-directory.patch

4 years agoklibc (2.0.4-9+deb9u1) stretch-security; urgency=high
Ben Hutchings [Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)]
klibc (2.0.4-9+deb9u1) stretch-security; urgency=high

  * Never clean files in quilt status directory
  * debian/rules: Use $(MAKE) for recursive make
  * debian/rules: Change override_dh_auto_test rule to actually run tests
  * Apply security fixes from 2.0.9 (Closes: #989505):
    - malloc: Set errno on failure
    - malloc: Fail if requested size > PTRDIFF_MAX (CVE-2021-31873)
    - calloc: Fail if multiplication overflows (CVE-2021-31870)
    - cpio: Fix possible integer overflow on 32-bit systems (CVE-2021-31872)
    - cpio: Fix possible crash on 64-bit systems (CVE-2021-31871)

[dgit import unpatched klibc 2.0.4-9+deb9u1]

4 years agoImport klibc_2.0.4-9+deb9u1.debian.tar.xz
Ben Hutchings [Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)]
Import klibc_2.0.4-9+deb9u1.debian.tar.xz

[dgit import tarball klibc 2.0.4-9+deb9u1 klibc_2.0.4-9+deb9u1.debian.tar.xz]

8 years agoMerge klibc (2.0.4-9) import into refs/heads/workingbranch
Raspbian Automatic git importer [Thu, 22 Dec 2016 07:10:44 +0000 (07:10 +0000)]
Merge klibc (2.0.4-9) import into refs/heads/workingbranch

9 years agorun-init: Add dry-run mode
Ben Hutchings [Sun, 17 Jan 2016 19:50:28 +0000 (19:50 +0000)]
run-init: Add dry-run mode

initramfs-tools wants to validate the real init program before running
it, as there is no way out once it has exec'd run-init.  This is
complicated by the increasing use of symlinks for /sbin/init and for
/sbin itself.  We can't simply resolve them with 'readlink -f' because
any absolute symlinks will be resolved using the wrong root.  Add a
dry-run mode (-n option) to run-init that goes as far as possible to
validate that the given init is executable.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name run-init-add-dry-run-mode.patch

9 years agosyscalls: Override detection of direct socket syscalls on i386, m68k, s390
Ben Hutchings [Tue, 5 Jan 2016 21:11:41 +0000 (21:11 +0000)]
syscalls: Override detection of direct socket syscalls on i386, m68k, s390

The direct socket syscalls are now implemented on i386, m68k and s390,
making socketcall() obsolete.  However we need to keep klibc/unstable
working with the last stable kernel version (3.16) so we shouldn't use
them yet.

Gbp-Pq: Name syscalls-override-detection-of-direct-socket-syscalls-on-i386-m68k-s390.patch

9 years agomips/setjmp.S: don't save and restore floating-point registers
YunQiang Su [Sat, 5 Sep 2015 13:39:25 +0000 (06:39 -0700)]
mips/setjmp.S: don't save and restore floating-point registers

Klibc FTBFS with '-mno-odd-spreg' on mips32(el) platforms,
As it try to save/restore odd-number FPR.

Indeed no other architectures save/restore FPR at all.
It shouldn't be needed.

Gbp-Pq: Name klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch

9 years agogzip: Fix silent fallback to decompression
Ben Hutchings [Fri, 18 Sep 2015 19:59:17 +0000 (21:59 +0200)]
gzip: Fix silent fallback to decompression

If the gzip utilities are built without support for compression,
they will always attempt to carry out decompression even if the
command name and options don't imply that.  Instead they should
fail with an explicit error in this case.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name gzip-fix-silent-fallback-to-decompression.patch

9 years agoppc64: fix struct stat
Aurelien Jarno [Sat, 25 Apr 2015 12:16:16 +0000 (14:16 +0200)]
ppc64: fix struct stat

On ppc64 the struct stat defined by klibc matches the kernel one.
However it contains implicit padding before the st_rdev field due to the
64-bit alignement. For internal reasons, klibc defines st_rdev as a pair
of 32-bit values (using the __stdev64 macro). They only need to be
32-bit aligned and as a consequence st->st_rdev is incorrectly defined.

The solution is to add an explicit padding in the structure. This fixes
the resume binary on ppc64 BE and LE, and probably other things.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Gbp-Pq: Name klibc-ppc64-fix-struct-stat.patch

9 years agoAdd pread and pwrite 32bit syscall wrappers for parisc
Helge Deller [Wed, 23 Apr 2014 20:52:53 +0000 (22:52 +0200)]
Add pread and pwrite 32bit syscall wrappers for parisc

On the hppa arch (32bit userspace and 32 or 64bit kernel), the fstype
program fails to detect the filesystem.  The reason for this failure
is, that fstype calls the pread() syscall, which has on some
architectures with 32bit userspace a different calling syntax.  I
noticed this bug on hppa, but I assume s390 (32bit) and others might
run into similiar issues.

Signed-off-by: Helge Deller <deller@gmx.de>
Gbp-Pq: Name klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch

9 years agodash: mkbuiltins: Fix sort order harder
Ben Hutchings [Wed, 9 Sep 2015 01:12:40 +0000 (02:12 +0100)]
dash: mkbuiltins: Fix sort order harder

LC_COLLATE can be overriden by LC_ALL, so set LC_ALL instead when
running sort.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name dash-mkbuiltins-fix-sort-order-harder.patch

9 years agoInstall headers with consistent mode
Ben Hutchings [Wed, 9 Sep 2015 00:24:56 +0000 (01:24 +0100)]
Install headers with consistent mode

Currently we ensure the installed headers are readable by everyone,
but write permissions will depend on the current umask.  Turn off the
group and other writable bits to ensure consistent results.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name install-headers-with-consistent-mode.patch

9 years agoadd-mips64-support-arch-mips64-specific
Dejan Latinovic [Fri, 6 Mar 2015 00:51:45 +0000 (16:51 -0800)]
add-mips64-support-arch-mips64-specific

Description: Adding mips64 specific chagnes.
Modeled on mips 32 and adapted for 64 bit ABI.
 - MCONFIG:  using existing klibc.ld scrpit
 - crt0.S:   adapted gp initialization
 - setjmp.S: do not save floating-point state

Gbp-Pq: Name 0003-add-mips64-support-arch-mips64-specific.patch

9 years agoadd-mips64-support-arch-mips32
Dejan Latinovic [Fri, 6 Mar 2015 00:51:44 +0000 (16:51 -0800)]
add-mips64-support-arch-mips32

Description: Add mips64 support, using existing mips32 code.
 - using mips32 assembler source files: pipe.S vfork.S syscall.S
 - sysstub.ph: copied over from klibc/arch/mips

Gbp-Pq: Name 0002-add-mips64-support-arch-mips32.patch

9 years agoadd-mips64-support-headers
Dejan Latinovic [Fri, 6 Mar 2015 00:51:44 +0000 (16:51 -0800)]
add-mips64-support-headers

Description: Added header files for mips64.
Modeled on mips 32 header files and adapted for 64 bit ABI.
 - archsetjmp.h: do not save floating-point state
 - asm.h:        Symbolic register names for 64 bit ABI

Gbp-Pq: Name 0001-add-mips64-support-headers.patch

9 years agoMIPS: Update archfcntl.h
Ben Hutchings [Sun, 5 Oct 2014 00:08:21 +0000 (01:08 +0100)]
MIPS: Update archfcntl.h

Update usr/include/arch/mips/archfcntl.h from kernel headers:

- Add definitions of O_PATH, O_TMPFILE
- Update value of O_SYNC to include __O_SYNC
- Add definitions of F_{SET,GET}OWN_EX, F_GETOWNER_UIDS,
  F_OFD_{GETLK,SETLK,SETLKW}, F_OWNER_{TID,PID,PGRP}

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mips-update-archfcntl-h.patch

9 years agomount: Implement -o defaults
Ben Hutchings [Sat, 4 Oct 2014 15:32:39 +0000 (16:32 +0100)]
mount: Implement -o defaults

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mount-implement-o-defaults.patch

9 years agoreadlink: Add -f option
Ben Hutchings [Sat, 27 Sep 2014 14:18:21 +0000 (15:18 +0100)]
readlink: Add -f option

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name readlink-add-f-option.patch

9 years agoImplement realpath()
Ben Hutchings [Sat, 27 Sep 2014 14:04:15 +0000 (15:04 +0100)]
Implement realpath()

This is needed as the basis for the readlink -f option.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name implement-realpath.patch

9 years agoppc64: ELFv2: Load TOC value in system call stub
Mauricio Faria de Oliveira [Tue, 9 Sep 2014 22:17:19 +0000 (15:17 -0700)]
ppc64: ELFv2: Load TOC value in system call stub

This fixes a segmentation fault in the system call's error handling path with
dynamically-linked binaries on PowerPC64 little endian.  The system call stub
wasn't loading up r2 with the appropriate TOC value in its global entry point.

The r2 setup code comes from the FUNC_START macro in gcc [1] and an equivalent
one can also be found in the LOCALENTRY macro in glibc [2].

On the ELFv2 ABI (see [1]):
 - The global entry point is expected to load up r2 with the appropriate TOC
   value for this function.
 - The local entry point expects r2 to be set up to the current TOC.

The problem happened with dynamically-linked binaries because:
 - the system call is an indirect call (via global entry point) from the binary
   to the shared library, landing in the syscall stub  (which didn't load up r2
   with the TOC of the shared library)
 - its branch to __syscall_error is a direct call (via local entry point) within
   the shared library, landing in the function (which expects r2 to be set up to
   that TOC)
 - when the function attempts to store errno (in an address relative to the TOC),
   that address incorrectly pointed to a read-only segment -- segmentation fault.

The problem didn't happen with statically-linked binaries because the TOC value
wasn't different on that case.

Thanks and credits to Alan Modra and Ulrich Weigand, for helping with this and
pointing out the solution.

[1] https://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html
[2] https://www.sourceware.org/ml/libc-alpha/2013-11/msg00315.html

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Gbp-Pq: Name ppc64el-load-toc-syscall-stub.patch

9 years agoFix minimal mv to work across fs
maximilian attems [Mon, 4 Jul 2011 15:51:52 +0000 (17:51 +0200)]
Fix minimal mv to work across fs

This is the use case in initramfs to keep data from /run to /root/run
before calling switch_root().

copy_file() doesn't yet catch EINTR, but that seems less of an issue
in initramfs.

copy_file() and much logic out of copy() is from Ulrich Dangel.
Thank you for the collaboration on this blocker for
http://bugs.debian.org/627808

While we are it require move to have mv at least 2 arguments passed.

Signed-off-by: Ulrich Dangel <uli@spamt.net>
Signed-off-by: maximilian attems <max@stro.at>
[bwh: This is no longer needed by initramfs-tools starting with version 0.121,
 so can be dropped after the stretch release]

Gbp-Pq: Name Fix-minimal-mv-to-work-across-fs

9 years agomultiarch-include-path
maximilian attems [Sun, 8 May 2016 20:59:37 +0000 (20:59 +0000)]
multiarch-include-path

Gbp-Pq: Name multiarch-include-path

9 years agoFix klibc Debian specific build trouble
Ben Hutchings [Sun, 14 Mar 2010 18:41:56 +0000 (18:41 +0000)]
Fix klibc Debian specific build trouble

Simply remove the headers_install invocation and rely on linux-libc-dev.

With these changes:

(the extra chmod was needed to allow for umask > 022) I could compile,
link and run this program:

#include <unistd.h>

int main(void)
{
write(1, "Hello world\n", 12);
return 0;
}

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[ added multi arch support ]
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: maximilian attems <max@stro.at>
[ fixed cross building ]
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Gbp-Pq: Name klibc-linux-libc-dev

9 years agoklibc (2.0.4-9) unstable; urgency=medium
Ben Hutchings [Sun, 8 May 2016 20:59:37 +0000 (20:59 +0000)]
klibc (2.0.4-9) unstable; urgency=medium

  * Change dh_fixperms arguments to restore binary reproducibility
  * initramfs-tools: Ensure busybox's hook runs before ours if it is
    going to be used in the initramfs (Closes: #823323)

[dgit import unpatched klibc 2.0.4-9]

9 years agoImport klibc_2.0.4-9.debian.tar.xz
Ben Hutchings [Sun, 8 May 2016 20:59:37 +0000 (20:59 +0000)]
Import klibc_2.0.4-9.debian.tar.xz

[dgit import tarball klibc 2.0.4-9 klibc_2.0.4-9.debian.tar.xz]

11 years agoMIPS: Update archfcntl.h
Ben Hutchings [Sun, 5 Oct 2014 00:08:21 +0000 (01:08 +0100)]
MIPS: Update archfcntl.h

Update usr/include/arch/mips/archfcntl.h from kernel headers:

- Add definitions of O_PATH, O_TMPFILE
- Update value of O_SYNC to include __O_SYNC
- Add definitions of F_{SET,GET}OWN_EX, F_GETOWNER_UIDS,
  F_OFD_{GETLK,SETLK,SETLKW}, F_OWNER_{TID,PID,PGRP}

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mips-update-archfcntl-h.patch

11 years agomount: Implement -o defaults
Ben Hutchings [Sat, 4 Oct 2014 15:32:39 +0000 (16:32 +0100)]
mount: Implement -o defaults

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name mount-implement-o-defaults.patch

11 years agoreadlink: Add -f option
Ben Hutchings [Sat, 27 Sep 2014 14:18:21 +0000 (15:18 +0100)]
readlink: Add -f option

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name readlink-add-f-option.patch

11 years agoImplement realpath()
Ben Hutchings [Sat, 27 Sep 2014 14:04:15 +0000 (15:04 +0100)]
Implement realpath()

This is needed as the basis for the readlink -f option.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Name implement-realpath.patch

11 years agoppc64: ELFv2: Load TOC value in system call stub
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
ppc64: ELFv2: Load TOC value in system call stub

This fixes a segmentation fault in the system call's error handling path with
dynamically-linked binaries on PowerPC64 little endian.  The system call stub
wasn't loading up r2 with the appropriate TOC value in its global entry point.

The r2 setup code comes from the FUNC_START macro in gcc [1] and an equivalent
one can also be found in the LOCALENTRY macro in glibc [2].

On the ELFv2 ABI (see [1]):
 - The global entry point is expected to load up r2 with the appropriate TOC
   value for this function.
 - The local entry point expects r2 to be set up to the current TOC.

The problem happened with dynamically-linked binaries because:
 - the system call is an indirect call (via global entry point) from the binary
   to the shared library, landing in the syscall stub  (which didn't load up r2
   with the TOC of the shared library)
 - its branch to __syscall_error is a direct call (via local entry point) within
   the shared library, landing in the function (which expects r2 to be set up to
   that TOC)
 - when the function attempts to store errno (in an address relative to the TOC),
   that address incorrectly pointed to a read-only segment -- segmentation fault.

The problem didn't happen with statically-linked binaries because the TOC value
wasn't different on that case.

Thanks and credits to Alan Modra and Ulrich Weigand, for helping with this and
pointing out the solution.

[1] https://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html
[2] https://www.sourceware.org/ml/libc-alpha/2013-11/msg00315.html

Signed-off-by: Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>
Gbp-Pq: Name ppc64el-load-toc-syscall-stub.patch

11 years agoFix minimal mv to work across fs
maximilian attems [Mon, 4 Jul 2011 15:51:52 +0000 (17:51 +0200)]
Fix minimal mv to work across fs

This is the use case in initramfs to keep data from /run to /root/run
before calling switch_root().

copy_file() doesn't yet catch EINTR, but that seems less of an issue
in initramfs.

copy_file() and much logic out of copy() is from Ulrich Dangel.
Thank you for the collaboration on this blocker for
http://bugs.debian.org/627808

While we are it require move to have mv at least 2 arguments passed.

Signed-off-by: Ulrich Dangel <uli@spamt.net>
Signed-off-by: maximilian attems <max@stro.at>
Gbp-Pq: Name Fix-minimal-mv-to-work-across-fs

11 years agomultiarch-include-path
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
multiarch-include-path

Gbp-Pq: Name multiarch-include-path

11 years agoinsmod
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
insmod

revert upstream nuked insmod.
utilized by d-i floppies, can be dropped once m-i-t
packages an insmod/modprobe compiled against klibc.

Gbp-Pq: Name insmod

11 years agoklibc-linux-libc-dev
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
klibc-linux-libc-dev

commit 43adf69062254fb4f8d4d11fb5fe36a60ae25d5a
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Sun Mar 14 18:41:56 2010 +0000

    Fix klibc Debian specific build trouble

    Simply remove the headers_install invocation and rely on linux-libc-dev.

    With these changes:

    (the extra chmod was needed to allow for umask > 022) I could compile,
    link and run this program:

    #include <unistd.h>

    int main(void)
    {
     write(1, "Hello world\n", 12);
     return 0;
    }

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    [ added multi arch support ]
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: maximilian attems <max@stro.at>
    [ fixed cross building ]
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Gbp-Pq: Name klibc-linux-libc-dev

11 years agoppc64-static
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
ppc64-static

Gbp-Pq: Name ppc64-static

11 years agoia64-static
maximilian attems [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
ia64-static

Gbp-Pq: Name ia64-static

11 years agoklibc (2.0.4-2) unstable; urgency=medium
Ben Hutchings [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
klibc (2.0.4-2) unstable; urgency=medium

  * debian/control: Add myself to Uploaders
  * [klibc] MIPS: Update archfcntl.h (fixes FTBFS)
  * Fix compiler warning in usr/klibc/realpath.c

[dgit import unpatched klibc 2.0.4-2]

11 years agoImport klibc_2.0.4-2.debian.tar.xz
Ben Hutchings [Sun, 5 Oct 2014 00:13:31 +0000 (00:13 +0000)]
Import klibc_2.0.4-2.debian.tar.xz

[dgit import tarball klibc 2.0.4-2 klibc_2.0.4-2.debian.tar.xz]

11 years agoImport klibc_2.0.4.orig.tar.gz
maximilian attems [Thu, 11 Sep 2014 19:23:25 +0000 (20:23 +0100)]
Import klibc_2.0.4.orig.tar.gz

[dgit import orig klibc_2.0.4.orig.tar.gz]

11 years agoImport klibc_2.0.4.orig.tar.gz
maximilian attems [Thu, 11 Sep 2014 19:23:25 +0000 (19:23 +0000)]
Import klibc_2.0.4.orig.tar.gz

[dgit import orig klibc_2.0.4.orig.tar.gz]