From d46e39e6ef33d0348aede5c00bca7d4e19001694 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 6 Jan 2019 19:33:01 +0000 Subject: [PATCH 1/1] Import klibc_2.0.4-15.debian.tar.xz [dgit import tarball klibc 2.0.4-15 klibc_2.0.4-15.debian.tar.xz] --- changelog | 1425 +++++++++++++++++ compat | 1 + control | 44 + copyright | 56 + initramfs-tools/hooks/klibc-utils | 38 + klibc-utils.install | 2 + klibc-utils.lintian-overrides | 2 + klibc-utils.postinst | 20 + libklibc-dev.install | 3 + libklibc-dev.lintian-overrides | 7 + libklibc-dev.manpages | 1 + libklibc-dev.preinst | 11 + libklibc.docs | 4 + libklibc.install | 1 + libklibc.lintian-overrides | 2 + patches/0001-add-mips64-support-headers.patch | 171 ++ .../0002-add-mips64-support-arch-mips32.patch | 71 + ...-mips64-support-arch-mips64-specific.patch | 124 ++ .../Implement-classless-static-routes.patch | 399 +++++ patches/add-reboot-argument-support.patch | 101 ++ patches/add-riscv-rv64-port.patch | 315 ++++ patches/broadcast_dhcp_send.patch | 39 + ...ash-mkbuiltins-fix-sort-order-harder.patch | 21 + patches/dhcp-one-socket-per-interface.patch | 273 ++++ patches/disable-pie.patch | 22 + ...fix-silent-fallback-to-decompression.patch | 85 + ...t-segment-to-avoid-address-collision.patch | 28 + patches/ia64-build-static-tools.patch | 91 ++ ...install-headers-with-consistent-mode.patch | 22 + ...4-handle-fallback-from-accept-to-acc.patch | 101 ++ ...te-32bit-syscall-wrappers-for-parisc.patch | 117 ++ ...emove-special-handling-of-socketcall.patch | 158 ++ patches/klibc-linux-libc-dev | 46 + ...on-t-save-and-restore-floating-point.patch | 55 + patches/klibc-ppc64-fix-struct-stat.patch | 30 + patches/mips-update-archfcntl-h.patch | 65 + .../mips64-compile-with-mno-abicalls.patch | 48 + patches/mount-implement-o-defaults.patch | 29 + .../mount_main-Fix-empty-string-check.patch | 49 + patches/multiarch-include-path | 40 + ...lean-files-in-quilt-status-directory.patch | 31 + patches/ppc64el-load-toc-syscall-stub.patch | 57 + ...ame-renameat-use-rename2-system-call.patch | 59 + ...ward-compatibility-for-resume_offset.patch | 127 ++ ...resume-write-resume_offset-parameter.patch | 87 + patches/run-init-add-dry-run-mode.patch | 193 +++ patches/series | 34 + patches/sparc-pie.patch | 231 +++ ...reduce-ld-max-page-size-option-again.patch | 50 + ...t-segment-to-avoid-address-collision.patch | 28 + rules | 91 ++ source/format | 1 + watch | 2 + 53 files changed, 5108 insertions(+) create mode 100644 changelog create mode 100644 compat create mode 100644 control create mode 100644 copyright create mode 100755 initramfs-tools/hooks/klibc-utils create mode 100644 klibc-utils.install create mode 100644 klibc-utils.lintian-overrides create mode 100644 klibc-utils.postinst create mode 100644 libklibc-dev.install create mode 100644 libklibc-dev.lintian-overrides create mode 100644 libklibc-dev.manpages create mode 100644 libklibc-dev.preinst create mode 100644 libklibc.docs create mode 100644 libklibc.install create mode 100644 libklibc.lintian-overrides create mode 100644 patches/0001-add-mips64-support-headers.patch create mode 100644 patches/0002-add-mips64-support-arch-mips32.patch create mode 100644 patches/0003-add-mips64-support-arch-mips64-specific.patch create mode 100644 patches/Implement-classless-static-routes.patch create mode 100644 patches/add-reboot-argument-support.patch create mode 100644 patches/add-riscv-rv64-port.patch create mode 100644 patches/broadcast_dhcp_send.patch create mode 100644 patches/dash-mkbuiltins-fix-sort-order-harder.patch create mode 100644 patches/dhcp-one-socket-per-interface.patch create mode 100644 patches/disable-pie.patch create mode 100644 patches/gzip-fix-silent-fallback-to-decompression.patch create mode 100644 patches/i386-use-ttext-segment-to-avoid-address-collision.patch create mode 100644 patches/ia64-build-static-tools.patch create mode 100644 patches/install-headers-with-consistent-mode.patch create mode 100644 patches/klibc-add-accept4-handle-fallback-from-accept-to-acc.patch create mode 100644 patches/klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch create mode 100644 patches/klibc-i386-remove-special-handling-of-socketcall.patch create mode 100644 patches/klibc-linux-libc-dev create mode 100644 patches/klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch create mode 100644 patches/klibc-ppc64-fix-struct-stat.patch create mode 100644 patches/mips-update-archfcntl-h.patch create mode 100644 patches/mips64-compile-with-mno-abicalls.patch create mode 100644 patches/mount-implement-o-defaults.patch create mode 100644 patches/mount_main-Fix-empty-string-check.patch create mode 100644 patches/multiarch-include-path create mode 100644 patches/never-clean-files-in-quilt-status-directory.patch create mode 100644 patches/ppc64el-load-toc-syscall-stub.patch create mode 100644 patches/rename-renameat-use-rename2-system-call.patch create mode 100644 patches/resume-backward-compatibility-for-resume_offset.patch create mode 100644 patches/resume-write-resume_offset-parameter.patch create mode 100644 patches/run-init-add-dry-run-mode.patch create mode 100644 patches/series create mode 100644 patches/sparc-pie.patch create mode 100644 patches/x86_64-reduce-ld-max-page-size-option-again.patch create mode 100644 patches/x86_64-use-ttext-segment-to-avoid-address-collision.patch create mode 100755 rules create mode 100644 source/format create mode 100644 watch diff --git a/changelog b/changelog new file mode 100644 index 0000000..284a54d --- /dev/null +++ b/changelog @@ -0,0 +1,1425 @@ +klibc (2.0.4-15) unstable; urgency=medium + + * resume: Write resume_offset attribute + * resume: Backward compatibility for resume_offset + * x86_64: Use -Ttext-segment to avoid address collision + * i386: Use -Ttext-segment to avoid address collision + * Disable PIE, since we link all executables as non-relocatable + (Closes: #907404) + + -- Ben Hutchings Sun, 06 Jan 2019 19:33:01 +0000 + +klibc (2.0.4-14) unstable; urgency=medium + + [ James Clarke ] + * [klibc] Fix sparc assembly when compiled as PIC (Closes: #885852) + + -- Ben Hutchings Thu, 19 Jul 2018 01:13:54 +0100 + +klibc (2.0.4-13) unstable; urgency=medium + + * [klibc] rename, renameat: Use renameat2() system call + * [klibc] Add RISC-V (RV64) port + * debian/rules: Add architecture mapping for riscv64 + * debian/control: Drop obsolete build-dependency on bison + * debian/control: Restrict build-dependency on m4 to sparc, sparc64 + * debian/patches: Add Forwarded fields as appropriate + * debian/rules: Add architecture mapping for sparc64 + + -- Ben Hutchings Wed, 18 Jul 2018 00:27:22 +0100 + +klibc (2.0.4-12) unstable; urgency=medium + + [ Ben Hutchings ] + * debian/control: Point Vcs URLs to Salsa + * debian/klibc-utils.postinst: Remove diversion of initramfs-tools hook + script (Closes: #886939) + * [klibc] mips64: compile with -mno-abicalls, thanks to James Cowgill + (Closes: #891924) + * reboot: Add support for reboot syscall argument, thanks to Alfonso + Sanchez-Beato (Closes: #863761, LP: #1692494) + * [klibc] x86_64: Reduce ld max-page-size option again (Closes: #903849) + * Never clean files in quilt status directory + + [ Frank Scheiner ] + * [klibc] ia64: Build static tools (again) + + [ Benjamin Drung ] + * ipconfig: Implement classless static routes (Closes: #884716, LP: #1526956) + * mount_main: Fix empty string check + + -- Ben Hutchings Sun, 15 Jul 2018 22:22:07 +0100 + +klibc (2.0.4-11) unstable; urgency=medium + + * Apply i386 syscall changes from upstream (fixes FTBFS): + - [klibc] i386: remove special handling of socketcall + - [klibc] Add accept4(), handle fallback from accept() to accept4() + + -- Ben Hutchings Sat, 30 Dec 2017 22:09:36 +0000 + +klibc (2.0.4-10) unstable; urgency=medium + + [ Steve Langasek ] + * debian/patches/broadcast_dhcp_send.patch: Set broadcast when sending + DHCPREQUEST and DHCPDISCOVER. Thanks to Mathieu Trudel-Lapierre + . Closes: #733988, LP: + #1327412. + * debian/patches/dhcp-one-socket-per-interface.patch: Use separate + sockets for DHCP from multiple interfaces. Thanks to Jay Vosburgh + . Closes: #852480, LP: #1652348. + + [ Ben Hutchings ] + * Drop patches no longer required after stretch release: + - "Fix minimal mv to work across fs" + - "Implement realpath()" and "readlink: Add -f option" + - "syscalls: Override detection of direct socket syscalls on i386, m68k, + s390" + * Replace diversion of initramfs-tools' klibc hook script with versioned + Breaks + * debian/control: Bump Standards-Version to 4.1.2; no changes required + * debian/rules: Use /usr/share/dpkg/architecture.mk + * Use debhelper compatibility level 9 + + -- Ben Hutchings Fri, 29 Dec 2017 00:58:39 +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) + + -- Ben Hutchings Sun, 08 May 2016 21:59:37 +0100 + +klibc (2.0.4-8) unstable; urgency=medium + + * run-init: Update documentation comment to cover -n option + * Add initramfs-tools hook script, in preparation for dropping it from + the initramfs-tools-core package + + -- Ben Hutchings Wed, 10 Feb 2016 23:33:55 +0000 + +klibc (2.0.4-7) unstable; urgency=medium + + * Drop "revert upstream nuked insmod", as nothing needs it any more + * Drop "Use static tools on IA64", as this architecture is dead + * Drop "Use static tools on ppc64", as shared builds appear to work now + * run-init: Add dry-run mode + + -- Ben Hutchings Mon, 18 Jan 2016 17:02:18 +0000 + +klibc (2.0.4-6) unstable; urgency=medium + + * Revert "syscalls: Use direct socket syscalls on i386" (Closes: #809927) + * syscalls: Override detection of direct socket syscalls on i386, m68k, s390 + + -- Ben Hutchings Tue, 05 Jan 2016 21:18:07 +0000 + +klibc (2.0.4-5) unstable; urgency=medium + + * syscalls: Use direct socket syscalls on i386 (Closes: 809423). + This requires Linux 4.3. + + -- Ben Hutchings Mon, 04 Jan 2016 19:14:50 +0000 + +klibc (2.0.4-4) unstable; urgency=medium + + * Fix another issue that prevents a reproducible build: + - Use dh_lintian-overrides instead of direct installation + + -- Ben Hutchings Sat, 19 Sep 2015 11:23:44 +0200 + +klibc (2.0.4-3) unstable; urgency=medium + + * Fix issues that prevent a reproducible build: + - Install headers with consistent mode + - dash: mkbuiltins: Fix sort order harder + * debian/watch: Look for xz-compressed tarballs (Closes: #778299) + and use HTTP-S + * Remove udebs as they are no longer used (see #653840) + * [klibc] Add pread and pwrite 32bit syscall wrappers for parisc + (Closes: #745660) + * [klibc] ppc64: fix struct stat (Closes: #783292) + * debian/control: Add Build-Conflicts: ccache (Closes: #777217) + * gzip: Fix silent fallback to decompression (Closes: #355809) + * [klibc] mips/setjmp.S: don't save and restore floating-point registers + (Closes: #789683) + * debian/rules: Fix mips* architecture mapping (fixes FTBFS on mips, mipsel) + * debian/control: Change Vcs-Git, Vcs-Browser and Homepage to canonical + HTTP-S URLs + * debian/control: Bump Standards-Version to 3.9.6; no changes required + + -- Ben Hutchings Fri, 18 Sep 2015 23:39:49 +0200 + +klibc (2.0.4-2.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add mips64 support. (Closes: #741241) + + -- YunQiang Su Thu, 27 Aug 2015 21:17:00 +0800 + +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 + + -- Ben Hutchings Sun, 05 Oct 2014 01:13:31 +0100 + +klibc (2.0.4-1.2) unstable; urgency=medium + + * Non-maintainer upload + * Implement features needed for mounting /usr in initramfs (Closes: #763049): + - Implement realpath() + - readlink: Add -f option + - mount: Implement -o defaults + * debian/rules: Fix clean when userland and kernel architecture differ + + -- Ben Hutchings Sat, 04 Oct 2014 17:01:24 +0100 + +klibc (2.0.4-1.1) unstable; urgency=medium + + [ Aurelien Jarno ] + * Non-maintainer upload. + + [ Mauricio Faria de Oliveira ] + * Add ppc64el-load-toc-syscall-stub.patch: fix segfault on dynamically-linked + binaries on ppc64el. (Closes: #749060) + + -- Aurelien Jarno Wed, 17 Sep 2014 13:47:02 +0200 + +klibc (2.0.4-1) unstable; urgency=medium + + * New upstream release (x86, readlink) (closes: #760587) + + -- maximilian attems Thu, 11 Sep 2014 21:23:25 +0200 + +klibc (2.0.3-1) unstable; urgency=medium + + * New upstream release (arm64, ppc64) (closes: #698018, #744884) + Thanks to Steve Capper + and Anton Blanchard . + * Pump standard version to 3.9.5 without changes. + + -- maximilian attems Mon, 21 Apr 2014 10:52:22 -0700 + +klibc (2.0.2-1) unstable; urgency=low + + * New upstream release (dash, arm) + - drop merged patches + - build fixes for Linux > 3.4 (closes: #702068) + + -- maximilian attems Mon, 19 Aug 2013 22:59:22 +0200 + +klibc (2.0.1-3) unstable; urgency=medium + + [ Bill Pringlemeir ] + * [f05ff11] [klibc] fix ARM longjmp with zero 'val'. + + -- maximilian attems Mon, 08 Oct 2012 21:57:01 +0200 + +klibc (2.0.1-2) unstable; urgency=low + + [ Sven Joachim ] + * [08c03cf] klibc: produces 64-bit binaries on i386 with x86_64 kernel + (Closes: #677087) + + [ Thorsten Glaser ] + * [d8eae3a] [klibc] arm: fix trashing of callee-saved registers in thumb + setjmp() (Closes: #634890) + * [81170b5] [klibc] arm: unbreak armhf shared binaries (those with thumb) + * [aeb7847] armhf builds are always thumb + + [ Jim Meyering ] + * [9ba90cd] [klibc] Avoid overflow for very long variable name + + -- maximilian attems Mon, 01 Oct 2012 15:54:05 +0200 + +klibc (2.0.1-1) unstable; urgency=high + + * New upstream release (nfsmount, get{host,domain}name()) + * debian/watch: fix file for new repo layout. + + -- maximilian attems Thu, 28 Jun 2012 18:29:48 +0200 + +klibc (2.0-2) unstable; urgency=low + + * debian/control: Add breaks to initramfs-tools for ipconfig /run switch. + + -- maximilian attems Thu, 31 May 2012 15:42:03 +0200 + +klibc (2.0-1) unstable; urgency=low + + * New upstream release (arch, ipconfig) + - ipconfig support domain-search, lease (closes: #627166) + + -- maximilian attems Thu, 31 May 2012 15:05:55 +0200 + +klibc (2.0~rc5-1) unstable; urgency=low + + * New upstream snapshot (arch fixes) (closes: #673413) + + -- maximilian attems Fri, 18 May 2012 18:16:51 +0200 + +klibc (2.0~rc4-1) unstable; urgency=low + + * New upstream snapshot (stdio work) + - drop merged m68k-support + * armel: Set arm arch for cross compiling. + * klibc-linux-libc-dev: Adapt for cross building (closes: #666389) + Based on Marcin Juszkiewicz + + -- maximilian attems Fri, 18 May 2012 14:48:04 +0200 + +klibc (2.0~rc3-1) unstable; urgency=low + + * New upstream snapshot (closes: #653790) + - klibc/s390x klcc fix thanks to Aurelien Jarno . + * Pump standard version to 3.9.3 without changes. + + -- maximilian attems Fri, 02 Mar 2012 11:08:51 +0100 + +klibc (2.0~rc2-0.1) unstable; urgency=low + + * Non-maintainer upload with consent of maintainer. + * Upload to unstable (maks says we target 2.0 for wheezy) + * New upstream snapshot (fixes FTBFS) + * Update Vcs-* for (temporary) move to collab-maint + * Refresh all patches + * Add m68k patch submitted upstream, for testing (Closes: #334917) + * Shut up lintian + + -- Thorsten Glaser Sat, 11 Feb 2012 19:25:23 +0000 + +klibc (1.5.25-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix build to work with multiarched linux-libc-dev (using patch from + Ubuntu), closes: #645738. + + -- Julien Cristau Fri, 30 Dec 2011 17:04:30 +0100 + +klibc (2.0~rc1-1experimental1) experimental; urgency=low + + * New upstream snapshot release (buffered stdio) + * Ubuntu sync fix klcc for multiarch. (closes: #639057, LP: #829356) + Thanks Colin Watson . + + -- maximilian attems Tue, 06 Sep 2011 17:57:54 +0200 + +klibc (1.5.25-1) unstable; urgency=low + + * New upstream release (scandir, capset, capget, kinit drop_capabilities) + + -- maximilian attems Tue, 23 Aug 2011 17:54:43 +0200 + +klibc (1.5.24-1) unstable; urgency=low + + * New upstream release (sched_setaffinity, sched_getaffinity, kexec_load) + - ipconfig: Don't try to guess the nameserver. (closes: #594638) + - refresh debian/patches/klibc-linux-libc-dev + + -- maximilian attems Wed, 27 Jul 2011 16:54:47 +0200 + +klibc (1.5.23-2) unstable; urgency=low + + * Really apply Fix-minimal-mv-to-work-across-fs. + + -- maximilian attems Fri, 08 Jul 2011 01:09:48 +0200 + +klibc (1.5.23-1) unstable; urgency=low + + * New upstream release (arm, dash sync, limits.h, ppc64) + - minimal mv in klibc-utils. + - refresh debian/patches/insmod + * Add Fix-minimal-mv-to-work-across-fs.patch (closes: #627808) + * Add armhf support. (closes: #627252) + Thanks to Konstantinos Margaritis . + * Add klibc crosscompile support. (closes: #629934) + Thanks to Steve McIntyre . + * debian/copyright: Add specific BSD license text to keep lintian happy. + + -- maximilian attems Tue, 14 Jun 2011 17:32:53 +0200 + +klibc (1.5.22-1) unstable; urgency=high + + * New upstream release (arm, ipconfig) + - arm: fix build failure with latest binutils. (closes: #618616) + - arm: use bx on thumb2 (v3) (LP: #527720) + - ipconfig: handle multiple connected network dev. (closes: #621065) + * Ubuntu sync add ppc64-static. (closes: #613955) + Thanks Colin Watson . + * Ubuntu sync add klcc multiarch-include-path. (closes: #622814) + Thanks Steve Langasek + * Pump standard version to 3.9.2 without changes. + * Drop Jeff Bailey from Uploaders. + + -- maximilian attems Wed, 18 May 2011 13:39:01 +0200 + +klibc (1.5.21-1) unstable; urgency=low + + * New upstream release (i386 signal(), make 3.82, cleanups) + + -- maximilian attems Tue, 25 Jan 2011 23:45:20 +0100 + +klibc (1.5.20-1) unstable; urgency=high + + * New upstream release + - ipconfig: fix infinite loop. (closes: #552554) + - ipconfig: fix multiple dns domains. (closes: #594208) + * klibc-utils.postinst: Nuke non empty dirs too. (closes: #594651) + + -- maximilian attems Sat, 28 Aug 2010 12:23:51 +0200 + +klibc (1.5.19-1) unstable; urgency=high + + * New upstream release + - resume: silence warning on resume try. (closes: #586006) + - sh4: syscalls fixes. (closes: #578076) + * Fix doc symlinks on upgrade. (closes: #588763) + Thanks Sven Joachim . + * Pump standard version to 3.9.1 without changes. + + -- maximilian attems Wed, 25 Aug 2010 13:07:03 +0200 + +klibc (1.5.18-1) unstable; urgency=medium + + * New upstream release (dash 0.5.6) + - fstype btrfs (closes: #548047), ext4 !journal (closes: #536592) + - sh4 build fix (closes: #574834) + - shipp renamed README.ipconfig (closes: #478589) + + -- maximilian attems Thu, 22 Apr 2010 03:38:55 +0200 + +klibc (1.5.17-4) unstable; urgency=medium + + * libklibc-dev: On preinst remove old include dirs that hinder + shipped symlinks to linux-libc-dev. (closes: #574854) + + -- maximilian attems Sun, 21 Mar 2010 22:51:11 +0100 + +klibc (1.5.17-3) unstable; urgency=low + + * Override dh_auto_test to pass DEB_HOST_ARCH on make test. (closes: #574746) + + -- maximilian attems Sat, 20 Mar 2010 20:52:09 +0100 + +klibc (1.5.17-2) unstable; urgency=low + + * Set DEB_HOST_ARCH using dpkg-architecture. (closes: #574740) + + -- maximilian attems Sat, 20 Mar 2010 18:24:16 +0100 + +klibc (1.5.17-1) unstable; urgency=low + + [ Jan Hauke Rahm ] + * Switch from cdbs to debhelper 7 + * Switch to Source Format 3.0 (quilt) (closes: #573908) + * Make documentation of klibc-utils and libklibc-dev be a symlink to + libklibc + + [ maximilian attems ] + * New upstream release + - Fix FTFBS i386/sparc. (closes: #573926) + - sparc, sparc64 use sys_socketcall unconditionally. (closes: #444087) + - ipconfig may discard useful packets. (closes: #511959) + + -- maximilian attems Sat, 20 Mar 2010 02:11:20 +0100 + +klibc (1.5.16-1) unstable; urgency=low + + [ maximilian attems ] + * New upstream release + - ipconfig: raise field length for rootpath DHCP option. + (closes: #497800) + - ipconfig: send requested hostname in DHCP discover/request. + (closes: #367301) + - ipconfig: set null ciaddr on DHCPREQUEST during SELECTING state. + (closes: #497879) + - mount: list fs all mounted fs, support -t switch for one fs. + (closes: #491067) + - refresh 10_insmod.patch. + - readlink be silent on failure. (closes: #565224) + - fix compilation against up to 2.6.33 linux-libc-dev. (closes: #552825) + * watch file fixup for new upstream directories. + * Pump standard version to 3.8.4 without changes. + * Add lintian overrides for embedded-zlib needed for early userspace. + + [ Nobuhiro Iwamatsu ] + * klibc: add support Renesas SH(sh4) (closes: #540126) + + [ Ben Hutchings ] + * Fix klibc Debian specific build with 02-klibc_linux_libc_dev.patch. + * Add libklibc-dev depends on linux-libc-dev. + + -- maximilian attems Sun, 14 Mar 2010 22:46:21 +0100 + +klibc (1.5.15-1) unstable; urgency=low + + [ maximilian attems ] + * New upstream release: + - fstype ext4 support. (closes: #510758) + - chroot cmd fixed. (closes: #494829) + * Pump standard version to 3.8.0 without changes. + * Drop arm of the klibc-utils-floppy-udeb arch list. + * Fix debhelper-but-no-misc-depends. + * debian/copyright refer to GPL v2. + * debian/rules nuke old commented unused lines. + + [ Colin Watson ] + * Add lpia to the architecture list for klibc-utils-floppy-udeb. + (closes: #506427) + + [ Thiemo Seufer ] + * Fix FTBFS on MIPS64 kernel. (closes: #496175) + + -- maximilian attems Mon, 16 Feb 2009 16:41:51 +0100 + +klibc (1.5.14-1~exp1) experimental; urgency=low + + * New upstream version + - nuke merged 11_klibc-Default-signal-3-to-bsd_signal-3.patch + - no longer hardcode gcc + + -- maximilian attems Mon, 11 Aug 2008 16:34:11 +0200 + +klibc (1.5.12-2) unstable; urgency=medium + + * Add backport 11_klibc-Default-signal-3-to-bsd_signal-3.patch. + * Adjust watch file. + + -- maximilian attems Mon, 11 Aug 2008 16:09:45 +0200 + +klibc (1.5.12-1) unstable; urgency=low + + * New upstream release (memmove, fflush, cpio) (closes: #489945) + + -- maximilian attems Sat, 12 Jul 2008 21:48:56 +0200 + +klibc (1.5.11-3) unstable; urgency=high + + * libklibc-dev depend on gcc-4.1. (closes: #489103) + + -- maximilian attems Thu, 03 Jul 2008 19:33:56 +0200 + +klibc (1.5.11-2) unstable; urgency=high + + * gcc-4.1 build dep. + + -- maximilian attems Fri, 27 Jun 2008 01:40:39 +0200 + +klibc (1.5.11-1) unstable; urgency=high + + * New upstream release (ext4, ipconfig, mount) + - drop merged 11-klibc-run-init-drop-executable-stack.patch, + 12-klibc-avoid-.gitignore-in-the-include-directory.patch + * Fallback to gcc-4.1 4.3 miscompiles. (closes: #486557) + + -- maximilian attems Fri, 27 Jun 2008 00:59:27 +0200 + +klibc (1.5.10-1) unstable; urgency=low + + * New upstream release (dmesg, nfsmount) + - dmesg: fix the stripping of priority codes (closes: #483186) + - ubuntu sync rework 11-klibc-run-init-drop-executable-stack.patch + - add git fix 12-klibc-avoid-.gitignore-in-the-include-directory.patch + + -- maximilian attems Fri, 27 Jun 2008 00:59:21 +0200 + +klibc (1.5.9-2) unstable; urgency=low + + * debian/control: Fix Description klibc-utils are not statically linked. + Thanks Anthony Towns for noticing. + * klibc-utils-floppy-udeb.install: Drop mkdir, mknod, sh due to full floppy. + Thanks Joey Hess . (closes: #474061) + + -- maximilian attems Wed, 09 Apr 2008 11:00:29 +0200 + +klibc (1.5.9-1) unstable; urgency=low + + * New upstream release (fstype jfs + nilfs2, ipconfig, nfsmount) + - Drop merged 02_header_clean_install.patch, 20_mount-options.patch + - mknod gained -m permission switch. (closes: #469577) + * debian/control: Add git Vcs fields. + + -- maximilian attems Fri, 28 Mar 2008 23:09:57 +0100 + +klibc (1.5.8-1) unstable; urgency=low + + * New upstream release (fstype squashfs-lzma, ipconfig) (closes: #455703) + * Ubuntu sync add 20_mount-options.patch for FUSE mount. (closes: #463258) + * Add 02_header_clean_install.patch. + * Drop unused 03-sparc-libgcc42.patch. + * Add 10_insmod.patch for d-i floppy usage. + * Fix copyright notice. + * Newer standard version without changes. + + -- maximilian attems Sat, 22 Mar 2008 14:09:56 +0100 + +klibc (1.5.7-4) unstable; urgency=high + + * debian/rules: Set verbose kbuild for toolchain troubles. Compile + 32 bit on ppc and 31 bit on s390. (closes: #453422, #453424) + + -- maximilian attems Fri, 7 Dec 2007 16:12:36 +0100 + +klibc (1.5.7-3) unstable; urgency=high + + * debian/rules: s/sparc64/sparc/ thanks to the Debian sparc folks. + (closes: #399724) + + -- maximilian attems Thu, 22 Nov 2007 18:50:55 +0100 + +klibc (1.5.7-2) unstable; urgency=high + + * Add 03-sparc-libgcc42.patch (closes: #440721) + Thanks for report and testing to Kilian Krause + + -- maximilian attems Thu, 22 Nov 2007 18:50:50 +0100 + +klibc (1.5.7-1) unstable; urgency=low + + * New upstream release + * Build-dep on s/flex/m4/. + + -- maximilian attems Tue, 04 Sep 2007 13:03:09 +0200 + +klibc (1.5.6-2) unstable; urgency=high + + * debian/rules: Pass for ia64 ARCH=ia64 on install target, enables static + workaround. (closes: #439548) + + -- maximilian attems Sat, 25 Aug 2007 17:39:35 +0200 + +klibc (1.5.6-1) unstable; urgency=low + + * New upstream release (mount, bzero) + * debian/rules: Disable verbose build. + + -- maximilian attems Sat, 25 Aug 2007 01:54:22 +0200 + +klibc (1.5.5-1) unstable; urgency=low + + * New upstream release (dash 0.5.4) + + -- maximilian attems Thu, 23 Aug 2007 18:15:24 +0200 + +klibc (1.5.4-1) unstable; urgency=low + + * New upstream release (dmesg, fstype ocfs2) + + -- maximilian attems Tue, 21 Aug 2007 12:31:27 +0200 + +klibc (1.5.3-1) unstable; urgency=low + + * New upstream (ext4 gfs2 reiser4 squashfs fstype, sync) (closes: #392073) + - Drop merged 09_mips-linux-libc-dev.patch, + 08_nfsmount-rpc_header_length.patch, 02-squashfs.diff. + - Drop dubious Debian unused 07_kinit_no_vfork.patch. + + -- maximilian attems Wed, 15 Aug 2007 21:32:06 +0200 + +klibc (1.5-4) unstable; urgency=low + + * Add 09_mips-linux-libc-dev.patch. (closes: 435113) + + -- maximilian attems Sat, 04 Aug 2007 23:24:10 +0200 + +klibc (1.5-3) unstable; urgency=low + + * Build-dep on linux-libc-dev - ubuntu sync + rules cleanup. (closes: 423998) + Thus drop 08-revert_nostdinc_iwithprefix_include.patch + * Switch to ${binary:Version} + * Add 08_nfsmount-rpc_header_length.patch. (closes: 428832) + Thanks Tomas Vanderka for patch. + * Add armel support. (closes: 430593) + Thanks Riku Voipio + + -- maximilian attems Sat, 28 Jul 2007 12:44:57 +0200 + +klibc (1.5-2) unstable; urgency=low + + * klibc-utils-floppy-udeb.install: sort + add cpio. + + -- maximilian attems Mon, 2 Apr 2007 23:25:38 +0200 + +klibc (1.5-1) unstable; urgency=low + + * New upstream (cpio, read -t, resume offset, support newer linux headers) + * Change Maintainers field + + -- maximilian attems Sat, 31 Mar 2007 17:09:59 +0200 + +klibc (1.4.34-1) unstable; urgency=low + + * New upstream release (pwd, FD_ZERO, __sum*) + - drop 09-qsort-infinite-loop.patch + + -- maximilian attems Wed, 7 Feb 2007 23:52:30 +0100 + +klibc (1.4.31-1) unstable; urgency=low + + * New minor upstream release (fstype endian fixes) + - drop merged 09-klibc-utils-add_swsusp_to_fstype.patch + - add out of current git 09-qsort-infinite-loop.patch + * Build against linux-headers-2.6.18-4. + Use one variable to set them in order to ease stable updates. + + -- maximilian attems Fri, 26 Jan 2007 20:29:07 +0100 + +klibc (1.4.30-3) unstable; urgency=high + + * Disable klibc-utils-floppy-udeb build on ia64 by explicitly listing + all other architectures. ia64 does not build shared binaries. + urgency high as fixes RC bugs in etch. + + -- maximilian attems Wed, 13 Dec 2006 10:04:40 +0100 + +klibc (1.4.30-2) unstable; urgency=low + + * Build against linux-headers-2.6.18-3. (closes: 398334) + * Add klibc-utils-add_swsusp_to_fstype.patch (closes: 398302) + thanks David Härdeman . + * Add klibc-utils-floppy-udeb on request by the d-i folks. + + -- maximilian attems Wed, 29 Nov 2006 11:39:52 +0100 + +klibc (1.4.30-1) unstable; urgency=low + + * New upstream release (ia64, vsscanf, signal, creat) + * Fix watch file, remove stray newline in changelog. Thanks Christoph Berg + for review. + + -- maximilian attems Fri, 3 Nov 2006 08:53:02 +0100 + +klibc (1.4.29-1) unstable; urgency=low + + * New upstream release (closes: 362442) + - fstype iso9660 detection thanks David Härdeman + - rediff 02-squashfs.diff + * Build against linux-headers-2.6.18-1. (closes: 392855) + + -- maximilian attems Sat, 14 Oct 2006 13:31:24 +0200 + +klibc (1.4.27-1) unstable; urgency=low + + * New upstream release (mips, sh, malloc, free, fnmatch, getopt_long) + - Corrects mips statfs (closes: 347827) + - Drop merged 08_nuke_no_error_return.patch + - Drop merged 05_ipconfig_d-i.patch (closes: 374982) + - Add build fix 08-revert_nostdinc_iwithprefix_include.patch. + + -- maximilian attems Fri, 25 Aug 2006 08:12:10 +0200 + +klibc (1.4.19-2) unstable; urgency=high + + * Add 08_nuke_no_error_return.patch - + urgency high to get into testing before udev. + * debian/control, debian/rules: Use newer linux-headers-2.6.17-2. + Thanks Michael Banck for noticing. + + -- maximilian attems Sat, 19 Aug 2006 10:45:18 +0200 + +klibc (1.4.19-1) unstable; urgency=low + + * New upstream release (kbuild, readlink, shm_open() + shm_unlink()) + - Drop merged 06_ppc_kbuild.patch, + keep 07_kinit_no_vfork.patch until vfork() is sorted on parisc. + - Build against linux-headers-2.6.17-1. + + -- maximilian attems Tue, 8 Aug 2006 09:17:32 +0200 + +klibc (1.4.11-3) unstable; urgency=low + + * Add 06_ppc_kbuild.patch, 07_kinit_no_vfork.patch. closes: 378953 + + -- maximilian attems Sun, 23 Jul 2006 22:10:17 +0200 + +klibc (1.4.11-2) unstable; urgency=low + + * Add the changelog of the 1.4.8-1.1. Ack NMU. (closes: #378426) + + -- maximilian attems Wed, 19 Jul 2006 10:26:41 +0200 + +klibc (1.4.11-1) experimental; urgency=low + + * New upstream release (kbuild, arm, s390, mknod, kill, resume) + - reworked 01-ia64-static.diff touches more dirs and reapplies + - 02-squashfs.diff reapplies + - Thanks Martin Michlmayr for arm segfault fix. + (closes: #378426) + + -- maximilian attems Mon, 17 Jul 2006 00:40:56 +0200 + +klibc (1.4.8-1.1) unstable; urgency=high + + * NMU with the permission of the maintainer. + * Fix segfault on ARM when compiling without EABI. (closes: #378426) + + -- Martin Michlmayr Mon, 17 Jul 2006 16:31:15 +0200 + +klibc (1.4.8-1) unstable; urgency=low + + * New upstream release (arch fixes) + + -- maximilian attems Mon, 3 Jul 2006 20:24:33 +0200 + +klibc (1.4.6-1) unstable; urgency=low + + * New upstream release (s390, i386) + - Drop merged 00-reboot-poweroff-install.patch and 03-mknod.patch. + + -- maximilian attems Sat, 1 Jul 2006 16:28:16 +0200 + +klibc (1.4.2-3) unstable; urgency=low + + * Add 05_ipconfig_d-i.patch to allow d-i dhcp file preseeding. + Thanks Geert Stappers . (closes: #374982) + + -- maximilian attems Thu, 22 Jun 2006 21:38:34 +0200 + +klibc (1.4.2-2) unstable; urgency=low + + * klibc-utils: Pick up the new puppys reboot/poweroff - added + 00-reboot-poweroff-install.patch. + + * Tweaked 01-ia64-static.diff + + -- maximilian attems Thu, 22 Jun 2006 08:44:42 +0200 + +klibc (1.4.2-1) unstable; urgency=low + + * New upstream release (arm, halt/reboot/poweroff) + + * Add from git upstream 03-mknod.patch. + + -- maximilian attems Thu, 22 Jun 2006 00:53:03 +0200 + +klibc (1.3.38-1) unstable; urgency=low + + * New upstream release (syscalls, sparc32) + - Drop 04-libgcc-dep.diff thanks to upstream fixes. + + -- maximilian attems Wed, 14 Jun 2006 19:10:22 +0200 + +klibc (1.3.35-1) unstable; urgency=low + + * New upstream release (No c++) + + * debian/control,debian/rules: Pump build-dep on newer linux-headers. + + -- maximilian attems Thu, 8 Jun 2006 23:32:52 +0200 + +klibc (1.3.34-1) unstable; urgency=low + + * New upstream release (kinit, s390, dash) + - Rework 01-ia64-static.diff + upload to unstable to fix sparc32 + * Drop debian/config, no need for gzip atm. + + -- maximilian attems Thu, 8 Jun 2006 12:12:43 +0200 + +klibc (1.3.27-2) experimental; urgency=low + + * debian/rules: Don't override DEB_ARCH on sparc. Thanks to Jurij Smakov + for testing sparc32 and sparc64 32-bit build and boot. + + -- maximilian attems Tue, 6 Jun 2006 11:28:34 +0200 + +klibc (1.3.27-1) experimental; urgency=low + + * New upstream release + (kernel CodingStyle, kinit, arm+alpha+m68k+sparc32+sparc64 fixes) + - Drop hopefully fixed 05-sparc64_statfs.patch. + - Drop merged 06-s390-syscall-declare-err.patch. + - Rework 02-squashfs.diff. + - Remove zlib1g-dev Build-Dep, include dir for zlib.h got fixed. + - dd: handle trunc/notrunc correctly (closes: #367387) + Upload to experimental to give aboves porters chance to check changes. + + * debian/rules: Use mrproper on clean run to get rid of generated .config. + + * debian/config: Build with CONFIG_KLIB_ZIP, gzip does zip not only unzip. + (closes: #355809) + + -- maximilian attems Tue, 6 Jun 2006 00:34:13 +0200 + +klibc (1.3.19-5) experimental; urgency=low + + Thanks to Jeff Bailey for eagle eyes: + + * debian/rules: On clean use proper make clean target. + + * debian/control: Fix dep for klibc-utils-udeb. + + -- maximilian attems Tue, 9 May 2006 21:11:48 +0200 + +klibc (1.3.19-4) experimental; urgency=low + + * Mentors eats udeb, retry upload. + + -- maximilian attems Mon, 8 May 2006 21:12:03 +0200 + +klibc (1.3.19-3) experimental; urgency=low + + * Add klibc-utils and libklibc udeb targets on request of the nice d-i folks. + + * Pump standard version to 3.7.2 without changes. + + -- maximilian attems Mon, 8 May 2006 19:27:15 +0200 + +klibc (1.3.19-2) unstable; urgency=medium + + * Add 06-s390-syscall-declare-err.patch (closes: 366385) + + -- maximilian attems Mon, 8 May 2006 11:21:05 +0200 + +klibc (1.3.19-1) unstable; urgency=medium + + * New upstream release (m68k build fixes, dash cleanup) + - Drop 06-clz-builtins-return.patch + + * Set urgency to medium to get newer klibc into testing. + + -- maximilian attems Mon, 8 May 2006 09:29:52 +0200 + +klibc (1.3.16-2) unstable; urgency=low + + * Add new missing build-dep zlib1g-dev. + + -- maximilian attems Fri, 5 May 2006 15:15:03 +0200 + +klibc (1.3.16-1) unstable; urgency=low + + * New upstream release (m68k + mips work, tree reorganisation, zlib copy) + - Drop merged 06-fix-arch-without-ppoll.patch + - Rework 01-ia64-static.diff, 05-sparc64_statfs.patch + - Add git patch 06-clz-builtins-return.patch + + * Pump standard version to 3.7.1.0 without changes. + + -- maximilian attems Fri, 5 May 2006 00:20:45 +0200 + +klibc (1.3.11-2) unstable; urgency=medium + + * Add gone missing bit 06-fix-arch-without-ppoll.patch. + + * Urgency medium to get that latest with all fixes into Testing. + + -- maximilian attems Mon, 1 May 2006 02:17:32 +0200 + +klibc (1.3.11-1) unstable; urgency=low + + * New upstream release (m68k port, kinit) + - Drop no longer needed m68k-syscall.patch + - Drop merged ia64-syscall.patch + + * Rename 05-sparc64_statfs.patch for consistent patch numbering. + + -- maximilian attems Sat, 29 Apr 2006 20:16:48 +0200 + +klibc (1.3.7-2) unstable; urgency=low + + * Add ia64-syscall.patch, thanks to Jeff Bailey + + * Readd sparc64_statfs.patch, not fixed by proposed sparc_v9 upstream fix. + + -- maximilian attems Sat, 22 Apr 2006 18:41:52 +0200 + +klibc (1.3.7-1) unstable; urgency=low + + * New upstream release (Kbuild, dash, ..): + - Drop merged fstype-lvm2-ext3.patch, alpha-syscall.patch. + - Drop upstream reworked 03-sparc-fix-paths.diff. + - Rework 02-squashfs.diff. + - Rework 01-ia64-static.diff to apply cleanly too. + + -- maximilian attems Sat, 22 Apr 2006 13:39:57 +0200 + +klibc (1.3.3-4) unstable; urgency=low + + * Add alpha-syscall.patch, use the available rt syscalls. (closes: 361910) + Thanks Falk Hueffner and Norbert Tretkowski + for testing the fix. + + -- maximilian attems Tue, 18 Apr 2006 23:08:08 +0200 + +klibc (1.3.3-3) unstable; urgency=low + + * Add fstype-lvm2-ext3.patch thanks David Härdeman + for the fix. (closes: 362631) + + -- maximilian attems Mon, 17 Apr 2006 21:29:53 +0200 + +klibc (1.3.3-1) unstable; urgency=low + + * New upstream release (kinit, run-init) + - Drop merged s390-syscall.patch, statfs-sparc64-mips.patch + (the mips part didn't help, stat() needs more work there). + - Drop upstream nacked gcc-nohardcode.patch, sparc works fine with gcc-4.0. + - Drop arm-build-fix.patch, fixed by coreutils 5.93. + Thanks to Martin Michlmayr for fixing that issue. + + * debian/rules: Fix ppc build with linux-headers-2.6.16-1 - + thanks a lot to Roger Leigh . + + -- maximilian attems Thu, 6 Apr 2006 17:59:34 +0200 + +klibc (1.3.1-1) unstable; urgency=low + + * New upstream release + (kinit, lvm2 fstype, minix detection fix, zlib 1.2.3, whitespace cleanup) + - Rework 02-squashfs.diff. + + -- maximilian attems Tue, 4 Apr 2006 01:37:04 +0200 + +klibc (1.2.6-1) unstable; urgency=low + + * New upstream release + + * Pump build-dep on linux-headers-2.6.16-1. + + * Rework statfs-sparc64.patch into statfs-sparc64-mips.patch + + * Rework 01-ia64-static.diff build dash, fstype, ipconfig and run-init + static too. (closes: #357414) + + -- maximilian attems Wed, 22 Mar 2006 09:54:38 +0100 + +klibc (1.2.4-1) unstable; urgency=low + + * New upstream release + drop merged patches: include-cleanup.patch, mips-pipe.patch. + drop unneeded klibc-sparc64-def-pagesize.patch. + + * debian/watch: Add watch upstream. + + * s390-syscall.patch: Fix wrapper to return positive errno values. + Thanks Bastian Blank (closes: #355548) + + -- maximilian attems Thu, 9 Mar 2006 01:05:25 +0100 + +klibc (1.2.2-3) unstable; urgency=medium + + * Upload with medium urgency to fix sparc ftbfs. + + * Add include-cleanup.patch which removes useless includes. + + -- maximilian attems Fri, 17 Feb 2006 22:02:28 +0100 + +klibc (1.2.2-2) unstable; urgency=high + + * Upload with high urgency as this fixes sparc boots. + (Closes: #347902) + + * Add sparc64_statfs.patch thanks to Sjoerd Simons . + + * Add git upstream mips-pipe.patch. + + -- maximilian attems Thu, 16 Feb 2006 18:40:37 +0100 + +klibc (1.2.2-1) unstable; urgency=low + + * New upstream release (kinit work, LUKS and swap detection) + - reworked 02-squashfs.diff + + * Merge 1.1.16-1ubuntu3 (thanks Jeff Bailey ): + - Do not override the compiler for sparc anymore. + - Link in libc.a after libgcc.a as well to resolve symbols: + 04-libgcc-dep.diff. + - /usr/lib/klibc/include contained symlinks to the real include + directories before. Remove the symlinks in the preinst to avoid + overwriting bits of linux-kernel-headers on upgrade. + + * We no longer need to pass CC to the make invocation. + + * Add m68k-syscall.patch thanks to Kyle McMartin . + Still needs setjmp/longjmp, crt0, and sysstub.ph to be usefull. + + * Change arch list to any to encourage m68k porting. + + -- maximilian attems Tue, 14 Feb 2006 09:54:36 +0100 + +klibc (1.2.1-3) unstable; urgency=high + + * Add gcc-nohardcode.patch to really build sparc with gcc-3.3. + Thanks to Jurij Smakov for spotting the trouble. + (Closes: #347902, #349857) + + * Set urgency high to get all the previous arch fixes into testing. + + * Ack old accidental NMU. (Closes: #336620) + + -- maximilian attems Tue, 31 Jan 2006 10:20:02 +0100 + +klibc (1.2.1-2) unstable; urgency=low + + * Add armeb to the arch list. + + * Add temporary buildfix for arm: arm-build-fix.patch. + + -- maximilian attems Tue, 31 Jan 2006 01:39:24 +0100 + +klibc (1.2.1-1) unstable; urgency=low + + * New upstream release (kinit work) + Drop merged patches: klibc-hppa-fix-atexit.patch, + klibc-hppa-set-sharedflags.patch, klibc-mipsel-build.patch, + klibc-mips-newline-warning.patch, klibc-mips-path-linker.patch, + + * Add ubuntu patch 03-sparc-fix-paths.diff. + + * Add ARCH overrides for armeb and mipsel, + thanks Martin Michlmayr . (closes: #350592) + + -- maximilian attems Tue, 31 Jan 2006 00:16:36 +0100 + +klibc (1.1.16-3) unstable; urgency=low + + * Add mipsel build fix, thanks Martin Michlmayr . + + * Add mips and mipsel to the build archs - shared libraries may still segv. + + -- maximilian attems Sat, 21 Jan 2006 10:10:16 +0100 + +klibc (1.1.16-2) unstable; urgency=low + + * Fixed powerpc build, working around the ARCH=ppc/ARCH=powerpc mess on + 32bit powerpc. Closes: #347551. + * Add myself to uploaders. + + -- Sven Luther Fri, 20 Jan 2006 15:33:41 +0000 + +klibc (1.1.16-1) unstable; urgency=low + + * New upstream version. + Drop merged patches: alpha-kbuild.patch, parisc-arch.patch. + + * Add new upstream patches for better hppa and mips support: + klibc-hppa-fix-atexit.patch, klibc-hppa-set-sharedflags.patch. + Thanks Kyle McMartin + klibc-mips-newline-warning.patch, klibc-mips-path-linker.patch. + Thanks Martin Michlmayr + + * Pass ARCH we are building on to the make call, + fixes build on ppc64 kernel. + + -- maximilian attems Mon, 9 Jan 2006 18:06:04 +0100 + +klibc (1.1.15-4) unstable; urgency=low + + "Soiree Tranquille Release" + + * Really add 01-ia64-static.diff, 02-squashfs.diff. + Thanks again Jeff Bailey for spotting. + + -- maximilian attems Thu, 5 Jan 2006 23:58:55 +0100 + +klibc (1.1.15-3) unstable; urgency=low + + * Add alpha-kbuild.patch fixes alpha kbuild rules. + + -- maximilian attems Thu, 5 Jan 2006 22:20:31 +0100 + +klibc (1.1.15-2) unstable; urgency=low + + * Revert sparc personality switch as buildds inbetween invoke with linux64. + Thanks Jeff Bailey for spotting. + + * Add klibc-sparc64-def-pagesize.patch, should define the chosen PAGE_SIZE. + + -- maximilian attems Thu, 5 Jan 2006 20:07:12 +0100 + +klibc (1.1.15-1) unstable; urgency=low + + * New upstream version. + Drop merged patches: klibc-1.1.14-fstype-segv-1.patch, + klibc-endian.h-dangerous.patch + + * Build against latest linux-headers-2.6.15-1. + + * Try fixing sparc by building with linux26 personality. + + * Add the following ubuntu patches: + - 01-ia64-static.diff (static klibc works on ia64). + - 02-squashfs.diff adds sqashfs support to fstype. + + -- maximilian attems Thu, 5 Jan 2006 17:22:03 +0100 + +klibc (1.1.14-2) unstable; urgency=low + + * Fix new hppa kbuild issue, add parisc-arch.patch. + Thanks Kyle McMartin . + + * Add klibc-1.1.14-fstype-segv-1.patch allowing previous interface to work. + + -- maximilian attems Wed, 4 Jan 2006 00:03:47 +0100 + +klibc (1.1.14-1) unstable; urgency=low + + * New upstream release (merged all of our patches). + Features: dash, kbuild and shiny new packaging by Jeff Bailey! + + * Add klibc-endian.h-dangerous.patch upstream build fix. + + * Don't forget about our linitian overrides. + Added unstripped-binary-or-object libklibc-dev override. + + -- maximilian attems Sat, 31 Dec 2005 00:24:42 +0100 + +klibc (1.1.8-0ubuntu1) dapper; urgency=low + + * New upstream release. + - Obseletes all preview patches. + + * Redo packaging. + - Upstream changed packaging. Redo all packaging to match. + + -- Jeff Bailey Wed, 21 Dec 2005 01:05:04 +0000 + +klibc (1.1.1-10) unstable; urgency=low + + * Correct the powerpc to ppc mapping. + + -- maximilian attems Wed, 28 Dec 2005 01:35:56 +0100 + +klibc (1.1.1-9) unstable; urgency=low + + * Redrop klibc-sparc64-signals.diff, the buildd now uses correct cflags. + Thanks to Jurij Smakov + * Map powerpc to ppc for 2.6.14 based builds, useless for later kernels. + * Pump dephelper dependency as pointed out by linda. + + -- maximilian attems Fri, 23 Dec 2005 20:41:13 +0100 + +klibc (1.1.1-8) unstable; urgency=low + + * Add hppa to the mapped archs, sparc was already there. (Closes: #344482) + + -- maximilian attems Fri, 23 Dec 2005 15:17:22 +0100 + +klibc (1.1.1-7) unstable; urgency=low + + * Now that we handle the asm arch symlink by owerself, take care on the $arch + mapping. + + -- maximilian attems Fri, 23 Dec 2005 14:39:49 +0100 + +klibc (1.1.1-6) unstable; urgency=low + + [ Steve Langasek ] + * Fix the definition of struct statfs64, required for run-init to work on + alpha. + (Closes: #342931) + + -- maximilian attems Mon, 19 Dec 2005 10:22:38 +0100 + +klibc (1.1.1-5) unstable; urgency=low + + [ Steve Langasek ] + * Grab the errno from the right register after syscalls on alpha! + + [ maximilian attems ] + * Add s390 to the current arch list. + + * Bump Build-Deps on newer linux-headers. + + * Sync with 1.1.1-4ubuntu7. + - Use the newer klibc-parisc.diff version, which got upstream. + Thanks a lot Kyle McMartin . + - Add lintian overrides for libklibc-dev. + + * Add kosmetic klibc-parisc-clean-crash.diff for newer toolchain. + Again thanks to Kyle McMartin . + + * linux-kernel-headers is lacking the asm symlink from include/asm-$arch. + Add it by ourself when builing against it. ATTENTION: breaks klibc + crosscompiles. Will be solved by stabilized upstream kbuild tree. + + -- maximilian attems Mon, 19 Dec 2005 09:37:36 +0100 + +klibc (1.1.1-4ubuntu7) dapper; urgency=low + + * Patch to get 5 and 6 argument syscalls working on hppa. + Thanks to Kyle McMartin for this patch! + + -- Jeff Bailey Tue, 22 Nov 2005 13:27:15 -0500 + +klibc (1.1.1-4ubuntu6) dapper; urgency=low + + * Replace the sleep utility with one that calls nanosleep instead, so + can be used for sleeping microseconds. + + -- Scott James Remnant Tue, 22 Nov 2005 07:38:22 +0000 + +klibc (1.1.1-4ubuntu5) dapper; urgency=low + + * Include /usr/lib/klibc/lib/libc.so in the development package, as you + can't link against the uber-stripped klibc-*.so. + + -- Scott James Remnant Thu, 10 Nov 2005 16:44:58 -0500 + +klibc (1.1.1-4ubuntu4) dapper; urgency=low + + * Include /usr/lib/klibc/lib/interp.o in the development package. + + -- Scott James Remnant Thu, 10 Nov 2005 15:33:59 -0500 + +klibc (1.1.1-4ubuntu3) dapper; urgency=low + + * Somewhere, in a hotel room in Montreal, one can hear the sounds of + a big Italian man crying as he places a brown paper bag over his + head and admits that sparc really did need gcc-3.3 after all. + + -- Scott James Remnant Wed, 9 Nov 2005 17:29:33 -0500 + +klibc (1.1.1-4ubuntu2) dapper; urgency=low + + * Fix build-failure on sparc, Debian hadn't fully applied the + "use gcc-3.3 for sparc" patch. + * Use gcc-3.4 on sparc instead. + + -- Scott James Remnant Tue, 8 Nov 2005 16:01:17 -0500 + +klibc (1.1.1-4ubuntu1) dapper; urgency=low + + * Manual merge with Debian: + - Drop klibc-mount-opts.diff, merged upstream. + - Drop mconfig-parisc.patch, merged upstream. + - Keep klibc-sparc64-signals.diff, not yet merged and fabbione + isn't sure whether it's still necessary or not. + - Adjust build-dep on linux-headers to that in dapper + + -- Scott James Remnant Mon, 7 Nov 2005 12:47:13 -0500 + +klibc (1.1.1-4) unstable; urgency=low + + * debian/rules,debian/control: Use gcc-3.3 for sparc. + + * Drop klibc-sparc64-signals.diff. + Thanks to Andrew Pollock for the test box, + to Jurij Smakov and Fabio M. Di Nitto + for confirming. (closes: #330191) + + * Build on archs we do support: sparc, alpha, ppc, i386, amd64, hppa, ia64, + arm. Will need work for m68k, mips, mipsel. + Workaround for #334917 + + * debian/patches/fstype-jfs.patch: New file to support jfs. :) + Thanks to Jeff Bailey. (closes: #336620) + + * debian/patches/sparc64_archstat.patch: New file to fix stat() on sparc64. + Thanks to Jurij Smakov for the patch. + + -- maximilian attems Wed, 2 Nov 2005 09:46:00 +0100 + +klibc (1.1.1-2) unstable; urgency=low + + * Work around bug#328850 in lintian per request of the FTP Master: + Add lintian override for "statically-linked-binary". + + -- maximilian attems Sat, 17 Sep 2005 19:52:49 +0200 + +klibc (1.1.1-1) unstable; urgency=low + + The "Actions Publiques" release + * New upstream release: + - improved mount, umount: drop merged stamp-patch-klibc-mount-opts.diff. + - build warnings cleanup + + * Ready to hit the debian archive. closes: #312563 + + -- maximilian attems Mon, 12 Sep 2005 13:48:05 +0200 + +klibc (1.0.14-5) unstable; urgency=low + + * Remove old dup useless debian changelog. + + * Fix amusing typos in debian/copyright. + + -- maximilian attems Wed, 7 Sep 2005 09:13:50 +0200 + +klibc (1.0.14-4) unstable; urgency=low + + * Rebuild to include original source archive for the upload. + + -- maximilian attems Wed, 7 Sep 2005 00:37:03 +0200 + +klibc (1.0.14-3) unstable; urgency=low + + * Build it as non-native package. + + * Lintian prefers Changelog and Maintainer entries in the same + capitalisation - otherwise it detects an NMU. + + -- maximilian attems Wed, 7 Sep 2005 00:25:59 +0200 + +klibc (1.0.14-2) unstable; urgency=low + + * Release it for Debian. + Thanks to Jeff Bailey for all the hard work. + + * Adapt ubuntu Build-Deps for Debian unstable. + + * klibc happily complies to 3.6.3 standard version. + + * Refer to the BSD and GPL license file in the debian/copyright file. + + -- maximilian attems Tue, 6 Sep 2005 13:14:31 +0200 + +klibc (1.0.14-1ubuntu1) breezy; urgency=low + + * Bump Build-Deps on newer linux-headers. + + * Fix sparc64 signals special cases: + - Add patch klibc-sparc64-signals.diff. + + -- Fabio M. Di Nitto Wed, 17 Aug 2005 09:07:13 +0200 + +klibc (1.0.14-1) breezy; urgency=low + + The "OMG, A User!" Release. + + * New upstream release. + + * Fix mount option handling (Thanks to mdz@ubuntu.com for the patch) + + * Prune unnecessary substitution variables from control file. + + -- Jeff Bailey Wed, 1 Jun 2005 09:33:38 -0400 + +klibc (1.0.10-0ubuntu1) breezy; urgency=low + + * New upstream release. + + * klibc-utils must depend on the library. + * Add section: libs for the source package. + + -- Jeff Bailey Tue, 24 May 2005 14:34:05 +0000 + +klibc (1.0.8-0ubuntu2) breezy; urgency=low + + * Bump linux-headers dep to 2.6.12, suggested by Fabio. + + * Build-dep on bison and flex. + + -- Jeff Bailey Sun, 15 May 2005 22:22:21 -0400 + +klibc (1.0.8-0ubuntu1) breezy; urgency=low + + * Initial upload to Ubuntu. + + -- Jeff Bailey Mon, 9 May 2005 13:28:30 -0400 + +klibc (0.197-2) breezy; urgency=low + + * Make sure the shell is called 'sh' not 'sh.shared' when installed + * Don't strip execute permissions from the klibc + + -- Jeff Bailey Fri, 28 Jan 2005 17:27:07 -0500 + +klibc (0.197-1) breezy; urgency=low + + * Initial Release. + + -- Jeff Bailey Sun, 23 Jan 2005 21:11:50 -0500 diff --git a/compat b/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/compat @@ -0,0 +1 @@ +9 diff --git a/control b/control new file mode 100644 index 0000000..732f3dc --- /dev/null +++ b/control @@ -0,0 +1,44 @@ +Source: klibc +Priority: optional +Maintainer: maximilian attems +Uploaders: Ben Hutchings +Build-Depends: debhelper (>= 9~), linux-libc-dev, m4 [sparc sparc64] +# klcc will depend on ccache if it was installed at build time; see #777217 +Build-Conflicts: ccache +Section: libs +Standards-Version: 4.1.2 +Vcs-Browser: https://salsa.debian.org/kernel-team/klibc +Vcs-Git: https://salsa.debian.org/kernel-team/klibc.git +# maybe some day replace with a real one? +Homepage: https://git.kernel.org/cgit/libs/klibc/klibc.git + +Package: libklibc-dev +Section: libdevel +Architecture: any +Depends: libklibc (= ${binary:Version}), linux-libc-dev, ${misc:Depends} +Description: kernel headers used during the build of klibc + This package contains the set of kernel headers that were required to + build klibc and the utilities that ship with it. This may or may + not be a complete enough set to build other programs that link against + klibc. If in doubt, use real kernel headers instead. + +Package: libklibc +Architecture: any +Depends: ${misc:Depends} +Description: minimal libc subset for use with initramfs + klibc is intended to be a minimalistic libc subset for use with + initramfs. It is deliberately written for small size, minimal + entanglement, and portability, not speed. It is definitely a work in + progress, and a lot of things are still missing. + +Package: klibc-utils +Architecture: any +Depends: libklibc (= ${binary:Version}), ${misc:Depends} +Breaks: initramfs-tools (<< 0.123~) +Description: small utilities built with klibc for early boot + This package contains a collection of programs that are linked + against klibc. These duplicate some of the functionality of a + regular Linux toolset, but are typically much smaller than their + full-function counterparts. They are intended for inclusion in + initramfs images and embedded systems. + diff --git a/copyright b/copyright new file mode 100644 index 0000000..7b60024 --- /dev/null +++ b/copyright @@ -0,0 +1,56 @@ +This package was debianized by Jeff Bailey on +Sun, 23 Jan 2005 21:11:50 -0500. + +It was downloaded from http://www.kernel.org/pub/linux/libs/klibc/ + +Copyright 2004-2006 H. Peter Anvin + +License: + +BSD/GPL + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License v2 can be found in `/usr/share/common-licenses/GPL-2'. + +-- BSD license text + +Some files are derived from files copyrighted by the Regents of The +University of California, and are available under the following +license: + +Note: The advertising clause in the license appearing on BSD Unix +files was officially rescinded by the Director of the Office of +Technology Licensing of the University of California on July 22 +1999. He states that clause 3 is "hereby deleted in its entirety." + + * Copyright (c) + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + diff --git a/initramfs-tools/hooks/klibc-utils b/initramfs-tools/hooks/klibc-utils new file mode 100755 index 0000000..0fb6dd9 --- /dev/null +++ b/initramfs-tools/hooks/klibc-utils @@ -0,0 +1,38 @@ +#!/bin/sh + +prereqs() +{ + if [ "${BUSYBOX}" = "n" ] || [ -z "${BUSYBOXDIR}" ]; then + echo '' + else + # Ensure busybox installs all its commands before + # checking what we should provide + echo zz-busybox + fi +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# klibc +cp -pnL /usr/lib/klibc/bin/* ${DESTDIR}/bin +cp -pL /lib/klibc-*.so ${DESTDIR}/lib +rm -f ${DESTDIR}/bin/kinit* +if [ "${BUSYBOX}" = "n" ] || [ -z "${BUSYBOXDIR}" ]; then + rm -f ${DESTDIR}/bin/zcat + if [ -e ${DESTDIR}/bin/sh.shared ]; then + # Some platforms build a shared klibc/sh: + mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh + elif [ -e /usr/lib/klibc/bin/sh ]; then + # Others build a static version instead: + cp -pL /usr/lib/klibc/bin/sh ${DESTDIR}/bin/sh + fi +else + # Nobody wanted it, so save a tiny bit of space: + rm -f ${DESTDIR}/bin/sh.shared +fi diff --git a/klibc-utils.install b/klibc-utils.install new file mode 100644 index 0000000..f8fdf1b --- /dev/null +++ b/klibc-utils.install @@ -0,0 +1,2 @@ +debian/tmp/usr/lib/klibc/bin/* +debian/initramfs-tools/hooks/klibc-utils /usr/share/initramfs-tools/hooks/ diff --git a/klibc-utils.lintian-overrides b/klibc-utils.lintian-overrides new file mode 100644 index 0000000..72e5b01 --- /dev/null +++ b/klibc-utils.lintian-overrides @@ -0,0 +1,2 @@ +klibc-utils: statically-linked-binary +klibc-utils: embedded-zlib diff --git a/klibc-utils.postinst b/klibc-utils.postinst new file mode 100644 index 0000000..f31c443 --- /dev/null +++ b/klibc-utils.postinst @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +if [ ! -L /usr/share/doc/klibc-utils ] && \ +[ -e /usr/share/doc/klibc-utils ]; then + rm -rf /usr/share/doc/klibc-utils + cd /usr/share/doc/ + ln -sf libklibc /usr/share/doc/klibc-utils +fi + +# Remove diversion which was used during upgrades to stretch. +# This command can be removed after the buster release. +if dpkg --compare-versions "$2" lt 2.0.4-12~; then + dpkg-divert --package klibc-utils --remove --rename \ + --divert /usr/share/initramfs-tools/hooks/klibc^i-t \ + /usr/share/initramfs-tools/hooks/klibc +fi + +#DEBHELPER# diff --git a/libklibc-dev.install b/libklibc-dev.install new file mode 100644 index 0000000..709ddf1 --- /dev/null +++ b/libklibc-dev.install @@ -0,0 +1,3 @@ +debian/tmp/usr/lib/klibc/include/* +debian/tmp/usr/lib/klibc/lib/* +debian/tmp/usr/bin/klcc* diff --git a/libklibc-dev.lintian-overrides b/libklibc-dev.lintian-overrides new file mode 100644 index 0000000..bd22adb --- /dev/null +++ b/libklibc-dev.lintian-overrides @@ -0,0 +1,7 @@ +libklibc-dev: statically-linked-binary +libklibc-dev: unstripped-binary-or-object +libklibc-dev: embedded-zlib +# lintian cannot check these; they are part of linux-libc-dev +libklibc-dev: package-contains-broken-symlink usr/lib/klibc/include/asm * +libklibc-dev: package-contains-broken-symlink usr/lib/klibc/include/asm-generic * +libklibc-dev: package-contains-broken-symlink usr/lib/klibc/include/linux * diff --git a/libklibc-dev.manpages b/libklibc-dev.manpages new file mode 100644 index 0000000..006f97c --- /dev/null +++ b/libklibc-dev.manpages @@ -0,0 +1 @@ +klcc/klcc.1 diff --git a/libklibc-dev.preinst b/libklibc-dev.preinst new file mode 100644 index 0000000..9694ab2 --- /dev/null +++ b/libklibc-dev.preinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +BASEDIR=/usr/lib/klibc/include/ +# these are shipped symlinks to linux-libc-dev and not directories +if [ -d ${BASEDIR}linux ] || [ -d ${BASEDIR}asm ]; then + rm -rf ${BASEDIR}linux ${BASEDIR}asm* +fi diff --git a/libklibc.docs b/libklibc.docs new file mode 100644 index 0000000..fa8b07f --- /dev/null +++ b/libklibc.docs @@ -0,0 +1,4 @@ +README +usr/klibc/README.klibc +usr/klibc/arch/README.klibc.arch +usr/kinit/ipconfig/README.ipconfig diff --git a/libklibc.install b/libklibc.install new file mode 100644 index 0000000..8cd41ea --- /dev/null +++ b/libklibc.install @@ -0,0 +1 @@ +debian/tmp/lib/klibc*.so diff --git a/libklibc.lintian-overrides b/libklibc.lintian-overrides new file mode 100644 index 0000000..9ab08bb --- /dev/null +++ b/libklibc.lintian-overrides @@ -0,0 +1,2 @@ +libklibc: statically-linked-binary +libklibc: embedded-zlib diff --git a/patches/0001-add-mips64-support-headers.patch b/patches/0001-add-mips64-support-headers.patch new file mode 100644 index 0000000..21f64f2 --- /dev/null +++ b/patches/0001-add-mips64-support-headers.patch @@ -0,0 +1,171 @@ +From: Dejan Latinovic +Date: Thu, 5 Mar 2015 16:51:44 -0800 +Subject: [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 +--- + usr/include/arch/mips64/klibc/archconfig.h | 5 ++ + usr/include/arch/mips64/klibc/archsetjmp.h | 26 ++++++++++ + usr/include/arch/mips64/machine/asm.h | 82 ++++++++++++++++++++++++++++++ + usr/include/fcntl.h | 2 +- + 4 files changed, 114 insertions(+), 1 deletion(-) + create mode 100644 usr/include/arch/mips64/klibc/archsetjmp.h + create mode 100644 usr/include/arch/mips64/machine/asm.h + +diff --git a/usr/include/arch/mips64/klibc/archconfig.h b/usr/include/arch/mips64/klibc/archconfig.h +index 4d856a5..df3cf1c 100644 +--- a/usr/include/arch/mips64/klibc/archconfig.h ++++ b/usr/include/arch/mips64/klibc/archconfig.h +@@ -12,7 +12,12 @@ + /* MIPS has nonstandard socket definitions */ + #define _KLIBC_HAS_ARCHSOCKET_H 1 + ++#define _KLIBC_STATFS_F_TYPE_64 1 ++ + /* We can use RT signals on MIPS */ + #define _KLIBC_USE_RT_SIG 1 + ++/* MIPS has architecture-specific code for vfork() */ ++#define _KLIBC_REAL_VFORK 1 ++ + #endif /* _KLIBC_ARCHCONFIG_H */ +diff --git a/usr/include/arch/mips64/klibc/archsetjmp.h b/usr/include/arch/mips64/klibc/archsetjmp.h +new file mode 100644 +index 0000000..c4587dc +--- /dev/null ++++ b/usr/include/arch/mips64/klibc/archsetjmp.h +@@ -0,0 +1,26 @@ ++/* ++ * arch/mips64/include/klibc/archsetjmp.h ++ */ ++ ++#ifndef _KLIBC_ARCHSETJMP_H ++#define _KLIBC_ARCHSETJMP_H ++ ++struct __jmp_buf { ++ unsigned long __s0; ++ unsigned long __s1; ++ unsigned long __s2; ++ unsigned long __s3; ++ unsigned long __s4; ++ unsigned long __s5; ++ unsigned long __s6; ++ unsigned long __s7; ++ unsigned long __gp; ++ unsigned long __sp; ++ unsigned long __s8; ++ unsigned long __ra; ++ unsigned long __unused; ++} __attribute__ ((aligned(8))); ++ ++typedef struct __jmp_buf jmp_buf[1]; ++ ++#endif /* _KLIBC_ARCHSETJMP_H */ +diff --git a/usr/include/arch/mips64/machine/asm.h b/usr/include/arch/mips64/machine/asm.h +new file mode 100644 +index 0000000..42dcaa4 +--- /dev/null ++++ b/usr/include/arch/mips64/machine/asm.h +@@ -0,0 +1,82 @@ ++/* ++ * arch/mips64/include/machine/asm.h ++ */ ++ ++#ifndef _MACHINE_ASM_H ++#define _MACHINE_ASM_H ++ ++/* ++ * Symbolic register names for 64 bit ABI ++ */ ++ ++ ++#define zero $0 /* wired zero */ ++#define AT $at /* assembler temp - uppercase because of ".set at" */ ++#define v0 $2 /* return value - caller saved */ ++#define v1 $3 ++#define a0 $4 /* argument registers */ ++#define a1 $5 ++#define a2 $6 ++#define a3 $7 ++#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */ ++#define ta0 $8 ++#define a5 $9 ++#define ta1 $9 ++#define a6 $10 ++#define ta2 $10 ++#define a7 $11 ++#define ta3 $11 ++#define t4 $12 /* caller saved */ ++#define t5 $13 ++#define t6 $14 ++#define t7 $15 ++#define s0 $16 /* callee saved */ ++#define s1 $17 ++#define s2 $18 ++#define s3 $19 ++#define s4 $20 ++#define s5 $21 ++#define s6 $22 ++#define s7 $23 ++#define t8 $24 /* caller saved */ ++#define t9 $25 /* callee address for PIC/temp */ ++#define jp $25 /* PIC jump register */ ++#define k0 $26 /* kernel temporary */ ++#define k1 $27 ++#define gp $28 /* global pointer - caller saved for PIC */ ++#define sp $29 /* stack pointer */ ++#define fp $30 /* frame pointer */ ++#define s8 $30 /* callee saved */ ++#define ra $31 /* return address */ ++ ++ ++/* ++ * LEAF - declare leaf routine ++ */ ++#define LEAF(symbol) \ ++ .globl symbol; \ ++ .align 2; \ ++ .type symbol,@function; \ ++ .ent symbol,0; \ ++symbol: .frame sp,0,ra ++ ++ ++/* ++ * NESTED - declare nested routine entry point ++ */ ++#define NESTED(symbol, framesize, rpc) \ ++ .globl symbol; \ ++ .align 2; \ ++ .type symbol,@function; \ ++ .ent symbol,0; \ ++symbol: .frame sp, framesize, rpc ++ ++/* ++ * END - mark end of function ++ */ ++#define END(function) \ ++ .end function; \ ++ .size function,.-function ++ ++ ++#endif /* _MACHINE_ASM_H */ +diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h +index bbd6917..16128f8 100644 +--- a/usr/include/fcntl.h ++++ b/usr/include/fcntl.h +@@ -9,7 +9,7 @@ + #include + #include + #include +-#if defined(__mips__) && !defined(__mips64__) ++#if defined(__mips__) && ! defined(__mips64) + # include + #endif + #include +-- +2.4.5 + diff --git a/patches/0002-add-mips64-support-arch-mips32.patch b/patches/0002-add-mips64-support-arch-mips32.patch new file mode 100644 index 0000000..79a5eae --- /dev/null +++ b/patches/0002-add-mips64-support-arch-mips32.patch @@ -0,0 +1,71 @@ +From: Dejan Latinovic +Date: Thu, 5 Mar 2015 16:51:44 -0800 +Subject: [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 +--- + usr/klibc/arch/mips64/Kbuild | 11 +++++++++++ + usr/klibc/arch/mips64/sysstub.ph | 29 +++++++++++++++++++++++++++++ + 2 files changed, 40 insertions(+) + create mode 100644 usr/klibc/arch/mips64/sysstub.ph + +diff --git a/usr/klibc/arch/mips64/Kbuild b/usr/klibc/arch/mips64/Kbuild +index 970c0f8..6fe3b53 100644 +--- a/usr/klibc/arch/mips64/Kbuild ++++ b/usr/klibc/arch/mips64/Kbuild +@@ -1,3 +1,14 @@ + # + # klibc files for mips64 + # ++ ++klib-y := ../mips/pipe.o ../mips/vfork.o setjmp.o ../mips/syscall.o ++ ++klib-y += ../../libgcc/__clzsi2.o ../../libgcc/__ashldi3.o ++klib-y += ../../libgcc/__ashrdi3.o ../../libgcc/__lshrdi3.o ++klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o ++klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o ++klib-y += ../../libgcc/__udivmoddi4.o ++ ++always := crt0.o ++targets := crt0.o +diff --git a/usr/klibc/arch/mips64/sysstub.ph b/usr/klibc/arch/mips64/sysstub.ph +new file mode 100644 +index 0000000..e8a0200 +--- /dev/null ++++ b/usr/klibc/arch/mips64/sysstub.ph +@@ -0,0 +1,29 @@ ++# -*- perl -*- ++# ++# arch/mips64/sysstub.ph ++# ++# Script to generate system call stubs ++# ++ ++# On MIPS, most system calls follow the standard convention, with the ++# system call number in r0 (v0), return an error value in r19 (a3) as ++# well as the return value in r0 (v0). ++ ++sub make_sysstub($$$$$@) { ++ my($outputdir, $fname, $type, $sname, $stype, @args) = @_; ++ ++ $stype = $stype || 'common'; ++ open(OUT, '>', "${outputdir}/${fname}.S"); ++ print OUT "#include \n"; ++ print OUT "#include \n"; ++ print OUT "\n"; ++ print OUT "\t.set noreorder\n"; ++ print OUT "\n"; ++ print OUT "LEAF(${fname})\n"; ++ print OUT "\tj\t__syscall_${stype}\n"; ++ print OUT "\t li\tv0, __NR_${sname}\n"; ++ print OUT "\tEND(${fname})\n"; ++ close(OUT); ++} ++ ++1; +-- +2.4.5 + diff --git a/patches/0003-add-mips64-support-arch-mips64-specific.patch b/patches/0003-add-mips64-support-arch-mips64-specific.patch new file mode 100644 index 0000000..134d298 --- /dev/null +++ b/patches/0003-add-mips64-support-arch-mips64-specific.patch @@ -0,0 +1,124 @@ +From: Dejan Latinovic +Date: Thu, 5 Mar 2015 16:51:45 -0800 +Subject: [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 +--- + usr/klibc/arch/mips64/MCONFIG | 2 ++ + usr/klibc/arch/mips64/crt0.S | 31 ++++++++++++++++++++++++++ + usr/klibc/arch/mips64/setjmp.S | 50 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 83 insertions(+) + create mode 100644 usr/klibc/arch/mips64/crt0.S + create mode 100644 usr/klibc/arch/mips64/setjmp.S + +diff --git a/usr/klibc/arch/mips64/MCONFIG b/usr/klibc/arch/mips64/MCONFIG +index 5c50b8d..b37cc6a 100644 +--- a/usr/klibc/arch/mips64/MCONFIG ++++ b/usr/klibc/arch/mips64/MCONFIG +@@ -9,3 +9,5 @@ + + KLIBCOPTFLAGS += -Os + KLIBCBITSIZE = 64 ++ ++KLIBCSHAREDFLAGS = -T $(src)/arch/mips/klibc.ld +diff --git a/usr/klibc/arch/mips64/crt0.S b/usr/klibc/arch/mips64/crt0.S +new file mode 100644 +index 0000000..775a919 +--- /dev/null ++++ b/usr/klibc/arch/mips64/crt0.S +@@ -0,0 +1,31 @@ ++# ++# arch/mips64/crt0.S ++# ++# Does arch-specific initialization and invokes __libc_init ++# with the appropriate arguments. ++# ++# See __static_init.c or __shared_init.c for the expected ++# arguments. ++# ++ ++#include ++ ++NESTED(__start, 64, sp) ++ daddiu sp,sp,-64 ++ sd zero, 32(sp) ++ ++ # Initialize gp ++ lui gp,%highest(_gp) # load highest "halfword" ++ daddiu gp,gp,%higher(_gp) # merge next "halfword" ++ dsll gp,gp,16 # shift by one halfword ++ daddiu gp,gp,%hi(_gp) # merge next "halfword" ++ dsll gp,gp,16 # shift into final position ++ daddiu gp,gp,%lo(_gp) # merge lowest "halfword" ++ ++ daddiu a0, sp, 64 # Pointer to ELF entry structure ++ move a1, v0 # Kernel-provided atexit() pointer ++ ++ ld t9, %call16(__libc_init)(gp) ++ jalr t9 ++ ++ END(__start) +diff --git a/usr/klibc/arch/mips64/setjmp.S b/usr/klibc/arch/mips64/setjmp.S +new file mode 100644 +index 0000000..5d902e2 +--- /dev/null ++++ b/usr/klibc/arch/mips64/setjmp.S +@@ -0,0 +1,50 @@ ++# ++# arch/mips64/setjmp.S ++# ++# setjmp/longjmp for the MIPS architecture ++# ++# The jmp_buf is assumed to contain the following, in order: ++# s0..s7 ++# gp ++# sp ++# s8 ++# ra ++# ++ ++#include ++ ++LEAF(setjmp) ++ sd s0, 0(a0) ++ sd s1, 8(a0) ++ sd s2, 16(a0) ++ sd s3, 24(a0) ++ sd s4, 32(a0) ++ sd s5, 40(a0) ++ sd s6, 48(a0) ++ sd s7, 56(a0) ++ sd gp, 64(a0) ++ sd sp, 72(a0) ++ sd s8, 80(a0) ++ sd ra, 88(a0) ++ move v0, zero ++ jr ra ++ ++ END(setjmp) ++ ++LEAF(longjmp) ++ ld s0, 0(a0) ++ ld s1, 8(a0) ++ ld s2, 16(a0) ++ ld s3, 24(a0) ++ ld s4, 32(a0) ++ ld s5, 40(a0) ++ ld s6, 48(a0) ++ ld s7, 56(a0) ++ ld gp, 64(a0) ++ ld sp, 72(a0) ++ ld s8, 80(a0) ++ ld ra, 88(a0) ++ move v0, a1 ++ jr ra ++ ++ END(longjmp) +-- +2.4.5 + diff --git a/patches/Implement-classless-static-routes.patch b/patches/Implement-classless-static-routes.patch new file mode 100644 index 0000000..2945a0f --- /dev/null +++ b/patches/Implement-classless-static-routes.patch @@ -0,0 +1,399 @@ +From 109b6364ff86db10cb5e1832cc5c9dbbd2f8b9b4 Mon Sep 17 00:00:00 2001 +From: Benjamin Drung +Date: Wed, 13 Dec 2017 23:04:29 +0100 +Subject: [PATCH] Implement classless static routes +Forwarded: https://www.zytor.com/pipermail/klibc/2018-June/003993.html + +Implement classless static routes support as specified in RFC3442. + +Bug-Debian: https://bugs.debian.org/884716 +Bug-Ubuntu: https://launchpad.net/bugs/1526956 +Signed-off-by: Benjamin Drung +--- + usr/kinit/ipconfig/bootp_proto.c | 109 +++++++++++++++++++++++++++++++ + usr/kinit/ipconfig/dhcp_proto.c | 1 + + usr/kinit/ipconfig/main.c | 54 ++++++++++++--- + usr/kinit/ipconfig/netdev.c | 49 ++++++++++---- + usr/kinit/ipconfig/netdev.h | 24 ++++++- + 5 files changed, 212 insertions(+), 25 deletions(-) + +diff --git a/usr/kinit/ipconfig/bootp_proto.c b/usr/kinit/ipconfig/bootp_proto.c +index 150ebfa7..f6f9dd43 100644 +--- a/usr/kinit/ipconfig/bootp_proto.c ++++ b/usr/kinit/ipconfig/bootp_proto.c +@@ -267,6 +267,87 @@ static char *bootp_ext119_decode(const void *ext, int16_t ext_size, void *tmp) + return decoded_str; + } + ++/* ++ * DESCRIPTION ++ * bootp_ext121_decode() decodes Classless Route Option data. ++ * ++ * ARGUMENTS ++ * const uint8_t *ext ++ * *ext is a pointer to a DHCP Classless Route Option data. ++ * For example, if *ext is {16, 192, 168, 192, 168, 42, 1}, ++ * this function returns a pointer to ++ * { ++ * subnet = 192.168.0.0; ++ * netmask_width = 16; ++ * gateway = 192.168.42.1; ++ * next = NULL; ++ * } ++ * ++ * int16_t ext_size ++ * ext_size is the memory size of *ext. For example, ++ * if *ext is {16, 192, 168, 192, 168, 42, 1}, ext_size must be 7. ++ * ++ * RETURN VALUE ++ * if OK, a pointer to a decoded struct route malloc-ed ++ * else , NULL ++ * ++ * SEE ALSO RFC3442 ++ */ ++struct route *bootp_ext121_decode(const uint8_t *ext, int16_t ext_size) ++{ ++ int16_t index = 0; ++ uint8_t netmask_width; ++ uint8_t significant_octets; ++ struct route *routes = NULL; ++ struct route *prev_route = NULL; ++ ++ while (index < ext_size) { ++ netmask_width = ext[index]; ++ index++; ++ if (netmask_width > 32) { ++ printf("IP-Config: Given Classless Route Option subnet mask width '%u' " ++ "exceeds IPv4 limit of 32. Ignoring remaining option.\n", ++ netmask_width); ++ return routes; ++ } ++ significant_octets = netmask_width / 8 + (netmask_width % 8 > 0); ++ if (ext_size - index < significant_octets + 4) { ++ printf("IP-Config: Given Classless Route Option remaining lengths (%u octets) " ++ "is shorter than the expected %u octets. Ignoring remaining options.\n", ++ ext_size - index, significant_octets + 4); ++ return routes; ++ } ++ ++ struct route *route = malloc(sizeof(struct route)); ++ if (route == NULL) ++ return routes; ++ ++ /* convert only significant octets from byte array into integer in network byte order */ ++ route->subnet = 0; ++ memcpy(&route->subnet, &ext[index], significant_octets); ++ index += significant_octets; ++ /* RFC3442 demands: After deriving a subnet number and subnet mask from ++ each destination descriptor, the DHCP client MUST zero any bits in ++ the subnet number where the corresponding bit in the mask is zero. */ ++ route->subnet &= netdev_genmask(netmask_width); ++ ++ /* convert octet array into network byte order */ ++ memcpy(&route->gateway, &ext[index], 4); ++ index += 4; ++ ++ route->netmask_width = netmask_width; ++ route->next = NULL; ++ ++ if (prev_route == NULL) { ++ routes = route; ++ } else { ++ prev_route->next = route; ++ } ++ prev_route = route; ++ } ++ return routes; ++} ++ + /* + * Parse a bootp reply packet + */ +@@ -275,6 +356,8 @@ int bootp_parse(struct netdev *dev, struct bootp_hdr *hdr, + { + uint8_t ext119_buf[BOOTP_EXTS_SIZE]; + int16_t ext119_len = 0; ++ uint8_t ext121_buf[BOOTP_EXTS_SIZE]; ++ int16_t ext121_len = 0; + + dev->bootp.gateway = hdr->giaddr; + dev->ip_addr = hdr->yiaddr; +@@ -367,6 +450,16 @@ int bootp_parse(struct netdev *dev, struct bootp_hdr *hdr, + } else + ext119_len = -1; + ++ break; ++ case 121: /* Classless Static Route Option (RFC3442) */ ++ if (ext121_len >= 0 && ++ ext121_len + len <= sizeof(ext121_buf)) { ++ memcpy(ext121_buf + ext121_len, ++ ext, len); ++ ext121_len += len; ++ } else ++ ext121_len = -1; ++ + break; + } + +@@ -385,6 +478,22 @@ int bootp_parse(struct netdev *dev, struct bootp_hdr *hdr, + } + } + ++ if (ext121_len > 0) { ++ struct route *ret; ++ ++ ret = bootp_ext121_decode(ext121_buf, ext121_len); ++ if (ret != NULL) { ++ struct route *cur = dev->routes; ++ struct route *next; ++ while (cur != NULL) { ++ next = cur->next; ++ free(cur); ++ cur = next; ++ } ++ dev->routes = ret; ++ } ++ } ++ + /* + * Got packet. + */ +diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c +index d5b759bb..4e560b84 100644 +--- a/usr/kinit/ipconfig/dhcp_proto.c ++++ b/usr/kinit/ipconfig/dhcp_proto.c +@@ -26,6 +26,7 @@ static uint8_t dhcp_params[] = { + 28, /* broadcast addr */ + 40, /* NIS domain name (why?) */ + 119, /* Domain Search Option */ ++ 121, /* Classless Static Route Option (RFC3442) */ + }; + + static uint8_t dhcp_discover_hdr[] = { +diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c +index e00f0491..1a41c385 100644 +--- a/usr/kinit/ipconfig/main.c ++++ b/usr/kinit/ipconfig/main.c +@@ -71,6 +71,8 @@ static inline const char *my_inet_ntoa(uint32_t addr) + + static void print_device_config(struct netdev *dev) + { ++ int dns0_spaces; ++ int dns1_spaces; + printf("IP-Config: %s complete", dev->name); + if (dev->proto == PROTO_BOOTP || dev->proto == PROTO_DHCP) + printf(" (%s from %s)", protoinfos[dev->proto].name, +@@ -80,9 +82,27 @@ static void print_device_config(struct netdev *dev) + printf(":\n address: %-16s ", my_inet_ntoa(dev->ip_addr)); + printf("broadcast: %-16s ", my_inet_ntoa(dev->ip_broadcast)); + printf("netmask: %-16s\n", my_inet_ntoa(dev->ip_netmask)); +- printf(" gateway: %-16s ", my_inet_ntoa(dev->ip_gateway)); +- printf("dns0 : %-16s ", my_inet_ntoa(dev->ip_nameserver[0])); +- printf("dns1 : %-16s\n", my_inet_ntoa(dev->ip_nameserver[1])); ++ if (dev->routes != NULL) { ++ struct route *cur; ++ char *delim = ""; ++ printf(" routes :"); ++ for (cur = dev->routes; cur != NULL; cur = cur->next) { ++ printf("%s %s/%u", delim, my_inet_ntoa(cur->subnet), cur->netmask_width); ++ if (cur->gateway != 0) { ++ printf(" via %s", my_inet_ntoa(cur->gateway)); ++ } ++ delim = ","; ++ } ++ printf("\n"); ++ dns0_spaces = 3; ++ dns1_spaces = 5; ++ } else { ++ printf(" gateway: %-16s", my_inet_ntoa(dev->ip_gateway)); ++ dns0_spaces = 5; ++ dns1_spaces = 3; ++ } ++ printf(" dns0%*c: %-16s", dns0_spaces, ' ', my_inet_ntoa(dev->ip_nameserver[0])); ++ printf(" dns1%*c: %-16s\n", dns1_spaces, ' ', my_inet_ntoa(dev->ip_nameserver[1])); + if (dev->hostname[0]) + printf(" host : %-64s\n", dev->hostname); + if (dev->dnsdomainname[0]) +@@ -106,8 +126,8 @@ static void configure_device(struct netdev *dev) + if (netdev_setaddress(dev)) + printf("IP-Config: failed to set addresses on %s\n", + dev->name); +- if (netdev_setdefaultroute(dev)) +- printf("IP-Config: failed to set default route on %s\n", ++ if (netdev_setroutes(dev)) ++ printf("IP-Config: failed to set routes on %s\n", + dev->name); + if (dev->hostname[0] && + sethostname(dev->hostname, strlen(dev->hostname))) +@@ -161,8 +181,24 @@ static void dump_device_config(struct netdev *dev) + my_inet_ntoa(dev->ip_broadcast)); + write_option(f, "IPV4NETMASK", + my_inet_ntoa(dev->ip_netmask)); +- write_option(f, "IPV4GATEWAY", +- my_inet_ntoa(dev->ip_gateway)); ++ if (dev->routes != NULL) { ++ /* Use 6 digits to encode the index */ ++ char key[23]; ++ char value[19]; ++ int i = 0; ++ struct route *cur; ++ for (cur = dev->routes; cur != NULL; cur = cur->next) { ++ snprintf(key, sizeof(key), "IPV4ROUTE%iSUBNET", i); ++ snprintf(value, sizeof(value), "%s/%u", my_inet_ntoa(cur->subnet), cur->netmask_width); ++ write_option(f, key, value); ++ snprintf(key, sizeof(key), "IPV4ROUTE%iGATEWAY", i); ++ write_option(f, key, my_inet_ntoa(cur->gateway)); ++ i++; ++ } ++ } else { ++ write_option(f, "IPV4GATEWAY", ++ my_inet_ntoa(dev->ip_gateway)); ++ } + write_option(f, "IPV4DNS0", + my_inet_ntoa(dev->ip_nameserver[0])); + write_option(f, "IPV4DNS1", +@@ -545,7 +581,7 @@ bail: + + static int add_all_devices(struct netdev *template); + +-static int parse_device(struct netdev *dev, const char *ip) ++static int parse_device(struct netdev *dev, char *ip) + { + char *cp; + int opt; +@@ -658,7 +694,7 @@ static void bringup_one_dev(struct netdev *template, struct netdev *dev) + bringup_device(dev); + } + +-static struct netdev *add_device(const char *info) ++static struct netdev *add_device(char *info) + { + struct netdev *dev; + int i; +diff --git a/usr/kinit/ipconfig/netdev.c b/usr/kinit/ipconfig/netdev.c +index e203d0c6..de87f960 100644 +--- a/usr/kinit/ipconfig/netdev.c ++++ b/usr/kinit/ipconfig/netdev.c +@@ -88,23 +88,44 @@ static void set_s_addr(struct sockaddr *saddr, uint32_t ipaddr) + memcpy(saddr, &sin, sizeof sin); + } + +-int netdev_setdefaultroute(struct netdev *dev) ++int netdev_setroutes(struct netdev *dev) + { + struct rtentry r; + +- if (dev->ip_gateway == INADDR_ANY) +- return 0; +- +- memset(&r, 0, sizeof(r)); +- +- set_s_addr(&r.rt_dst, INADDR_ANY); +- set_s_addr(&r.rt_gateway, dev->ip_gateway); +- set_s_addr(&r.rt_genmask, INADDR_ANY); +- r.rt_flags = RTF_UP | RTF_GATEWAY; +- +- if (ioctl(cfd, SIOCADDRT, &r) == -1 && errno != EEXIST) { +- perror("SIOCADDRT"); +- return -1; ++ /* RFC3442 demands: ++ If the DHCP server returns both a Classless Static Routes option and ++ a Router option, the DHCP client MUST ignore the Router option. */ ++ if (dev->routes != NULL) { ++ struct route *cur; ++ for (cur = dev->routes; cur != NULL; cur = cur->next) { ++ memset(&r, 0, sizeof(r)); ++ ++ r.rt_dev = dev->name; ++ set_s_addr(&r.rt_dst, cur->subnet); ++ set_s_addr(&r.rt_gateway, cur->gateway); ++ set_s_addr(&r.rt_genmask, netdev_genmask(cur->netmask_width)); ++ r.rt_flags = RTF_UP; ++ if (cur->gateway != 0) { ++ r.rt_flags |= RTF_GATEWAY; ++ } ++ ++ if (ioctl(cfd, SIOCADDRT, &r) == -1 && errno != EEXIST) { ++ perror("SIOCADDRT"); ++ return -1; ++ } ++ } ++ } else if (dev->ip_gateway != INADDR_ANY) { ++ memset(&r, 0, sizeof(r)); ++ ++ set_s_addr(&r.rt_dst, INADDR_ANY); ++ set_s_addr(&r.rt_gateway, dev->ip_gateway); ++ set_s_addr(&r.rt_genmask, INADDR_ANY); ++ r.rt_flags = RTF_UP | RTF_GATEWAY; ++ ++ if (ioctl(cfd, SIOCADDRT, &r) == -1 && errno != EEXIST) { ++ perror("SIOCADDRT"); ++ return -1; ++ } + } + return 0; + } +diff --git a/usr/kinit/ipconfig/netdev.h b/usr/kinit/ipconfig/netdev.h +index 4b75a65a..dbc80cd0 100644 +--- a/usr/kinit/ipconfig/netdev.h ++++ b/usr/kinit/ipconfig/netdev.h +@@ -1,14 +1,22 @@ + #ifndef IPCONFIG_NETDEV_H + #define IPCONFIG_NETDEV_H + ++#include + #include + #include + + #define BPLEN 256 + #define FNLEN 128 /* from DHCP RFC 2131 */ + ++struct route { ++ uint32_t subnet; /* subnet */ ++ uint32_t netmask_width; /* subnet mask width */ ++ uint32_t gateway; /* gateway */ ++ struct route *next; ++}; ++ + struct netdev { +- const char *name; /* Device name */ ++ char *name; /* Device name */ + unsigned int ifindex; /* interface index */ + unsigned int hwtype; /* ARPHRD_xxx */ + unsigned int hwlen; /* HW address length */ +@@ -44,6 +52,7 @@ struct netdev { + char bootpath[BPLEN]; /* boot path */ + char filename[FNLEN]; /* filename */ + char *domainsearch; /* decoded, NULL or malloc-ed */ ++ struct route *routes; /* decoded, NULL or malloc-ed list */ + long uptime; /* when complete configuration */ + int pkt_fd; /* packet socket for this interface */ + struct netdev *next; /* next configured i/f */ +@@ -70,7 +79,7 @@ extern struct netdev *ifaces; + + int netdev_getflags(struct netdev *dev, short *flags); + int netdev_setaddress(struct netdev *dev); +-int netdev_setdefaultroute(struct netdev *dev); ++int netdev_setroutes(struct netdev *dev); + int netdev_up(struct netdev *dev); + int netdev_down(struct netdev *dev); + int netdev_init_if(struct netdev *dev); +@@ -84,4 +93,15 @@ static inline int netdev_running(struct netdev *dev) + return ret ? 0 : !!(flags & IFF_RUNNING); + } + ++static inline uint32_t netdev_genmask(uint32_t netmask_width) ++{ ++ /* Map netmask width to network mask in network byte order. ++ Example: 24 -> "255.255.255.0" -> htonl(0xFFFFFF00) */ ++ if (netmask_width == 0) { ++ return 0; ++ } else { ++ return htonl(~((1u << (32 - netmask_width)) - 1)); ++ } ++} ++ + #endif /* IPCONFIG_NETDEV_H */ +-- +2.17.1 + diff --git a/patches/add-reboot-argument-support.patch b/patches/add-reboot-argument-support.patch new file mode 100644 index 0000000..d127456 --- /dev/null +++ b/patches/add-reboot-argument-support.patch @@ -0,0 +1,101 @@ +Description: Add support for reboot syscall argument + Add support to the reboot command so an argument for the 4th parameter + of the syscall can be passed around. This can be useful in, say, devices + that follow Android partitions conventions, so we can do things like + rebootinig to the kernel in recovery partition with "reboot recovery". +Author: Alfonso Sanchez-beato +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1692494 +Bug-Debian ;https://bugs.debian.org/863761 +Forwarded: http://www.zytor.com/pipermail/klibc/2017-May/003957.html +Last-Update: 2017-05-22 + +--- klibc-2.0.4.orig/usr/include/sys/reboot.h ++++ klibc-2.0.4/usr/include/sys/reboot.h +@@ -16,8 +16,8 @@ + #define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF + #define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF + +-/* glibc-ish one-argument version */ +-__extern int reboot(int); ++/* two-arguments version of reboot */ ++__extern int reboot(int, void *); + + /* Native four-argument system call */ + __extern int __reboot(int, int, int, void *); +--- klibc-2.0.4.orig/usr/klibc/reboot.c ++++ klibc-2.0.4/usr/klibc/reboot.c +@@ -6,10 +6,10 @@ + #include + #include + +-/* This provides the one-argument glibc-ish version of reboot. ++/* This provides two-argument reboot function (glibc flag plus reboot argument). + The full four-argument system call is available as __reboot(). */ + +-int reboot(int flag) ++int reboot(int flag, void *arg) + { +- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, flag, NULL); ++ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, flag, arg); + } +--- klibc-2.0.4.orig/usr/utils/halt.c ++++ klibc-2.0.4/usr/utils/halt.c +@@ -6,7 +6,7 @@ + + static __noreturn usage(void) + { +- static char mesg[] = "Usage: {halt|reboot|poweroff} [-n]\n"; ++ static char mesg[] = "Usage: {halt|reboot|poweroff} [-n] [reboot-arg]\n"; + write(2, mesg, sizeof(mesg) - 1); + exit(1); + } +@@ -16,6 +16,7 @@ int main(int argc, char *argv[]) + int cmd = 0; /* initalize to shut gcc up */ + int do_sync = 1; + char *ptr, *ptr2; ++ char *reboot_arg = NULL; + + /* Which action (program name)? */ + ptr2 = ptr = argv[0]; +@@ -32,23 +33,28 @@ int main(int argc, char *argv[]) + usage(); + + /* Walk options */ +- while (*++argv && **argv == '-') +- switch (*++*argv) { +- case 'f': +- break; /* -f assumed */ +- case 'n': +- do_sync = 0; +- break; +- default: +- usage(); ++ while (*++argv) ++ if (**argv == '-') { ++ switch (*++*argv) { ++ case 'f': ++ break; /* -f assumed */ ++ case 'n': ++ do_sync = 0; ++ break; ++ default: ++ usage(); ++ } ++ } else if (cmd == LINUX_REBOOT_CMD_RESTART) { ++ reboot_arg = *argv; ++ cmd = LINUX_REBOOT_CMD_RESTART2; ++ } else { ++ usage(); /* args, not reboot == error */ + } +- if (*argv) +- usage(); /* any args == error */ + + if (do_sync) + sync(); +- reboot(LINUX_REBOOT_CMD_CAD_OFF); /* Enable CTRL+ALT+DEL */ +- if (!reboot(cmd)) { ++ reboot(LINUX_REBOOT_CMD_CAD_OFF, NULL); /* Enable CTRL+ALT+DEL */ ++ if (!reboot(cmd, reboot_arg)) { + /* Success. Currently, CMD_HALT returns, so stop the world */ + /* kill(-1, SIGSTOP); */ + kill(getpid(), SIGSTOP); diff --git a/patches/add-riscv-rv64-port.patch b/patches/add-riscv-rv64-port.patch new file mode 100644 index 0000000..491173c --- /dev/null +++ b/patches/add-riscv-rv64-port.patch @@ -0,0 +1,315 @@ +From: Ben Hutchings +Date: Tue, 17 Jul 2018 02:55:19 +0100 +Subject: Add RISC-V (RV64) port +Forwarded: https://www.zytor.com/pipermail/klibc/2018-July/003997.html + +RISC-V is pretty boring. I've cribbed most of this from the MIPS and +AArch64 ports. + +I ran into difficulty with initialisation of the gp,register, which I +think has to be process-global - the psABI says that signal handlers +can rely on it, and they could come from any module. This means that +klibc.so and the executable using it need to agree on a single value. +Currently they don't, and this causes gp-relative addressing to go +wrong. + +gp-relative addressing is introduced by "relaxation" in the linker, +so I've disabled that for now. + +Signed-off-by: Ben Hutchings +--- +--- /dev/null ++++ b/usr/include/arch/riscv64/klibc/archconfig.h +@@ -0,0 +1,15 @@ ++/* ++ * include/arch/riscv64/klibc/archconfig.h ++ * ++ * See include/klibc/sysconfig.h for the options that can be set in ++ * this file. ++ * ++ */ ++ ++#ifndef _KLIBC_ARCHCONFIG_H ++#define _KLIBC_ARCHCONFIG_H ++ ++/* We have an MMU but no fork() syscall */ ++#define _KLIBC_NO_MMU 0 ++ ++#endif /* _KLIBC_ARCHCONFIG_H */ +--- /dev/null ++++ b/usr/include/arch/riscv64/klibc/archsetjmp.h +@@ -0,0 +1,27 @@ ++/* ++ * arch/riscv64/include/klibc/archsetjmp.h ++ */ ++ ++#ifndef _KLIBC_ARCHSETJMP_H ++#define _KLIBC_ARCHSETJMP_H ++ ++struct __jmp_buf { ++ unsigned long __pc; ++ unsigned long __s0; ++ unsigned long __s1; ++ unsigned long __s2; ++ unsigned long __s3; ++ unsigned long __s4; ++ unsigned long __s5; ++ unsigned long __s6; ++ unsigned long __s7; ++ unsigned long __s8; ++ unsigned long __s9; ++ unsigned long __s10; ++ unsigned long __s11; ++ unsigned long __sp; ++}; ++ ++typedef struct __jmp_buf jmp_buf[1]; ++ ++#endif /* _SETJMP_H */ +--- /dev/null ++++ b/usr/include/arch/riscv64/klibc/archsignal.h +@@ -0,0 +1,14 @@ ++/* ++ * arch/riscv/include/klibc/archsignal.h ++ * ++ * Architecture-specific signal definitions ++ * ++ */ ++ ++#ifndef _KLIBC_ARCHSIGNAL_H ++#define _KLIBC_ARCHSIGNAL_H ++ ++#include ++/* No special stuff for this architecture */ ++ ++#endif +--- /dev/null ++++ b/usr/include/arch/riscv64/klibc/archstat.h +@@ -0,0 +1,28 @@ ++#ifndef _KLIBC_ARCHSTAT_H ++#define _KLIBC_ARCHSTAT_H ++ ++#include ++ ++#define _STATBUF_ST_NSEC ++ ++struct stat { ++ __stdev64 (st_dev); /* Device */ ++ unsigned long st_ino; /* File serial number */ ++ unsigned int st_mode; /* File mode */ ++ unsigned int st_nlink; /* Link count */ ++ unsigned int st_uid; /* User ID of the file's owner */ ++ unsigned int st_gid; /* Group ID of the file's group */ ++ __stdev64 (st_rdev); /* Device number, if device */ ++ unsigned long __pad1; ++ long st_size; /* Size of file, in bytes */ ++ int st_blksize; /* Optimal block size for I/O */ ++ int __pad2; ++ long st_blocks; /* Number 512-byte blocks allocated */ ++ struct timespec st_atim; /* Time of last access */ ++ struct timespec st_mtim; /* Time of last modification */ ++ struct timespec st_ctim; /* Time of last status change */ ++ unsigned int __unused4; ++ unsigned int __unused5; ++}; ++ ++#endif +--- /dev/null ++++ b/usr/include/arch/riscv64/machine/asm.h +@@ -0,0 +1,26 @@ ++/* ++ * arch/riscv64/include/machine/asm.h ++ * ++ * Mostly cribbed from mips. ++ */ ++ ++#ifndef _MACHINE_ASM_H ++#define _MACHINE_ASM_H ++ ++/* ++ * ENTRY - declare entry point ++ */ ++#define ENTRY(symbol) \ ++ .globl symbol; \ ++ .align 2; \ ++ .type symbol, @function; \ ++symbol: ++ ++/* ++ * END - mark end of function ++ */ ++#define END(function) \ ++ .size function, . - function ++ ++ ++#endif /* _MACHINE_ASM_H */ +--- /dev/null ++++ b/usr/klibc/arch/riscv64/Kbuild +@@ -0,0 +1,8 @@ ++# -*- makefile -*- ++# ++# klibc files for riscv64 ++ ++always := crt0.o ++targets := crt0.o ++ ++klib-y := setjmp.o syscall.o +--- /dev/null ++++ b/usr/klibc/arch/riscv64/MCONFIG +@@ -0,0 +1,22 @@ ++# -*- makefile -*- ++# ++# arch/riscv64/MCONFIG ++# ++# Special rules for this architecture. Note that this is actually ++# included from the main Makefile, and that pathnames should be ++# accordingly. ++# ++ ++# We should get klibc.so and the executables to agree on what gp ++# should be. For now, disable gp-relative addressing. ++KLIBCLDFLAGS = --no-relax ++KLIBCOPTFLAGS += -Os -fomit-frame-pointer ++ifeq ($(DEBUG),y) ++KLIBCOPTFLAGS += -g ++endif ++KLIBCBITSIZE = 64 ++ ++# Normal binaries start at 64 KB, so start the libary at 2 MB. ++KLIBCSHAREDFLAGS =-Ttext 0x00200200 ++ ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/riscv/include +--- /dev/null ++++ b/usr/klibc/arch/riscv64/crt0.S +@@ -0,0 +1,22 @@ ++# ++# arch/riscv64/crt0.S ++# ++# Does arch-specific initialization and invokes __libc_init ++# with the appropriate arguments. ++# ++# See __static_init.c or __shared_init.c for the expected ++# arguments. ++# ++ ++#include ++ ++ENTRY(_start) ++ .option push ++ .option norelax ++ lla gp, __global_pointer$ ++ .option pop ++ ++ mv a0, sp # Pointer to ELF entry structure ++ mv a1, zero # No onexit pointer ++ jal __libc_init ++END(_start) +--- /dev/null ++++ b/usr/klibc/arch/riscv64/setjmp.S +@@ -0,0 +1,50 @@ ++/* ++ * arch/riscv64/setjmp.S ++ * ++ * setjmp/longjmp for the RISC-V (RV64) architecture ++ * ++ * The jmp_buf is assumed to contain the following, in order: ++ * pc (ra) ++ * s0..s11 ++ * sp ++ */ ++ ++#include ++ ++ENTRY(setjmp) ++ sd ra, 0(a0) ++ sd s0, 8(a0) ++ sd s1, 16(a0) ++ sd s2, 24(a0) ++ sd s3, 32(a0) ++ sd s4, 40(a0) ++ sd s5, 48(a0) ++ sd s6, 56(a0) ++ sd s7, 64(a0) ++ sd s8, 72(a0) ++ sd s9, 80(a0) ++ sd s10, 88(a0) ++ sd s11, 96(a0) ++ sd sp, 104(a0) ++ mv a0, zero ++ jr ra ++END(setjmp) ++ ++ENTRY(longjmp) ++ ld ra, 0(a0) ++ ld s0, 8(a0) ++ ld s1, 16(a0) ++ ld s2, 24(a0) ++ ld s3, 32(a0) ++ ld s4, 40(a0) ++ ld s5, 48(a0) ++ ld s6, 56(a0) ++ ld s7, 64(a0) ++ ld s8, 72(a0) ++ ld s9, 80(a0) ++ ld s10, 88(a0) ++ ld s11, 96(a0) ++ ld sp, 104(a0) ++ mv a0, a1 ++ jr ra ++END(longjmp) +--- /dev/null ++++ b/usr/klibc/arch/riscv64/syscall.S +@@ -0,0 +1,13 @@ ++#include ++#include ++ ++ENTRY(__syscall_common) ++ scall ++ li t0, -4096 ++ bleu a0, t0, 1f ++ neg a0, a0 ++ lui t0, %hi(errno) ++ sw a0, %lo(errno)(t0) ++ li a0, -1 ++1: jr ra ++END(__syscall_common) +--- /dev/null ++++ b/usr/klibc/arch/riscv64/sysstub.ph +@@ -0,0 +1,26 @@ ++# -*- perl -*- ++# ++# arch/riscv/sysstub.ph ++# ++# Script to generate system call stubs ++# ++ ++# On RISC-V, most system calls follow the standard convention, with the ++# system call number in x17 (a7) and the return value in x10 (a0). ++ ++sub make_sysstub($$$$$@) { ++ my($outputdir, $fname, $type, $sname, $stype, @args) = @_; ++ ++ $stype = $stype || 'common'; ++ open(OUT, '>', "${outputdir}/${fname}.S"); ++ print OUT "#include \n"; ++ print OUT "#include \n"; ++ print OUT "\n"; ++ print OUT "ENTRY(${fname})\n"; ++ print OUT "\tli\ta7, __NR_${sname}\n"; ++ print OUT "\tj\t__syscall_${stype}\n"; ++ print OUT "END(${fname})\n"; ++ close(OUT); ++} ++ ++1; +--- a/usr/klibc/SYSCALLS.def ++++ b/usr/klibc/SYSCALLS.def +@@ -21,7 +21,7 @@ void _exit,exit::_exit(int); + pid_t clone::__clone(unsigned long, void *); + pid_t clone::__clone2(unsigned long, void *, void *); + # if ! _KLIBC_NO_MMU +- pid_t fork(); ++ pid_t fork(); + pid_t fork@forkish(); + #endif + #if _KLIBC_REAL_VFORK diff --git a/patches/broadcast_dhcp_send.patch b/patches/broadcast_dhcp_send.patch new file mode 100644 index 0000000..e307900 --- /dev/null +++ b/patches/broadcast_dhcp_send.patch @@ -0,0 +1,39 @@ +From: Mathieu Trudel-Lapierre +Subject: Set broadcast when sending DHCPREQUEST and DHCPDISCOVER +Bug-Debian: https://bugs.debian.org/733988 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1327412 + +We need to do this, since our devices are probably not configured yet and +there may be more than one device we're trying to do DHCP on on the same +network. Otherwise, things might be dropped. + +Patch is originally from here: +https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1327412/comments/5 +... but the reporter "patpat" has not provided contact information, and +this is independently verifiable by looking at RFC 2131, section 4.1, +page 24. + +--- + usr/kinit/ipconfig/dhcp_proto.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +Index: b/usr/kinit/ipconfig/dhcp_proto.c +=================================================================== +--- a/usr/kinit/ipconfig/dhcp_proto.c ++++ b/usr/kinit/ipconfig/dhcp_proto.c +@@ -201,8 +201,14 @@ static int dhcp_send(struct netdev *dev, + bootp.hlen = dev->hwlen; + bootp.xid = dev->bootp.xid; + bootp.ciaddr = INADDR_ANY; +- bootp.yiaddr = dev->ip_addr; ++ /* yiaddr should always be set to 0 for the messages we're likely ++ * to send as a DHCP client: DHCPDISCOVER, DHCPREQUEST, DHCPDECLINE, ++ * DHCPINFORM, DHCPRELEASE ++ * cf. RFC2131 section 4.1.1, table 5. ++ */ ++ bootp.yiaddr = INADDR_ANY; + bootp.giaddr = INADDR_ANY; ++ bootp.flags = htons(0x8000); + bootp.secs = htons(time(NULL) - dev->open_time); + memcpy(bootp.chaddr, dev->hwaddr, 16); + diff --git a/patches/dash-mkbuiltins-fix-sort-order-harder.patch b/patches/dash-mkbuiltins-fix-sort-order-harder.patch new file mode 100644 index 0000000..0071611 --- /dev/null +++ b/patches/dash-mkbuiltins-fix-sort-order-harder.patch @@ -0,0 +1,21 @@ +From: Ben Hutchings +Date: Wed, 09 Sep 2015 02:12:40 +0100 +Subject: 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 +--- +--- a/usr/dash/mkbuiltins ++++ b/usr/dash/mkbuiltins +@@ -78,7 +78,7 @@ awk '{ for (i = 2 ; i <= NF ; i++) { + if ($i ~ /^-/) + line = $(++i) "\t" line + print line +- }}' $temp | LC_COLLATE=C sort -k 1,1 | tee $temp2 | awk '{ ++ }}' $temp | LC_ALL=C sort -k 1,1 | tee $temp2 | awk '{ + opt = "" + if (NF > 2) { + opt = substr($2, 2) diff --git a/patches/dhcp-one-socket-per-interface.patch b/patches/dhcp-one-socket-per-interface.patch new file mode 100644 index 0000000..9267bc9 --- /dev/null +++ b/patches/dhcp-one-socket-per-interface.patch @@ -0,0 +1,273 @@ +Author: Jay Vosburgh +Description: Use separate sockets for DHCP from multiple interfaces + Previously ipconfig would use a single multiplexed packet socket to listen + for DHCP responses on multiple interfaces. This fails if the interface that + responds is not the first one enumerated by the kernel, because ipconfig + looks for responses in interface order and is throwing them away if they're + not a proper match. + . + Fix this by using a separate socket for each interface so that each response + is processed in a correct context. +Bug-Debian: http://bugs.debian.org/852480 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1652348 +Forwarded: https://www.zytor.com/pipermail/klibc/2017-February/003945.html + +diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c +index 7be2a1fcb5af..e00f049173fb 100644 +--- a/usr/kinit/ipconfig/main.c ++++ b/usr/kinit/ipconfig/main.c +@@ -30,6 +30,7 @@ static unsigned int default_caps = CAP_DHCP | CAP_BOOTP | CAP_RARP; + static int loop_timeout = -1; + static int configured; + static int bringup_first = 0; ++static int n_devices = 0; + + /* DHCP vendor class identifier */ + char vendor_class_identifier[260]; +@@ -220,6 +221,7 @@ static void complete_device(struct netdev *dev) + configure_device(dev); + dump_device_config(dev); + print_device_config(dev); ++ packet_close(dev); + + ++configured; + +@@ -374,34 +376,35 @@ struct netdev *ifaces; + * 0 = No dhcp/bootp packet was received + * 1 = A packet was received and handled + */ +-static int do_pkt_recv(int pkt_fd, time_t now) ++static int do_pkt_recv(int nr, struct pollfd *fds, time_t now) + { +- int ret = 0; ++ int i, ret = 0; + struct state *s; + +- for (s = slist; s; s = s->next) +- ret |= process_receive_event(s, now); ++ for (i = 0, s = slist; s && nr; s = s->next, i++) { ++ if (fds[i].revents & POLLRDNORM) { ++ ret |= process_receive_event(s, now); ++ nr--; ++ } ++ } + return ret; + } + + static int loop(void) + { +-#define NR_FDS 1 +- struct pollfd fds[NR_FDS]; ++ struct pollfd *fds; + struct state *s; +- int pkt_fd; +- int nr = 0, rc = 0; ++ int i, nr = 0, rc = 0; + struct timeval now, prev; + time_t start; + +- pkt_fd = packet_open(); +- if (pkt_fd == -1) { +- perror("packet_open"); +- return -1; ++ fds = malloc(sizeof(struct pollfd) * n_devices); ++ if (!fds) { ++ fprintf(stderr, "malloc failed\n"); ++ goto bail; + } + +- fds[0].fd = pkt_fd; +- fds[0].events = POLLRDNORM; ++ memset(fds, 0, sizeof(*fds)); + + gettimeofday(&now, NULL); + start = now.tv_sec; +@@ -412,9 +415,12 @@ static int loop(void) + int timeout_ms; + int x; + +- for (s = slist; s; s = s->next) { ++ for (i = 0, s = slist; s; s = s->next, i++) { + dprintf("%s: state = %d\n", s->dev->name, s->state); + ++ fds[i].fd = s->dev->pkt_fd; ++ fds[i].events = POLLRDNORM; ++ + if (s->state == DEVST_COMPLETE) { + done++; + continue; +@@ -442,14 +448,12 @@ static int loop(void) + if (timeout_ms <= 0) + timeout_ms = 100; + +- nr = poll(fds, NR_FDS, timeout_ms); ++ nr = poll(fds, n_devices, timeout_ms); + prev = now; + gettimeofday(&now, NULL); + +- if ((nr > 0) && (fds[0].revents & POLLRDNORM)) { +- if (do_pkt_recv(pkt_fd, now.tv_sec) == 1) +- break; +- } ++ if ((nr > 0) && do_pkt_recv(nr, fds, now.tv_sec)) ++ break; + + if (loop_timeout >= 0 && + now.tv_sec - start >= loop_timeout) { +@@ -468,8 +472,8 @@ static int loop(void) + } + } + bail: +- packet_close(); +- ++ if (fds) ++ free(fds); + return rc; + } + +@@ -498,6 +502,8 @@ static int add_one_dev(struct netdev *dev) + state->next = slist; + slist = state; + ++ n_devices++; ++ + return 0; + } + +@@ -675,6 +681,9 @@ static struct netdev *add_device(const char *info) + if (bootp_init_if(dev) == -1) + goto bail; + ++ if (packet_open(dev) == -1) ++ goto bail; ++ + printf("IP-Config: %s hardware address", dev->name); + for (i = 0; i < dev->hwlen; i++) + printf("%c%02x", i == 0 ? ' ' : ':', dev->hwaddr[i]); +diff --git a/usr/kinit/ipconfig/netdev.h b/usr/kinit/ipconfig/netdev.h +index cd853b6c078b..4b75a65ad067 100644 +--- a/usr/kinit/ipconfig/netdev.h ++++ b/usr/kinit/ipconfig/netdev.h +@@ -45,6 +45,7 @@ struct netdev { + char filename[FNLEN]; /* filename */ + char *domainsearch; /* decoded, NULL or malloc-ed */ + long uptime; /* when complete configuration */ ++ int pkt_fd; /* packet socket for this interface */ + struct netdev *next; /* next configured i/f */ + }; + +diff --git a/usr/kinit/ipconfig/packet.c b/usr/kinit/ipconfig/packet.c +index 446073aba2ae..200180109f2d 100644 +--- a/usr/kinit/ipconfig/packet.c ++++ b/usr/kinit/ipconfig/packet.c +@@ -1,3 +1,4 @@ ++#include /*XXX*/ + /* + * Packet socket handling glue. + */ +@@ -20,17 +21,13 @@ + #include "netdev.h" + #include "packet.h" + +-static int pkt_fd = -1; +- + uint16_t cfg_local_port = LOCAL_PORT; + uint16_t cfg_remote_port = REMOTE_PORT; + +-int packet_open(void) ++int packet_open(struct netdev *dev) + { +- int fd, one = 1; +- +- if (pkt_fd != -1) +- return pkt_fd; ++ struct sockaddr_ll sll; ++ int fd, rv, one = 1; + + /* + * Get a PACKET socket for IP traffic. +@@ -48,18 +45,28 @@ int packet_open(void) + sizeof(one)) == -1) { + perror("SO_BROADCAST"); + close(fd); +- fd = -1; ++ return -1; + } + +- pkt_fd = fd; ++ memset(&sll, 0, sizeof(sll)); ++ sll.sll_family = AF_PACKET; ++ sll.sll_ifindex = dev->ifindex; ++ ++ rv = bind(fd, (struct sockaddr *)&sll, sizeof(sll)); ++ if (-1 == rv) { ++ perror("bind"); ++ close(fd); ++ return -1; ++ } + ++ dev->pkt_fd = fd; + return fd; + } + +-void packet_close(void) ++void packet_close(struct netdev *dev) + { +- close(pkt_fd); +- pkt_fd = -1; ++ close(dev->pkt_fd); ++ dev->pkt_fd = -1; + } + + static unsigned int ip_checksum(uint16_t *hdr, int len) +@@ -163,7 +170,7 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len) + + dprintf("\n bytes %d\n", len); + +- return sendmsg(pkt_fd, &msg, 0); ++ return sendmsg(dev->pkt_fd, &msg, 0); + } + + void packet_discard(struct netdev *dev) +@@ -174,7 +181,7 @@ void packet_discard(struct netdev *dev) + + sll.sll_ifindex = dev->ifindex; + +- recvfrom(pkt_fd, &iph, sizeof(iph), 0, ++ recvfrom(dev->pkt_fd, &iph, sizeof(iph), 0, + (struct sockaddr *)&sll, &sllen); + } + +@@ -207,7 +214,7 @@ int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len) + msg.msg_name = &sll; + msg.msg_namelen = sllen; + +- ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), ++ ret = recvfrom(dev->pkt_fd, &iph, sizeof(struct iphdr), + MSG_PEEK, (struct sockaddr *)&sll, &sllen); + if (ret == -1) + return -1; +@@ -226,7 +233,7 @@ int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len) + iov[0].iov_base = ip; + iov[0].iov_len = iphl + sizeof(struct udphdr); + +- ret = recvmsg(pkt_fd, &msg, 0); ++ ret = recvmsg(dev->pkt_fd, &msg, 0); + if (ret == -1) + goto free_pkt; + +diff --git a/usr/kinit/ipconfig/packet.h b/usr/kinit/ipconfig/packet.h +index f6cef5210958..4367efe1428e 100644 +--- a/usr/kinit/ipconfig/packet.h ++++ b/usr/kinit/ipconfig/packet.h +@@ -3,8 +3,8 @@ + + struct iovec; + +-int packet_open(void); +-void packet_close(void); ++int packet_open(struct netdev *dev); ++void packet_close(struct netdev *dev); + int packet_send(struct netdev *dev, struct iovec *iov, int iov_len); + void packet_discard(struct netdev *dev); + int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len); diff --git a/patches/disable-pie.patch b/patches/disable-pie.patch new file mode 100644 index 0000000..ab0b401 --- /dev/null +++ b/patches/disable-pie.patch @@ -0,0 +1,22 @@ +From: Ben Hutchings +Date: Sun, 06 Jan 2019 03:44:40 +0000 +Subject: [klibc] Disable PIE + +We link all executables as non-relocatable, so it makes no sense to +generate PIE code. In addition, PIE code on i386 requires a working +GOT which we don't generate. + +Signed-off-by: Ben Hutchings +--- +--- a/scripts/Kbuild.klibc ++++ b/scripts/Kbuild.klibc +@@ -67,7 +67,8 @@ include $(srctree)/scripts/Kbuild.includ + # --------------------------------------------------------------------------- + + KLIBCREQFLAGS := $(call cc-option, -fno-stack-protector, ) \ +- $(call cc-option, -fwrapv, ) ++ $(call cc-option, -fwrapv, ) \ ++ $(call cc-option, -fno-PIE, ) + KLIBCARCHREQFLAGS := + KLIBCOPTFLAGS := + KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter diff --git a/patches/gzip-fix-silent-fallback-to-decompression.patch b/patches/gzip-fix-silent-fallback-to-decompression.patch new file mode 100644 index 0000000..e3ec327 --- /dev/null +++ b/patches/gzip-fix-silent-fallback-to-decompression.patch @@ -0,0 +1,85 @@ +From: Ben Hutchings +Date: Fri, 18 Sep 2015 21:59:17 +0200 +Subject: 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 +--- +--- a/usr/gzip/gzip.c ++++ b/usr/gzip/gzip.c +@@ -90,8 +90,11 @@ int level = 6; /* compression lev + #endif + + int to_stdout; /* output to stdout (-c) */ +-#ifndef decompress ++#ifdef decompress ++int decompress_wanted; ++#else + int decompress; /* decompress (-d) */ ++#define decompress_wanted decompress + #endif + int force; /* don't ask questions, compress links (-f) */ + int no_name = -1; /* don't save or restore the original file name */ +@@ -259,17 +262,13 @@ int main (argc, argv) + * Systems which do not support links can still use -d or -dc. + * Ignore an .exe extension for MSDOS, OS/2 and VMS. + */ +-#ifndef decompress + if ( strncmp(progname, "un", 2) == 0 /* ungzip, uncompress */ + || strncmp(progname, "gun", 3) == 0) { /* gunzip */ +- decompress = 1; ++ decompress_wanted = 1; + } +-#endif + if (strequ(progname+1, "cat") /* zcat, pcat, gcat */ + || strequ(progname, "gzcat")) { /* gzcat */ +-#ifndef decompress +- decompress = 1; +-#endif ++ decompress_wanted = 1; + to_stdout = 1; + } + #endif +@@ -282,9 +281,7 @@ int main (argc, argv) + case 'c': + to_stdout = 1; break; + case 'd': +-#ifndef decompress +- decompress = 1; +-#endif ++ decompress_wanted = 1; + break; + case 'f': + force++; break; +@@ -308,9 +305,7 @@ int main (argc, argv) + break; + case 't': + test = to_stdout = 1; +-#ifndef decompress +- decompress = 1; +-#endif ++ decompress_wanted = 1; + break; + case 'v': + verbose++; quiet = 0; break; +@@ -329,6 +324,14 @@ int main (argc, argv) + } + } /* loop on all arguments */ + ++#ifndef SUPPORT_ZIP ++ if (!decompress_wanted) { ++ fprintf(stderr, "%s: this version does not support compression\n", ++ progname); ++ do_exit(ERROR); ++ } ++#endif ++ + /* By default, save name and timestamp on compression but do not + * restore them on decompression. + */ diff --git a/patches/i386-use-ttext-segment-to-avoid-address-collision.patch b/patches/i386-use-ttext-segment-to-avoid-address-collision.patch new file mode 100644 index 0000000..693f09a --- /dev/null +++ b/patches/i386-use-ttext-segment-to-avoid-address-collision.patch @@ -0,0 +1,28 @@ +From: Ben Hutchings +Date: Sun, 06 Jan 2019 03:19:51 +0000 +Subject: [klibc] i386: Use -Ttext-segment to avoid address collision + +Building klibc for i386 with binutils 2.31 adds an extra +.note.gnu.property section to klibc.so, the address of which is not +affected by the -Ttext option. Loading a klibc executable then +fails with the following kernel log message: + +9409 (sh.shared): Uhuuh, elf segment at 0000000000600000 requested but the memory is mapped already + +I don't exactly see why this is happening, but it is triggered by the +new section and the collision can be avoided by passing -Ttext-segment +instead of -Ttext, similarly to x86_64. + +Signed-off-by: Ben Hutchings +--- +--- a/usr/klibc/arch/i386/MCONFIG ++++ b/usr/klibc/arch/i386/MCONFIG +@@ -30,7 +30,7 @@ KLIBCBITSIZE = 32 + # This address needs to be reachable using normal inter-module + # calls, and work on the memory models for this architecture + # 96 MB - normal binaries start at 128 MB +-KLIBCSHAREDFLAGS = -Ttext 0x06000200 ++KLIBCSHAREDFLAGS = -Ttext-segment 0x06000000 + + # Asm includes for i386 are in the merged x86 tree + KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include diff --git a/patches/ia64-build-static-tools.patch b/patches/ia64-build-static-tools.patch new file mode 100644 index 0000000..bbf07c9 --- /dev/null +++ b/patches/ia64-build-static-tools.patch @@ -0,0 +1,91 @@ +Description: Use static tools on IA64 + On IA64, the shared binaries do not work. This is a partial revert of + https://salsa.debian.org/kernel-team/klibc/commit/07809ffd86e1e4ca5a4e98e4708a1c1fae10babf +Author: Maximilian Attems , Thorsten Glaser , Frank Scheiner +Last-Update: 2018-06-06 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/usr/dash/Kbuild ++++ b/usr/dash/Kbuild +@@ -93,4 +93,8 @@ + $(Q): + + # Targets to install +-install-y := sh.shared ++ifeq ($(ARCH),ia64) ++ install-y := sh ++else ++ install-y := sh.shared ++endif +--- a/usr/kinit/fstype/Kbuild ++++ b/usr/kinit/fstype/Kbuild +@@ -22,4 +22,8 @@ + clean-dirs := static shared + + # install binary +-install-y := $(shared-y) ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) ++else ++ install-y := $(shared-y) ++endif +--- a/usr/kinit/ipconfig/Kbuild ++++ b/usr/kinit/ipconfig/Kbuild +@@ -28,4 +28,8 @@ + clean-dirs := static shared + + # install binary +-install-y := $(shared-y) ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) ++else ++ install-y := $(shared-y) ++endif +--- a/usr/kinit/nfsmount/Kbuild ++++ b/usr/kinit/nfsmount/Kbuild +@@ -24,4 +24,8 @@ + clean-dirs := static shared + + # Install binary +-install-y := $(shared-y) ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) ++else ++ install-y := $(shared-y) ++endif +--- a/usr/kinit/resume/Kbuild ++++ b/usr/kinit/resume/Kbuild +@@ -27,4 +27,8 @@ + clean-dirs := static shared + + # install binary +-install-y := $(shared-y) ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) ++else ++ install-y := $(shared-y) ++endif +--- a/usr/kinit/run-init/Kbuild ++++ b/usr/kinit/run-init/Kbuild +@@ -31,4 +31,8 @@ + clean-dirs := static shared + + # install binary +-install-y := $(shared-y) ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) ++else ++ install-y := $(shared-y) ++endif +--- a/usr/utils/Kbuild ++++ b/usr/utils/Kbuild +@@ -73,4 +73,8 @@ + clean-dirs := static shared + + # install only install the shared binaries +-install-y := $(shared-y) shared/reboot shared/poweroff ++ifeq ($(ARCH),ia64) ++ install-y := $(static-y) static/reboot static/poweroff ++else ++ install-y := $(shared-y) shared/reboot shared/poweroff ++endif diff --git a/patches/install-headers-with-consistent-mode.patch b/patches/install-headers-with-consistent-mode.patch new file mode 100644 index 0000000..fa1fa29 --- /dev/null +++ b/patches/install-headers-with-consistent-mode.patch @@ -0,0 +1,22 @@ +From: Ben Hutchings +Date: Wed, 09 Sep 2015 01:24:56 +0100 +Subject: 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 +--- +--- a/scripts/Kbuild.install ++++ b/scripts/Kbuild.install +@@ -102,7 +102,7 @@ header: + ln -sf /usr/include/$(DEB_HOST_MULTIARCH)/asm $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \ + fi + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. +- $(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include ++ $(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir) + diff --git a/patches/klibc-add-accept4-handle-fallback-from-accept-to-acc.patch b/patches/klibc-add-accept4-handle-fallback-from-accept-to-acc.patch new file mode 100644 index 0000000..783b172 --- /dev/null +++ b/patches/klibc-add-accept4-handle-fallback-from-accept-to-acc.patch @@ -0,0 +1,101 @@ +From: "H. Peter Anvin" +Date: Tue, 5 Jan 2016 18:31:40 -0800 +Subject: [klibc] Add accept4(), handle fallback from accept() to accept4() +Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit?id=cf8147c43a60d9eb6a6713d16f30364a698a6936 + +Add support for the accept4() system call. + +Some architectures now have accept4() but not accept(), so introduce a +standard fallback. However, since accept() is a socketcall, we have +to do some special hacks. + +While we are at it, handle conditional socketcall stubs based on +their existence , analogous to . + +Signed-off-by: H. Peter Anvin +--- + usr/include/sys/socket.h | 1 + + usr/klibc/Kbuild | 2 +- + usr/klibc/SOCKETCALLS.def | 1 + + usr/klibc/accept.c | 16 ++++++++++++++++ + usr/klibc/socketcalls.pl | 15 +++++++++++++-- + 5 files changed, 32 insertions(+), 3 deletions(-) + create mode 100644 usr/klibc/accept.c + +--- a/usr/include/sys/socket.h ++++ b/usr/include/sys/socket.h +@@ -251,6 +251,7 @@ __extern int bind(int, const struct sock + __extern int connect(int, const struct sockaddr *, socklen_t); + __extern int listen(int, int); + __extern int accept(int, struct sockaddr *, socklen_t *); ++__extern int accept4(int, struct sockaddr *, socklen_t *, int); + __extern int getsockname(int, struct sockaddr *, socklen_t *); + __extern int getpeername(int, struct sockaddr *, socklen_t *); + __extern int socketpair(int, int, int, int *); +--- a/usr/klibc/Kbuild ++++ b/usr/klibc/Kbuild +@@ -58,7 +58,7 @@ klib-y += vsnprintf.o snprintf.o vsprint + lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ + inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ + inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ +- send.o recv.o \ ++ accept.o send.o recv.o \ + access.o chmod.o chown.o dup2.o mknod.o poll.o rename.o stat.o \ + lchown.o link.o rmdir.o unlink.o utimes.o lstat.o mkdir.o \ + readlink.o select.o symlink.o pipe.o \ +--- a/usr/klibc/SOCKETCALLS.def ++++ b/usr/klibc/SOCKETCALLS.def +@@ -9,6 +9,7 @@ + int connect(int, const struct sockaddr *, socklen_t); + int listen(int, int); + int accept(int, struct sockaddr *, socklen_t *); ++ int accept4(int, struct sockaddr *, socklen_t *, int); + int getsockname(int, struct sockaddr *, socklen_t *); + int getpeername(int, struct sockaddr *, socklen_t *); + int socketpair(int, int, int, int *); +--- /dev/null ++++ b/usr/klibc/accept.c +@@ -0,0 +1,16 @@ ++/* ++ * pread.c ++ * ++ * Some architectures need to wrap the system call ++ */ ++ ++#include ++ ++#if !_KLIBC_SYS_SOCKETCALL && defined(__NR_accept4) && !defined(__NR_accept) ++ ++int accept(int socket, struct sockaddr *address, socklen_t *addr_len) ++{ ++ return accept4(socket, address, addr_len, 0); ++} ++ ++#endif +--- a/usr/klibc/socketcalls.pl ++++ b/usr/klibc/socketcalls.pl +@@ -47,11 +47,22 @@ while ( defined($line = ) ) { + + print OUT "#include \"socketcommon.h\"\n"; + print OUT "\n"; +- print OUT "#if _KLIBC_SYS_SOCKETCALL || !defined(__NR_${name})\n\n"; ++ print OUT "#if _KLIBC_SYS_SOCKETCALL\n"; ++ print OUT "# define DO_THIS_SOCKETCALL\n"; ++ print OUT "#else\n"; ++ print OUT "# if !defined(__NR_${name})"; ++ if ($name eq 'accept') { ++ print OUT " && !defined(__NR_accept4)"; ++ } ++ print OUT "\n# define DO_THIS_SOCKETCALL\n"; ++ print OUT "# endif\n"; ++ print OUT "#endif\n\n"; ++ ++ print OUT "#if defined(DO_THIS_SOCKETCALL) && defined(SYS_\U${name}\E)\n\n"; + + print OUT "extern long __socketcall(int, const unsigned long *);\n\n"; + +- print OUT "$type $name (", join(', ', @cargs), ")\n"; ++ print OUT "$type ${name}(", join(', ', @cargs), ")\n"; + print OUT "{\n"; + print OUT " unsigned long args[$nargs];\n"; + for ( $i = 0 ; $i < $nargs ; $i++ ) { diff --git a/patches/klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch b/patches/klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch new file mode 100644 index 0000000..3aaef92 --- /dev/null +++ b/patches/klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch @@ -0,0 +1,117 @@ +From: Helge Deller +Subject: [klibc] Add pread and pwrite 32bit syscall wrappers for parisc +Date: Wed, 23 Apr 2014 22:52:53 +0200 +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 +--- +--- a/usr/include/endian.h ++++ b/usr/include/endian.h +@@ -12,4 +12,10 @@ + #define PDP_ENDIAN __PDP_ENDIAN + #define BYTE_ORDER __BYTE_ORDER + ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define __LONG_LONG_PAIR(HI, LO) LO, HI ++#elif __BYTE_ORDER == __BIG_ENDIAN ++# define __LONG_LONG_PAIR(HI, LO) HI, LO ++#endif ++ + #endif /* _ENDIAN_H */ +--- a/usr/klibc/Kbuild ++++ b/usr/klibc/Kbuild +@@ -35,6 +35,7 @@ klib-y += vsnprintf.o snprintf.o vsprint + siglongjmp.o \ + sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ + pselect.o ppoll.o \ ++ pread.o pwrite.o \ + brk.o sbrk.o malloc.o realloc.o zalloc.o calloc.o \ + mmap.o shm_open.o shm_unlink.o \ + memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ +--- /dev/null ++++ b/usr/klibc/pread.c +@@ -0,0 +1,29 @@ ++/* ++ * pread.c ++ * ++ * Some architectures need to wrap the system call ++ */ ++ ++#include ++#include ++ ++#if defined(__hppa__) ++ ++#if _BITSIZE == 32 ++extern size_t __pread(int, void *, size_t, unsigned int, unsigned int); ++#else ++extern size_t __pread(int, void *, size_t, off_t); ++#endif ++ ++size_t pread(int fd, void *buf, size_t count, off_t offset) ++{ ++#if _BITSIZE == 32 ++ unsigned int hi = offset >> 32; ++ unsigned int lo = (unsigned int) offset; ++ return __pread(fd, buf, count, __LONG_LONG_PAIR(hi, lo)); ++#else ++ return __pread(fd, buf, count, offset); ++#endif ++} ++ ++#endif +--- /dev/null ++++ b/usr/klibc/pwrite.c +@@ -0,0 +1,29 @@ ++/* ++ * pwrite.c ++ * ++ * Some architectures need to wrap the system call ++ */ ++ ++#include ++#include ++ ++#if defined(__hppa__) ++ ++#if _BITSIZE == 32 ++extern ssize_t __pwrite(int, const void *, size_t, unsigned int, unsigned int); ++#else ++extern ssize_t __pwrite(int, const void *, size_t, off_t); ++#endif ++ ++size_t pwrite(int fd, void *buf, size_t count, off_t offset) ++{ ++#if _BITSIZE == 32 ++ unsigned int hi = offset >> 32; ++ unsigned int lo = (unsigned int) offset; ++ return __pwrite(fd, buf, count, __LONG_LONG_PAIR(hi, lo)); ++#else ++ return __pwrite(fd, buf, count, offset); ++#endif ++} ++ ++#endif +--- a/usr/klibc/SYSCALLS.def ++++ b/usr/klibc/SYSCALLS.def +@@ -189,8 +189,10 @@ int fdatasync,fsync::fdatasync(int); + int readv(int, const struct iovec *, int); + int writev(int, const struct iovec *, int); + int ftruncate64,ftruncate::ftruncate(int, off_t); +-ssize_t pread64,pread::pread(int, void *, size_t, off_t); +-ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t); ++ ssize_t pread64,pread::__pread(int, void *, size_t, off_t); ++ ssize_t pwrite64,pwrite::__pwrite(int, void *, size_t, off_t); ++ ssize_t pread64,pread::pread(int, void *, size_t, off_t); ++ ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t); + int sync_file_range,fdatasync,fsync::sync_file_range(int, off_t, off_t, unsigned int); + int splice(int, off_t *, int, off_t *, size_t, unsigned int); + int tee(int, int, size_t, unsigned int); diff --git a/patches/klibc-i386-remove-special-handling-of-socketcall.patch b/patches/klibc-i386-remove-special-handling-of-socketcall.patch new file mode 100644 index 0000000..9f8238e --- /dev/null +++ b/patches/klibc-i386-remove-special-handling-of-socketcall.patch @@ -0,0 +1,158 @@ +From: "H. Peter Anvin" +Date: Tue, 5 Jan 2016 16:43:50 -0800 +Subject: [klibc] i386: remove special handling of socketcall +Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit?id=9b625887a59c03c244b43550b576529f209dde11 + +As of kernel 4.3, i386 now has direct system calls for sockets, so +drop the special handling for i386 socketcall. If built on older +kernels, it will still generate socketcall stubs although they will be +less efficient. + +Signed-off-by: H. Peter Anvin +[bwh: Backported to 2.0.4: adjust context] +--- + usr/klibc/arch/i386/Kbuild | 2 +- + usr/klibc/arch/i386/socketcall.S | 55 ---------------------------------------- + usr/klibc/socketcalls.pl | 49 ++++++++++++----------------------- + 3 files changed, 17 insertions(+), 89 deletions(-) + delete mode 100644 usr/klibc/arch/i386/socketcall.S + +diff --git a/usr/klibc/arch/i386/Kbuild b/usr/klibc/arch/i386/Kbuild +index edc7b3ccfd65..de237becc180 100644 +--- a/usr/klibc/arch/i386/Kbuild ++++ b/usr/klibc/arch/i386/Kbuild +@@ -2,7 +2,7 @@ + # klibc .o files for i386 + # + +-klib-y := archinit.o socketcall.o setjmp.o syscall.o varsyscall.o ++klib-y := archinit.o setjmp.o syscall.o varsyscall.o + klib-y += open.o openat.o vfork.o + klib-y += libgcc/__ashldi3.o libgcc/__ashrdi3.o libgcc/__lshrdi3.o + klib-y += libgcc/__muldi3.o libgcc/__negdi2.o +diff --git a/usr/klibc/arch/i386/socketcall.S b/usr/klibc/arch/i386/socketcall.S +deleted file mode 100644 +index 44e2004d8726..000000000000 +--- a/usr/klibc/arch/i386/socketcall.S ++++ /dev/null +@@ -1,55 +0,0 @@ +-# +-# socketcall.S +-# +-# Socketcalls use the following convention: +-# %eax = __NR_socketcall +-# %ebx = socketcall number +-# %ecx = pointer to arguments (up to 6) +-# +- +-#include +- +-#ifdef __i386__ +- +- .text +- .align 4 +- .globl __socketcall_common +- .type __socketcall_common, @function +- +-__socketcall_common: +- xchgl %ebx,(%esp) # The stub passes the socketcall # on stack +- +-#ifdef _REGPARM +- pushl 16(%esp) # Arg 6 +- pushl 16(%esp) # Arg 5 +- pushl 16(%esp) # Arg 4 +- pushl %ecx +- pushl %edx +- pushl %eax +- movl %esp,%ecx +-#else +- leal 8(%esp),%ecx # Arguments already contiguous on-stack +-#endif +- +- movl $__NR_socketcall,%eax +- call *__syscall_entry +- +-#ifdef _REGPARM +- addl $6*4, %esp +-#endif +- +- cmpl $-4095,%eax # Error return? +- +- popl %ebx +- +- jb 1f +- +- negl %eax +- movl %eax,errno +- orl $-1,%eax # Return -1 +-1: +- ret +- +- .size __socketcall_common,.-__socketcall_common +- +-#endif +diff --git a/usr/klibc/socketcalls.pl b/usr/klibc/socketcalls.pl +index 3dac096a9903..9df5949417a7 100644 +--- a/usr/klibc/socketcalls.pl ++++ b/usr/klibc/socketcalls.pl +@@ -42,44 +42,27 @@ while ( defined($line = ) ) { + $nargs = $i; + print " \\\n\t${name}.o"; + +- if ( $arch eq 'i386' ) { +- open(OUT, "> ${outputdir}/${name}.S") +- or die "$0: Cannot open ${outputdir}/${name}.S\n"; ++ open(OUT, "> ${outputdir}/${name}.c") ++ or die "$0: Cannot open ${outputdir}/${name}.c\n"; + +- print OUT "#include \n"; +- print OUT "\n"; +- print OUT "\t.text\n"; +- print OUT "\t.align 4\n"; +- print OUT "\t.globl ${name}\n"; +- print OUT "\t.type ${name},\@function\n"; +- print OUT "${name}:\n"; +- print OUT "\tpushl \$SYS_\U${name}\n"; +- print OUT "\tjmp __socketcall_common\n"; +- print OUT "\t.size ${name},.-${name}\n"; +- close(OUT); +- } else { +- open(OUT, "> ${outputdir}/${name}.c") +- or die "$0: Cannot open ${outputdir}/${name}.c\n"; +- +- print OUT "#include \"socketcommon.h\"\n"; +- print OUT "\n"; +- print OUT "#if _KLIBC_SYS_SOCKETCALL || !defined(__NR_${name})\n\n"; ++ print OUT "#include \"socketcommon.h\"\n"; ++ print OUT "\n"; ++ print OUT "#if _KLIBC_SYS_SOCKETCALL || !defined(__NR_${name})\n\n"; + +- print OUT "extern long __socketcall(int, const unsigned long *);\n\n"; ++ print OUT "extern long __socketcall(int, const unsigned long *);\n\n"; + +- print OUT "$type $name (", join(', ', @cargs), ")\n"; +- print OUT "{\n"; +- print OUT " unsigned long args[$nargs];\n"; +- for ( $i = 0 ; $i < $nargs ; $i++ ) { +- print OUT " args[$i] = (unsigned long)a$i;\n"; +- } +- print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n"; +- print OUT "}\n\n"; ++ print OUT "$type $name (", join(', ', @cargs), ")\n"; ++ print OUT "{\n"; ++ print OUT " unsigned long args[$nargs];\n"; ++ for ( $i = 0 ; $i < $nargs ; $i++ ) { ++ print OUT " args[$i] = (unsigned long)a$i;\n"; ++ } ++ print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n"; ++ print OUT "}\n\n"; + +- print OUT "#endif\n"; ++ print OUT "#endif\n"; + +- close(OUT); +- } ++ close(OUT); + } else { + die "$file:$.: Could not parse input\n"; + } diff --git a/patches/klibc-linux-libc-dev b/patches/klibc-linux-libc-dev new file mode 100644 index 0000000..593317c --- /dev/null +++ b/patches/klibc-linux-libc-dev @@ -0,0 +1,46 @@ +From: Ben Hutchings +Date: Sun, 14 Mar 2010 18:41:56 +0000 +Subject: Fix klibc Debian specific build trouble +Forwarded: https://www.zytor.com/pipermail/klibc/2010-March/002524.html + +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 + +int main(void) +{ + write(1, "Hello world\n", 12); + return 0; +} + +Signed-off-by: Ben Hutchings +[ added multi arch support ] +Signed-off-by: Colin Watson +Signed-off-by: maximilian attems +[ fixed cross building ] +Signed-off-by: Marcin Juszkiewicz +--- +Index: klibc-2.0~rc2/scripts/Kbuild.install +=================================================================== +--- klibc-2.0~rc2.orig/scripts/Kbuild.install 2012-02-11 18:50:21.000000000 +0000 ++++ klibc-2.0~rc2/scripts/Kbuild.install 2012-02-11 19:04:52.000000000 +0000 +@@ -95,7 +95,12 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install ++ $(Q)for x in /usr/include/linux /usr/include/asm*; do \ ++ ln -s $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \ ++ done ++ $(Q)if [ -n "$(DEB_HOST_MULTIARCH)" ]; then \ ++ ln -sf /usr/include/$(DEB_HOST_MULTIARCH)/asm $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \ ++ fi + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + diff --git a/patches/klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch b/patches/klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch new file mode 100644 index 0000000..90e59c7 --- /dev/null +++ b/patches/klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch @@ -0,0 +1,55 @@ +From: YunQiang Su +Date: Sat Sep 5 06:39:25 PDT 2015 +Subject: [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. +--- + usr/klibc/arch/mips/setjmp.S | 24 ------------------------ + 1 file changed, 24 deletions(-) + +--- a/usr/klibc/arch/mips/setjmp.S ++++ b/usr/klibc/arch/mips/setjmp.S +@@ -29,18 +29,6 @@ LEAF(setjmp) + sw s8, 40(a0) + sw ra, 44(a0) + cfc1 t0,$31 +- swc1 $f20,48(a0) +- swc1 $f21,52(a0) +- swc1 $f22,56(a0) +- swc1 $f23,60(a0) +- swc1 $f24,64(a0) +- swc1 $f25,68(a0) +- swc1 $f26,72(a0) +- swc1 $f27,76(a0) +- swc1 $f28,80(a0) +- swc1 $f29,84(a0) +- swc1 $f30,88(a0) +- swc1 $f31,92(a0) + sw t0,96(a0) + move v0,zero + jr ra +@@ -61,18 +49,6 @@ LEAF(longjmp) + lw s8, 40(a0) + lw ra, 44(a0) + lw t0, 96(a0) +- lwc1 $f20,48(a0) +- lwc1 $f21,52(a0) +- lwc1 $f22,56(a0) +- lwc1 $f23,60(a0) +- lwc1 $f24,64(a0) +- lwc1 $f25,68(a0) +- lwc1 $f26,72(a0) +- lwc1 $f27,76(a0) +- lwc1 $f28,80(a0) +- lwc1 $f29,84(a0) +- lwc1 $f30,88(a0) +- lwc1 $f31,92(a0) + ctc1 t0,$31 + move v0,a1 + jr ra diff --git a/patches/klibc-ppc64-fix-struct-stat.patch b/patches/klibc-ppc64-fix-struct-stat.patch new file mode 100644 index 0000000..677ee90 --- /dev/null +++ b/patches/klibc-ppc64-fix-struct-stat.patch @@ -0,0 +1,30 @@ +From: Aurelien Jarno +Date: Sat, 25 Apr 2015 14:16:16 +0200 +Subject: [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 +--- + usr/include/arch/ppc64/klibc/archstat.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/usr/include/arch/ppc64/klibc/archstat.h ++++ b/usr/include/arch/ppc64/klibc/archstat.h +@@ -12,6 +12,7 @@ struct stat { + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; ++ unsigned int __pad1; + __stdev64 (st_rdev); + off_t st_size; + unsigned long st_blksize; diff --git a/patches/mips-update-archfcntl-h.patch b/patches/mips-update-archfcntl-h.patch new file mode 100644 index 0000000..0ce5b91 --- /dev/null +++ b/patches/mips-update-archfcntl-h.patch @@ -0,0 +1,65 @@ +From: Ben Hutchings +Date: Sun, 05 Oct 2014 01:08:21 +0100 +Subject: [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 +--- +--- a/usr/include/arch/mips/klibc/archfcntl.h ++++ b/usr/include/arch/mips/klibc/archfcntl.h +@@ -19,7 +19,6 @@ + #define O_WRONLY 0x0001 + #define O_RDWR 0x0002 + #define O_APPEND 0x0008 +-#define O_SYNC 0x0010 + #define O_NONBLOCK 0x0080 + #define O_CREAT 0x0100 + #define O_TRUNC 0x0200 +@@ -27,11 +26,14 @@ + #define O_NOCTTY 0x0800 + #define FASYNC 0x1000 + #define O_LARGEFILE 0x2000 ++#define O_SYNC 0x4010 + #define O_DIRECT 0x8000 + #define O_DIRECTORY 0x10000 + #define O_NOFOLLOW 0x20000 + #define O_NOATIME 0x40000 + #define O_CLOEXEC 0x80000 ++#define O_PATH 0x200000 ++#define O_TMPFILE 0x410000 + + #define O_NDELAY O_NONBLOCK + +@@ -53,6 +55,24 @@ + #define F_SETLK64 34 + #define F_SETLKW64 35 + ++#define F_SETOWN_EX 15 ++#define F_GETOWN_EX 16 ++ ++#define F_GETOWNER_UIDS 17 ++ ++#define F_OFD_GETLK 36 ++#define F_OFD_SETLK 37 ++#define F_OFD_SETLKW 38 ++ ++#define F_OWNER_TID 0 ++#define F_OWNER_PID 1 ++#define F_OWNER_PGRP 2 ++ ++struct f_owner_ex { ++ int type; ++ pid_t pid; ++}; ++ + #define FD_CLOEXEC 1 + + #define F_RDLCK 0 diff --git a/patches/mips64-compile-with-mno-abicalls.patch b/patches/mips64-compile-with-mno-abicalls.patch new file mode 100644 index 0000000..8d38db3 --- /dev/null +++ b/patches/mips64-compile-with-mno-abicalls.patch @@ -0,0 +1,48 @@ +From: James Cowgill +Date: Fri, 2 Mar 2018 14:48:21 +0000 +Subject: mips64: compile with -mno-abicalls +Forwarded: https://www.zytor.com/pipermail/klibc/2018-March/003985.html +Bug-Debian: https://bugs.debian.org/891924 + +By default, the MIPS toolchain compiles all code as PIC. Since klibc +links everything at static addresses, we don't need PIC code so use +-mno-abicalls to disable it. To fix subsequent link errors, use +-Ttext-segment to adjust the base address of klibc to a more sensible +location. + +This fixes a bug in the shared library form of klibc where programs +would segfault in the syscall handler because we tried to store into the +"errno" variable without setting up the gp register. This is only required +under the PIC ABI. + +Signed-off-by: James Cowgill +--- + usr/klibc/arch/mips64/MCONFIG | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/usr/klibc/arch/mips64/MCONFIG b/usr/klibc/arch/mips64/MCONFIG +index b37cc6a7..6a4b41b2 100644 +--- a/usr/klibc/arch/mips64/MCONFIG ++++ b/usr/klibc/arch/mips64/MCONFIG +@@ -7,7 +7,17 @@ + # accordingly. + # + ++KLIBCARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 + KLIBCOPTFLAGS += -Os + KLIBCBITSIZE = 64 + +-KLIBCSHAREDFLAGS = -T $(src)/arch/mips/klibc.ld ++# Extra linkflags when building the shared version of the library ++# This address needs to be reachable using normal inter-module ++# calls, and work on the memory models for this architecture ++# 4862 MB - normal binaries start at 4608 MB. Non-PIC jumps usually ++# use the JAL instruction which requires a destination within the same ++# 256M aligned region. Since we can't put ourselves below the normal ++# load address, use the very top of the 256M region (minus 2MB) ++# ++# Use -Ttext-segment so that the special .MIPS* sections are moved as well. ++KLIBCSHAREDFLAGS = -Ttext-segment 0x12FE00000 +-- +2.16.2 + diff --git a/patches/mount-implement-o-defaults.patch b/patches/mount-implement-o-defaults.patch new file mode 100644 index 0000000..8f73692 --- /dev/null +++ b/patches/mount-implement-o-defaults.patch @@ -0,0 +1,29 @@ +From: Ben Hutchings +Date: Sat, 4 Oct 2014 16:32:39 +0100 +Subject: 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 +--- +--- a/usr/utils/mount_opts.c ++++ b/usr/utils/mount_opts.c +@@ -89,8 +89,13 @@ parse_mount_options(char *arg, unsigned + break; + } + +- if (res != 0 && s[0]) +- add_extra_option(extra, opt); ++ if (res != 0 && s[0]) { ++ if (!strcmp(opt, "defaults")) ++ rwflag &= ~(MS_RDONLY|MS_NOSUID|MS_NODEV| ++ MS_NOEXEC|MS_SYNCHRONOUS); ++ else ++ add_extra_option(extra, opt); ++ } + } + + return rwflag; diff --git a/patches/mount_main-Fix-empty-string-check.patch b/patches/mount_main-Fix-empty-string-check.patch new file mode 100644 index 0000000..5d35c65 --- /dev/null +++ b/patches/mount_main-Fix-empty-string-check.patch @@ -0,0 +1,49 @@ +From b36ed959bf051b23785cc988d2f4f73c55a793ff Mon Sep 17 00:00:00 2001 +From: Benjamin Drung +Date: Wed, 13 Jun 2018 11:48:39 +0200 +Subject: [PATCH] mount_main: Fix empty string check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Forwarded: https://www.zytor.com/pipermail/klibc/2018-June/003993.html + +gcc 7.3.0 complains: + +``` +usr/utils/mount_main.c: In function ‘print_mount’: +usr/utils/mount_main.c:46:46: warning: comparison between pointer and zero character constant [-Wpointer-compare] + if (mnt->mnt_type != NULL && mnt->mnt_type != '\0') + ^~ +usr/utils/mount_main.c:46:32: note: did you mean to dereference the pointer? + if (mnt->mnt_type != NULL && mnt->mnt_type != '\0') + ^ +usr/utils/mount_main.c:48:46: warning: comparison between pointer and zero character constant [-Wpointer-compare] + if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0') + ^~ +usr/utils/mount_main.c:48:32: note: did you mean to dereference the pointer? + if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0') + ^ +``` +--- + usr/utils/mount_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/usr/utils/mount_main.c b/usr/utils/mount_main.c +index ab3cb718..0d299c43 100644 +--- a/usr/utils/mount_main.c ++++ b/usr/utils/mount_main.c +@@ -43,9 +43,9 @@ static __noreturn print_mount(char *type) + if (type && mnt->mnt_type && strcmp(type, mnt->mnt_type)) + continue; + printf("%s on %s", mnt->mnt_fsname, mnt->mnt_dir); +- if (mnt->mnt_type != NULL && mnt->mnt_type != '\0') ++ if (mnt->mnt_type != NULL && *mnt->mnt_type != '\0') + printf(" type %s", mnt->mnt_type); +- if (mnt->mnt_opts != NULL && mnt->mnt_opts != '\0') ++ if (mnt->mnt_opts != NULL && *mnt->mnt_opts != '\0') + printf(" (%s)", mnt->mnt_opts); + printf("\n"); + } +-- +2.17.1 + diff --git a/patches/multiarch-include-path b/patches/multiarch-include-path new file mode 100644 index 0000000..8cf2e2a --- /dev/null +++ b/patches/multiarch-include-path @@ -0,0 +1,40 @@ +Description: Include the multiarch include directory in klcc's path + The multiarch include directory, /usr/include/, 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. +Author: Steve Langasek +Forwarded: https://www.zytor.com/pipermail/klibc/2011-April/002893.html + +Index: klibc-2.0~rc2/klcc/Kbuild +=================================================================== +--- klibc-2.0~rc2.orig/klcc/Kbuild 2012-02-11 18:45:42.000000000 +0000 ++++ klibc-2.0~rc2/klcc/Kbuild 2012-02-11 19:04:53.000000000 +0000 +@@ -26,6 +26,7 @@ + $(Q)echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@ + $(Q)echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@ + $(Q)echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@ ++ $(Q)echo 'multiarch_path=$(DEB_HOST_MULTIARCH)' >> $@ + + + # Generate klcc +Index: klibc-2.0~rc2/klcc/klcc.in +=================================================================== +--- klibc-2.0~rc2.orig/klcc/klcc.in 2012-02-11 18:50:21.000000000 +0000 ++++ klibc-2.0~rc2/klcc/klcc.in 2012-02-11 19:04:53.000000000 +0000 +@@ -7,6 +7,10 @@ + "-I${prefix}/${KCROSS}include/bits${BITSIZE}", + "-I${prefix}/${KCROSS}include"); + ++if ($multiarch_path ne '') { ++ unshift(@includes, "-I${prefix}/${KCROSS}include/${multiarch_path}"); ++} ++ + # Default optimization options (for compiles without -g) + @optopt = @OPTFLAGS; + @goptopt = ('-O'); diff --git a/patches/never-clean-files-in-quilt-status-directory.patch b/patches/never-clean-files-in-quilt-status-directory.patch new file mode 100644 index 0000000..0556116 --- /dev/null +++ b/patches/never-clean-files-in-quilt-status-directory.patch @@ -0,0 +1,31 @@ +From: Ben Hutchings +Date: Sun, 15 Jul 2018 21:53:39 +0100 +Subject: Never clean files in quilt status directory +Forwarded: https://www.zytor.com/pipermail/klibc/2018-July/003999.html + +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 +--- +--- a/Makefile ++++ b/Makefile +@@ -158,7 +158,7 @@ FORCE: ; + ### + # clean: remove generated files + # mrproper does a full cleaning including .config and linux symlink +-FIND_IGNORE := \( -name .git \) -prune -o ++FIND_IGNORE := \( -name .git -o -name .pc \) -prune -o + quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),RM $(wildcard $(rm-files))) + cmd_rmfiles = rm -f $(rm-files) + clean: diff --git a/patches/ppc64el-load-toc-syscall-stub.patch b/patches/ppc64el-load-toc-syscall-stub.patch new file mode 100644 index 0000000..c535e84 --- /dev/null +++ b/patches/ppc64el-load-toc-syscall-stub.patch @@ -0,0 +1,57 @@ +From: Mauricio Faria de Oliveira +Date: Tue, 09 Sep 2014 15:17:19 -0700 +Subject: [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 +--- + usr/klibc/arch/ppc64/sysstub.ph | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/usr/klibc/arch/ppc64/sysstub.ph b/usr/klibc/arch/ppc64/sysstub.ph +index b3f6e38..a0c6d41 100644 +--- a/usr/klibc/arch/ppc64/sysstub.ph ++++ b/usr/klibc/arch/ppc64/sysstub.ph +@@ -18,6 +18,9 @@ sub make_sysstub($$$$$@) { + #if _CALL_ELF == 2 + .type ${fname},\@function + ${fname}: ++0: addis 2,12,(.TOC.-0b)\@ha ++ addi 2,2,(.TOC.-0b)\@l ++ .localentry ${fname},.-${fname} + #else + .section ".opd","aw" + .balign 8 +-- +1.7.1 diff --git a/patches/rename-renameat-use-rename2-system-call.patch b/patches/rename-renameat-use-rename2-system-call.patch new file mode 100644 index 0000000..9203c3c --- /dev/null +++ b/patches/rename-renameat-use-rename2-system-call.patch @@ -0,0 +1,59 @@ +From: Ben Hutchings +Date: Mon, 16 Jul 2018 18:24:08 +0100 +Subject: rename, renameat: Use renameat2() system call +Forwarded: https://www.zytor.com/pipermail/klibc/2018-July/003996.html + +New architectures only define the renameat2() system call, which was +added in Linux 3.15. Define rename() and renameat() as wrappers for +it if necessary. + +Signed-off-by: Ben Hutchings +--- +--- a/usr/klibc/Kbuild ++++ b/usr/klibc/Kbuild +@@ -59,7 +59,8 @@ klib-y += vsnprintf.o snprintf.o vsprint + inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ + inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ + accept.o send.o recv.o \ +- access.o chmod.o chown.o dup2.o mknod.o poll.o rename.o stat.o \ ++ access.o chmod.o chown.o dup2.o mknod.o poll.o rename.o renameat.o \ ++ stat.o \ + lchown.o link.o rmdir.o unlink.o utimes.o lstat.o mkdir.o \ + readlink.o select.o symlink.o pipe.o \ + ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \ +--- a/usr/klibc/rename.c ++++ b/usr/klibc/rename.c +@@ -5,7 +5,7 @@ + + int rename(const char *oldpath, const char *newpath) + { +- return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath); ++ return renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0); + } + + #endif /* __NR_rename */ +--- /dev/null ++++ b/usr/klibc/renameat.c +@@ -0,0 +1,12 @@ ++#include ++#include ++ ++#ifndef __NR_renameat ++ ++int renameat(int olddirfd, const char *oldpath, ++ int newdirfd, const char *newpath) ++{ ++ return renameat2(olddirfd, oldpath, newdirfd, newpath, 0); ++} ++ ++#endif /* __NR_renameat */ +--- a/usr/klibc/SYSCALLS.def ++++ b/usr/klibc/SYSCALLS.def +@@ -116,6 +116,7 @@ int chdir(const char *); + int fchdir(int); + int rename(const char *, const char *); + int renameat(int, const char *, int, const char *); ++ int renameat2(int, const char *, int, const char *, unsigned int); + int mknod(const char *, mode_t, dev_t); + int mknodat(int, const char *, mode_t, dev_t); + int chmod(const char *, mode_t); diff --git a/patches/resume-backward-compatibility-for-resume_offset.patch b/patches/resume-backward-compatibility-for-resume_offset.patch new file mode 100644 index 0000000..b591a83 --- /dev/null +++ b/patches/resume-backward-compatibility-for-resume_offset.patch @@ -0,0 +1,127 @@ +From: Ben Hutchings +Date: Thu, 19 Jul 2018 21:34:08 +0100 +Subject: resume: Backward compatibility for resume_offset +Forwarded: not-needed + +In Debian we will need to maintain backward compatibility with Linux +4.9 at least until after the "buster" release. Therefore we need to +accept that /sys/power/resume_offset might not exist. + +If we can't open that file because it doesn't exist, we should check +whether the offset we are trying to set is the offset that the kernel +would use anyway. In that case, continue. + +--- +--- a/usr/kinit/resume/resumelib.c ++++ b/usr/kinit/resume/resumelib.c +@@ -2,6 +2,8 @@ + * Handle resume from suspend-to-disk + */ + ++#include ++#include + #include + #include + #include +@@ -41,6 +43,70 @@ int do_resume(int argc, char *argv[]) + return resume(resume_file, resume_offset); + } + ++/* ++ * Get the default resume_offset set on the kernel command line. ++ * Return 0 (built-in default) if it is not set, or -1 on failure. ++ */ ++static unsigned long long default_resume_offset(void) ++{ ++ static const char str_hibernate_noresume[] = "hibernate=noresume"; ++ static const char str_resume_offset[] = "resume_offset="; ++ unsigned long long offset = -1; ++ /* ++ * Max length of the kernel command line is arch-dependent, ++ * but currently no more than 4K. ++ */ ++ char buf[4096], *param; ++ ssize_t len; ++ int fd; ++ ++ fd = open("/proc/cmdline", O_RDONLY); ++ if (fd < 0) ++ goto out; ++ ++ len = read(fd, buf, sizeof buf - 1); ++ if (len < 0) ++ goto out; ++ buf[len] = 0; ++ ++ offset = 0; ++ param = buf; ++ for (;;) { ++ /* Skip white space and check for end of string */ ++ param += strspn(param, " \t\r\n"); ++ if (!*param) ++ break; ++ ++ /* Get param length */ ++ len = strcspn(param, " \t\r\n"); ++ ++ /* ++ * Check for hibernate=(noresume|no) which inhibits ++ * parsing of the resume_offset parameter ++ */ ++ if ((len == sizeof str_hibernate_noresume - 1 || ++ len == sizeof str_hibernate_noresume - 1 - 6) && ++ strncmp(param, str_hibernate_noresume, len) == 0) { ++ offset = 0; ++ break; ++ } ++ ++ /* Check for resume_offset=... */ ++ if (strncmp(param, str_resume_offset, ++ sizeof str_resume_offset - 1) == 0) ++ sscanf(param + sizeof str_resume_offset - 1, ++ "%llu", &offset); ++ ++ /* Advance over param */ ++ param += len; ++ } ++ ++out: ++ if (fd >= 0) ++ close(fd); ++ return offset; ++} ++ + int resume(const char *resume_file, unsigned long long resume_offset) + { + dev_t resume_device; +@@ -55,8 +121,21 @@ int resume(const char *resume_file, unsi + goto failure; + } + +- if ((attr_fd = open("/sys/power/resume_offset", O_WRONLY)) < 0) ++ if ((attr_fd = open("/sys/power/resume_offset", O_WRONLY)) < 0) { ++ if (errno == ENOENT) { ++ /* ++ * We can't change the offset, but maybe we don't ++ * need to. In that case, continue. ++ */ ++ unsigned long long default_offset = ++ default_resume_offset(); ++ ++ if (default_offset != (unsigned long long)(-1) && ++ default_offset == resume_offset) ++ goto skip_offset; ++ } + goto fail_offset; ++ } + + len = snprintf(attr_value, sizeof attr_value, + "%llu", +@@ -71,6 +150,7 @@ int resume(const char *resume_file, unsi + + close(attr_fd); + ++skip_offset: + if ((attr_fd = open("/sys/power/resume", O_WRONLY)) < 0) + goto fail_r; + diff --git a/patches/resume-write-resume_offset-parameter.patch b/patches/resume-write-resume_offset-parameter.patch new file mode 100644 index 0000000..a55247f --- /dev/null +++ b/patches/resume-write-resume_offset-parameter.patch @@ -0,0 +1,87 @@ +From: Ben Hutchings +Date: Thu, 19 Jul 2018 20:09:28 +0100 +Subject: resume: Write resume_offset attribute + +Support for a device offset as part of the string written to +/sys/power/resume never got into a mainline kernel. + +However, since Linux 4.17 there is a separate resume_offset attribute +that we can use to set the offset before attempting to resume. + +Change resume() to write the resume_offset attribute instead. + +Signed-off-by: Ben Hutchings +--- +--- a/usr/kinit/resume/resumelib.c ++++ b/usr/kinit/resume/resumelib.c +@@ -44,8 +44,8 @@ int do_resume(int argc, char *argv[]) + int resume(const char *resume_file, unsigned long long resume_offset) + { + dev_t resume_device; +- int powerfd = -1; +- char device_string[64]; ++ int attr_fd = -1; ++ char attr_value[64]; + int len; + + resume_device = name_to_dev_t(resume_file); +@@ -55,30 +55,50 @@ int resume(const char *resume_file, unsi + goto failure; + } + +- if ((powerfd = open("/sys/power/resume", O_WRONLY)) < 0) +- goto fail_r; ++ if ((attr_fd = open("/sys/power/resume_offset", O_WRONLY)) < 0) ++ goto fail_offset; + +- len = snprintf(device_string, sizeof device_string, +- "%u:%u:%llu", +- major(resume_device), minor(resume_device), ++ len = snprintf(attr_value, sizeof attr_value, ++ "%llu", + resume_offset); + + /* This should never happen */ +- if (len >= sizeof device_string) ++ if (len >= sizeof attr_value) ++ goto fail_offset; ++ ++ if (write(attr_fd, attr_value, len) != len) ++ goto fail_offset; ++ ++ close(attr_fd); ++ ++ if ((attr_fd = open("/sys/power/resume", O_WRONLY)) < 0) ++ goto fail_r; ++ ++ len = snprintf(attr_value, sizeof attr_value, ++ "%u:%u", ++ major(resume_device), minor(resume_device)); ++ ++ /* This should never happen */ ++ if (len >= sizeof attr_value) + goto fail_r; + + dprintf("kinit: trying to resume from %s\n", resume_file); + +- if (write(powerfd, device_string, len) != len) ++ if (write(attr_fd, attr_value, len) != len) + goto fail_r; + + /* Okay, what are we still doing alive... */ + failure: +- if (powerfd >= 0) +- close(powerfd); ++ if (attr_fd >= 0) ++ close(attr_fd); + dprintf("kinit: No resume image, doing normal boot...\n"); + return -1; + ++fail_offset: ++ fprintf(stderr, "Cannot write /sys/power/resume_offset " ++ "(no software suspend kernel support, or old kernel version?)\n"); ++ goto failure; ++ + fail_r: + fprintf(stderr, "Cannot write /sys/power/resume " + "(no software suspend kernel support?)\n"); diff --git a/patches/run-init-add-dry-run-mode.patch b/patches/run-init-add-dry-run-mode.patch new file mode 100644 index 0000000..7b25135 --- /dev/null +++ b/patches/run-init-add-dry-run-mode.patch @@ -0,0 +1,193 @@ +From: Ben Hutchings +Date: Sun, 17 Jan 2016 19:50:28 +0000 +Subject: run-init: Add dry-run mode +Bug-Debian: https://bugs.debian.org/810965 +Forwarded: https://www.zytor.com/pipermail/klibc/2016-January/003909.html + +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 +--- +--- a/usr/kinit/run-init/run-init.c ++++ b/usr/kinit/run-init/run-init.c +@@ -26,19 +26,23 @@ + * ----------------------------------------------------------------------- */ + + /* +- * Usage: exec run-init [-d caps] [-c /dev/console] /real-root /sbin/init "$@" ++ * Usage: exec run-init [-d caps] [-c /dev/console] [-n] /real-root /sbin/init "$@" + * + * This program should be called as the last thing in a shell script + * acting as /init in an initramfs; it does the following: + * +- * - Delete all files in the initramfs; +- * - Remounts /real-root onto the root filesystem; +- * - Drops comma-separated list of capabilities; +- * - Chroots; +- * - Opens /dev/console; +- * - Spawns the specified init program (with arguments.) ++ * 1. Delete all files in the initramfs; ++ * 2. Remounts /real-root onto the root filesystem; ++ * 3. Drops comma-separated list of capabilities; ++ * 4. Chroots; ++ * 5. Opens /dev/console; ++ * 6. Spawns the specified init program (with arguments.) ++ * ++ * With the -n option, it skips steps 1, 2 and 6 and can be used to check ++ * whether the given root and init are likely to work. + */ + ++#include + #include + #include + #include +@@ -51,7 +55,7 @@ static const char *program; + static void __attribute__ ((noreturn)) usage(void) + { + fprintf(stderr, +- "Usage: exec %s [-d caps] [-c consoledev] /real-root /sbin/init [args]\n", ++ "Usage: exec %s [-d caps] [-c consoledev] [-n] /real-root /sbin/init [args]\n", + program); + exit(1); + } +@@ -64,6 +68,7 @@ int main(int argc, char *argv[]) + const char *init; + const char *error; + const char *drop_caps = NULL; ++ bool dry_run = false; + char **initargs; + + /* Variables... */ +@@ -72,11 +77,13 @@ int main(int argc, char *argv[]) + /* Parse the command line */ + program = argv[0]; + +- while ((o = getopt(argc, argv, "c:d:")) != -1) { ++ while ((o = getopt(argc, argv, "c:d:n")) != -1) { + if (o == 'c') { + console = optarg; + } else if (o == 'd') { + drop_caps = optarg; ++ } else if (o == 'n') { ++ dry_run = true; + } else { + usage(); + } +@@ -89,9 +96,13 @@ int main(int argc, char *argv[]) + init = argv[optind + 1]; + initargs = argv + optind + 1; + +- error = run_init(realroot, console, drop_caps, init, initargs); ++ error = run_init(realroot, console, drop_caps, dry_run, init, initargs); + +- /* If run_init returns, something went wrong */ +- fprintf(stderr, "%s: %s: %s\n", program, error, strerror(errno)); +- return 1; ++ if (error) { ++ fprintf(stderr, "%s: %s: %s\n", program, error, strerror(errno)); ++ return 1; ++ } else { ++ /* Must have been a dry run */ ++ return 0; ++ } + } +--- a/usr/kinit/run-init/run-init.h ++++ b/usr/kinit/run-init/run-init.h +@@ -28,7 +28,10 @@ + #ifndef RUN_INIT_H + #define RUN_INIT_H + ++#include ++ + const char *run_init(const char *realroot, const char *console, +- const char *drop_caps, const char *init, char **initargs); ++ const char *drop_caps, bool dry_run, ++ const char *init, char **initargs); + + #endif +--- a/usr/kinit/run-init/runinitlib.c ++++ b/usr/kinit/run-init/runinitlib.c +@@ -156,10 +156,10 @@ static int nuke(const char *what) + } + + const char *run_init(const char *realroot, const char *console, +- const char *drop_caps, const char *init, ++ const char *drop_caps, bool dry_run, const char *init, + char **initargs) + { +- struct stat rst, cst; ++ struct stat rst, cst, ist; + struct statfs sfs; + int confd; + +@@ -186,13 +186,15 @@ const char *run_init(const char *realroo + + /* Okay, I think we should be safe... */ + +- /* Delete rootfs contents */ +- if (nuke_dir("/")) +- return "nuking initramfs contents"; +- +- /* Overmount the root */ +- if (mount(".", "/", NULL, MS_MOVE, NULL)) +- return "overmounting root"; ++ if (!dry_run) { ++ /* Delete rootfs contents */ ++ if (nuke_dir("/")) ++ return "nuking initramfs contents"; ++ ++ /* Overmount the root */ ++ if (mount(".", "/", NULL, MS_MOVE, NULL)) ++ return "overmounting root"; ++ } + + /* chroot, chdir */ + if (chroot(".") || chdir("/")) +@@ -205,12 +207,24 @@ const char *run_init(const char *realroo + /* Open /dev/console */ + if ((confd = open(console, O_RDWR)) < 0) + return "opening console"; +- dup2(confd, 0); +- dup2(confd, 1); +- dup2(confd, 2); ++ if (!dry_run) { ++ dup2(confd, 0); ++ dup2(confd, 1); ++ dup2(confd, 2); ++ } + close(confd); + +- /* Spawn init */ +- execv(init, initargs); +- return init; /* Failed to spawn init */ ++ if (!dry_run) { ++ /* Spawn init */ ++ execv(init, initargs); ++ return init; /* Failed to spawn init */ ++ } else { ++ if (stat(init, &ist)) ++ return init; ++ if (!S_ISREG(ist.st_mode) || !(ist.st_mode & S_IXUGO)) { ++ errno = EACCES; ++ return init; ++ } ++ return NULL; /* Success */ ++ } + } +--- a/usr/kinit/kinit.c ++++ b/usr/kinit/kinit.c +@@ -304,7 +304,7 @@ int main(int argc, char *argv[]) + init_argv[0] = strrchr(init_path, '/') + 1; + + errmsg = run_init("/root", "/dev/console", +- get_arg(cmdc, cmdv, "drop_capabilities="), ++ get_arg(cmdc, cmdv, "drop_capabilities="), false, + init_path, init_argv); + + /* If run_init returned, something went bad */ diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..5d22983 --- /dev/null +++ b/patches/series @@ -0,0 +1,34 @@ +never-clean-files-in-quilt-status-directory.patch +klibc-linux-libc-dev +multiarch-include-path +ppc64el-load-toc-syscall-stub.patch +mount-implement-o-defaults.patch +mips-update-archfcntl-h.patch +0001-add-mips64-support-headers.patch +0002-add-mips64-support-arch-mips32.patch +0003-add-mips64-support-arch-mips64-specific.patch +install-headers-with-consistent-mode.patch +dash-mkbuiltins-fix-sort-order-harder.patch +klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch +klibc-ppc64-fix-struct-stat.patch +gzip-fix-silent-fallback-to-decompression.patch +klibc-mips-setjmp-s-don-t-save-and-restore-floating-point.patch +run-init-add-dry-run-mode.patch +broadcast_dhcp_send.patch +dhcp-one-socket-per-interface.patch +klibc-i386-remove-special-handling-of-socketcall.patch +klibc-add-accept4-handle-fallback-from-accept-to-acc.patch +ia64-build-static-tools.patch +Implement-classless-static-routes.patch +mount_main-Fix-empty-string-check.patch +mips64-compile-with-mno-abicalls.patch +add-reboot-argument-support.patch +x86_64-reduce-ld-max-page-size-option-again.patch +x86_64-use-ttext-segment-to-avoid-address-collision.patch +rename-renameat-use-rename2-system-call.patch +add-riscv-rv64-port.patch +sparc-pie.patch +resume-write-resume_offset-parameter.patch +resume-backward-compatibility-for-resume_offset.patch +i386-use-ttext-segment-to-avoid-address-collision.patch +disable-pie.patch diff --git a/patches/sparc-pie.patch b/patches/sparc-pie.patch new file mode 100644 index 0000000..a356000 --- /dev/null +++ b/patches/sparc-pie.patch @@ -0,0 +1,231 @@ +From: James Clarke +Date: Wed, 18 Jul 2018 22:30:42 +0100 +Subject: [PATCH v2] Fix sparc assembly when compiled as PIC +Bug-Debian: https://bugs.debian.org/885852 +Forwarded: https://www.zytor.com/pipermail/klibc/2018-July/004001.html + +Some distributions default to PIE for their compilers, which on sparc is passed +on to the assembler. Since the behaviour of %hi/%lo changes under PIC to become +GOT offsets, the current assembly files need adapting to not try to use a GOT +offset as an absolute address. +--- +Changes since v1: + + * Don't put the start of PIC_PROLOGUE in the delay slot of the branch + after the pipe syscall, since that clobbers %g4 which is used as a + saved register on the success path. + + usr/include/arch/sparc/machine/asm.h | 15 +++++++++++++-- + usr/include/arch/sparc64/machine/asm.h | 1 + + usr/include/arch/sparc64/machine/frame.h | 1 + + usr/klibc/arch/sparc/pipe.S | 5 +++-- + usr/klibc/arch/sparc/syscall.S | 6 ++++-- + usr/klibc/arch/sparc/sysfork.S | 6 ++++-- + usr/klibc/arch/sparc64/pipe.S | 5 +++-- + usr/klibc/arch/sparc64/syscall.S | 6 ++++-- + usr/klibc/arch/sparc64/sysfork.S | 6 ++++-- + 9 files changed, 37 insertions(+), 14 deletions(-) + +diff --git a/usr/include/arch/sparc/machine/asm.h b/usr/include/arch/sparc/machine/asm.h +index 04fe9b1b..fd9ef1ef 100644 +--- a/usr/include/arch/sparc/machine/asm.h ++++ b/usr/include/arch/sparc/machine/asm.h +@@ -61,7 +61,7 @@ + #endif + #define _ASM_LABEL(name) name + +-#ifdef PIC ++#ifdef __PIC__ + /* + * PIC_PROLOGUE() is akin to the compiler generated function prologue for + * PIC code. It leaves the address of the Global Offset Table in DEST, +@@ -83,12 +83,20 @@ + 0: \ + add dest,%o7,dest; \ + mov tmp, %o7 ++#define SET(var,base,dest) \ ++ sethi %gdop_hix22(var), dest; \ ++ xor dest, %gdop_lox10(var), dest; \ ++ ldx [base + dest], dest, %gdop(var) + #else + #define PIC_PROLOGUE(dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + add dest,%o7,dest; mov tmp,%o7 ++#define SET(var,base,dest) \ ++ sethi %gdop_hix22(var), dest; \ ++ xor dest, %gdop_lox10(var), dest; \ ++ ld [base + dest], dest, %gdop(var) + #endif + + /* +@@ -106,7 +114,10 @@ + #endif + #else + #define PIC_PROLOGUE(dest,tmp) +-#define PICCY_OFFSET(var,dest,tmp) ++#define SET(var,base,dest) \ ++ sethi %hi(var), dest; \ ++ or dest, %lo(var), dest ++#define PICCY_SET(var,dest,tmp) SET(var,tmp,dest) + #endif + + #define FTYPE(x) .type x,@function +diff --git a/usr/include/arch/sparc64/machine/asm.h b/usr/include/arch/sparc64/machine/asm.h +new file mode 100644 +index 00000000..394ba865 +--- /dev/null ++++ b/usr/include/arch/sparc64/machine/asm.h +@@ -0,0 +1 @@ ++#include "../../sparc/machine/asm.h" +diff --git a/usr/include/arch/sparc64/machine/frame.h b/usr/include/arch/sparc64/machine/frame.h +new file mode 100644 +index 00000000..79beea6d +--- /dev/null ++++ b/usr/include/arch/sparc64/machine/frame.h +@@ -0,0 +1 @@ ++#include "../../sparc/machine/frame.h" +diff --git a/usr/klibc/arch/sparc/pipe.S b/usr/klibc/arch/sparc/pipe.S +index a8abf3c3..e278bda5 100644 +--- a/usr/klibc/arch/sparc/pipe.S ++++ b/usr/klibc/arch/sparc/pipe.S +@@ -5,6 +5,7 @@ + * they return the two file descriptors in %o0 and %o1. + */ + ++#include + #include + + .globl pipe +@@ -16,8 +17,8 @@ pipe: + t 0x10 + bcc 1f + nop +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0,[%g4] + retl + mov -1, %o0 +diff --git a/usr/klibc/arch/sparc/syscall.S b/usr/klibc/arch/sparc/syscall.S +index c0273f77..52a8583b 100644 +--- a/usr/klibc/arch/sparc/syscall.S ++++ b/usr/klibc/arch/sparc/syscall.S +@@ -4,14 +4,16 @@ + * Common system-call stub; %g1 already set to syscall number + */ + ++#include ++ + .globl __syscall_common + .type __syscall_common,#function + .align 4 + __syscall_common: + t 0x10 + bcc 1f +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0,[%g4] + mov -1, %o0 + 1: +diff --git a/usr/klibc/arch/sparc/sysfork.S b/usr/klibc/arch/sparc/sysfork.S +index a66c76e9..3787b944 100644 +--- a/usr/klibc/arch/sparc/sysfork.S ++++ b/usr/klibc/arch/sparc/sysfork.S +@@ -8,6 +8,8 @@ + * Common system-call stub; %g1 already set to syscall number + */ + ++#include ++ + .globl __syscall_forkish + .type __syscall_forkish,#function + .align 4 +@@ -16,8 +18,8 @@ __syscall_forkish: + sub %o1, 1, %o1 + bcc,a 1f + and %o0, %o1, %o0 +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0,[%g4] + mov -1, %o0 + 1: +diff --git a/usr/klibc/arch/sparc64/pipe.S b/usr/klibc/arch/sparc64/pipe.S +index c63b20f7..cb5c2c79 100644 +--- a/usr/klibc/arch/sparc64/pipe.S ++++ b/usr/klibc/arch/sparc64/pipe.S +@@ -5,6 +5,7 @@ + * they return the two file descriptors in %o0 and %o1. + */ + ++#include + #include + + .globl pipe +@@ -16,8 +17,8 @@ pipe: + t 0x6d + bcc %xcc, 1f + nop +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0,[%g4] + retl + mov -1, %o0 +diff --git a/usr/klibc/arch/sparc64/syscall.S b/usr/klibc/arch/sparc64/syscall.S +index 7ab9d95f..c84c9ae5 100644 +--- a/usr/klibc/arch/sparc64/syscall.S ++++ b/usr/klibc/arch/sparc64/syscall.S +@@ -4,14 +4,16 @@ + * Common system-call stub; %g1 already set to syscall number + */ + ++#include ++ + .globl __syscall_common + .type __syscall_common,#function + .align 4 + __syscall_common: + t 0x6d + bcc %xcc, 1f +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0,[%g4] + 1: + retl +diff --git a/usr/klibc/arch/sparc64/sysfork.S b/usr/klibc/arch/sparc64/sysfork.S +index 2eed659e..a0c13340 100644 +--- a/usr/klibc/arch/sparc64/sysfork.S ++++ b/usr/klibc/arch/sparc64/sysfork.S +@@ -8,6 +8,8 @@ + * Common system-call stub; %g1 already set to syscall number + */ + ++#include ++ + .globl __syscall_forkish + .type __syscall_forkish,#function + .align 4 +@@ -16,8 +18,8 @@ __syscall_forkish: + sub %o1, 1, %o1 + bcc,a %xcc, 1f + and %o0, %o1, %o0 +- sethi %hi(errno), %g4 +- or %g4, %lo(errno), %g4 ++ PIC_PROLOGUE(%g1,%g4) ++ SET(errno,%g1,%g4) + st %o0, [%g4] + retl + mov -1, %o0 +-- +2.18.0 + diff --git a/patches/x86_64-reduce-ld-max-page-size-option-again.patch b/patches/x86_64-reduce-ld-max-page-size-option-again.patch new file mode 100644 index 0000000..dd15b61 --- /dev/null +++ b/patches/x86_64-reduce-ld-max-page-size-option-again.patch @@ -0,0 +1,50 @@ +From: Ben Hutchings +Date: Sun, 15 Jul 2018 21:27:09 +0100 +Subject: [klibc] x86_64: Reduce ld max-page-size option again +Bug-Debian: https://bugs.debian.org/903849 +Forwarded: https://www.zytor.com/pipermail/klibc/2018-July/003998.html + +Building klibc with binutils 2.30 results in the following layout +for klibc.so: + +Idx Name Size VMA LMA File off Algn + 0 .text 0000d1ff 0000000000200200 0000000000200200 00000200 2**2 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .rodata 000031af 0000000000300000 0000000000300000 00100000 2**5 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 2 .data.rel.ro 00000990 0000000000403660 0000000000403660 00103660 2**5 + CONTENTS, ALLOC, LOAD, DATA + 3 .data 00000140 0000000000404000 0000000000404000 00104000 2**5 + CONTENTS, ALLOC, LOAD, DATA + 4 .bss 000042f8 0000000000404140 0000000000404140 00104140 2**5 + ALLOC + +The .text and .rodata sections have each been padded to the specified +maximum page size of 1 MB, causing the following sections to overlap +the executable. + +This causes all klibc executables to crash immediately. + +Since there's no architectural page size betwen 4 KB and 2MB, set +max-page-size to 4 KB. + +Signed-off-by: Ben Hutchings +--- +--- a/usr/klibc/arch/x86_64/MCONFIG ++++ b/usr/klibc/arch/x86_64/MCONFIG +@@ -30,10 +30,12 @@ KLIBCLDFLAGS = -m elf_x86_64 + # calls, and work on the memory models for this architecture + # 2 MB - normal binaries start at 4 MB + # +-# Recent binutils use max-page-size=0x200000 by default, which pushes ++# binutils now uses max-page-size=0x200000 by default, which pushes + # klibc.so data over the 4 MB mark, overlapping the executable. +-# Revert to the old max-page-size=0x100000 value. +-KLIBCSHAREDFLAGS = -Ttext 0x00200200 -z max-page-size=0x100000 ++# The old default was max-page-size=0x100000, but that also results ++# in a broken layout with binutils 2.30. Since there's no ++# architectural page size betwen 4 KB and 2MB, set it to 4 KB. ++KLIBCSHAREDFLAGS = -Ttext 0x00200200 -z max-page-size=0x1000 + + # Asm includes for x86_64 are in the merged x86 tree + KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include diff --git a/patches/x86_64-use-ttext-segment-to-avoid-address-collision.patch b/patches/x86_64-use-ttext-segment-to-avoid-address-collision.patch new file mode 100644 index 0000000..a0eadec --- /dev/null +++ b/patches/x86_64-use-ttext-segment-to-avoid-address-collision.patch @@ -0,0 +1,28 @@ +From: Ben Hutchings +Date: Sat, 05 Jan 2019 20:59:33 +0000 +Subject: [klibc] x86_64: Use -Ttext-segment to avoid address collision + +Building klibc for x86_64 with binutils 2.31 adds an extra +.note.gnu.property section to klibc.so, the address of which is not +affected by the -Ttext option. Loading a klibc executable then +fails with the following kernel log message: + +9409 (sh.shared): Uhuuh, elf segment at 0000000000200000 requested but the memory is mapped already + +I don't exactly see why this is happening, but it is triggered by the +new section and the collision can be avoided by passing -Ttext-segment +instead of -Ttext. A similar change was applied to MIPS recently. + +Signed-off-by: Ben Hutchings +--- +--- a/usr/klibc/arch/x86_64/MCONFIG ++++ b/usr/klibc/arch/x86_64/MCONFIG +@@ -35,7 +35,7 @@ KLIBCLDFLAGS = -m elf_x86_64 + # The old default was max-page-size=0x100000, but that also results + # in a broken layout with binutils 2.30. Since there's no + # architectural page size betwen 4 KB and 2MB, set it to 4 KB. +-KLIBCSHAREDFLAGS = -Ttext 0x00200200 -z max-page-size=0x1000 ++KLIBCSHAREDFLAGS = -Ttext-segment 0x00200000 -z max-page-size=0x1000 + + # Asm includes for x86_64 are in the merged x86 tree + KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include diff --git a/rules b/rules new file mode 100755 index 0000000..f5f9f06 --- /dev/null +++ b/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f + +# let debhelper be verbose +#export DH_VERBOSE=1 + +include /usr/share/dpkg/architecture.mk +export DEB_HOST_MULTIARCH + +ifeq ($(DEB_HOST_ARCH),armel) +DEB_MAKE_ENVVARS := ARCH=arm CONFIG_AEABI=y +endif +ifeq ($(DEB_HOST_ARCH),armhf) +DEB_MAKE_ENVVARS := ARCH=arm CONFIG_AEABI=y CPU_ARCH=armv7-a CPU_TUNE=cortex-a8 CONFIG_KLIBC_THUMB=y +endif +ifeq ($(DEB_HOST_ARCH),ia64) +DEB_MAKE_ENVVARS := ARCH=ia64 +endif +ifeq ($(DEB_HOST_ARCH),i386) +DEB_MAKE_ENVVARS := ARCH=i386 +endif +ifeq ($(DEB_HOST_ARCH),sparc) +DEB_MAKE_ENVVARS := ARCH=sparc +endif +ifeq ($(DEB_HOST_ARCH),sparc64) +DEB_MAKE_ENVVARS := ARCH=sparc64 +endif +ifeq ($(DEB_HOST_ARCH),s390) +DEB_MAKE_ENVVARS := ARCH=s390 +endif +ifeq ($(DEB_HOST_ARCH),powerpc) +ARCH=ppc +endif +ifneq (,$(filter mips mipsel,$(DEB_HOST_ARCH))) +DEB_MAKE_ENVVARS := ARCH=mips +endif +ifneq (,$(filter mips64 mips64el,$(DEB_HOST_ARCH))) +DEB_MAKE_ENVVARS := ARCH=mips64 +endif +ifeq ($(DEB_HOST_ARCH),sh4) +DEB_MAKE_ENVVARS := ARCH=sh +endif +ifeq ($(DEB_HOST_ARCH),ppc64) +DEB_MAKE_ENVVARS := ARCH=ppc64 +endif +ifeq ($(DEB_HOST_ARCH),riscv64) +DEB_MAKE_ENVVARS := ARCH=riscv64 +endif + +DEB_MAKE_ENVVARS := INSTALLROOT=debian/tmp $(DEB_MAKE_ENVVARS) + +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) + DEB_MAKE_ENVVARS += CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- +endif + + +# Enable this to get verbose build information +DEB_MAKE_ENVVARS += KBUILD_VERBOSE=1 + +%: + dh $@ --link-doc=libklibc + +override_dh_auto_build: + if [ ! -e linux ]; then \ + rm -rf linux/include; \ + mkdir -p linux/include; \ + ln -s /usr/include/linux linux/include; \ + INC_PATH="/usr/include/asm*"; \ + if [ -n "$(DEB_HOST_MULTIARCH)" ]; then \ + INC_PATH="$${INC_PATH} /usr/include/$(DEB_HOST_MULTIARCH)/asm*"; \ + INC_PATH="$${INC_PATH} /usr/$(DEB_HOST_MULTIARCH)/include/asm*"; \ + fi; \ + for x in $${INC_PATH}; do \ + if [ -e $${x} ] ; then \ + ln -sf $${x} linux/include; \ + fi; \ + done \ + fi + make all $(DEB_MAKE_ENVVARS) + +override_dh_auto_clean: + rm -rf linux + MAKEFLAGS="$(DEB_MAKE_ENVVARS)" dh_auto_clean + +override_dh_auto_install: + make install $(DEB_MAKE_ENVVARS) + +override_dh_auto_test: + make test $(DEB_MAKE_ENVVARS) + +override_dh_fixperms: + dh_fixperms -X.so diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/watch b/watch new file mode 100644 index 0000000..2e4a75b --- /dev/null +++ b/watch @@ -0,0 +1,2 @@ +version=3 +https://www.kernel.org/pub/linux/libs/klibc/2.0/klibc-([0-9.]+).tar.xz -- 2.30.2