* [gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/kmod/, sys-apps/kmod/files/
@ 2014-01-18 14:32 Anthony G. Basile
0 siblings, 0 replies; only message in thread
From: Anthony G. Basile @ 2014-01-18 14:32 UTC (permalink / raw
To: gentoo-commits
commit: 5eb9c84b7f455851e54aef12e475ca6776fc8613
Author: layman <layman <AT> localhost>
AuthorDate: Thu Jan 16 14:34:50 2014 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jan 18 14:31:54 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=5eb9c84b
sys-apps/kmod: use strndup, not strndupa
---
sys-apps/kmod/files/kmod-15-dynamic-kmod.patch | 16 +++
sys-apps/kmod/files/kmod-15-use-strndup.patch | 12 +++
sys-apps/kmod/files/kmod-static-nodes | 18 ++++
sys-apps/kmod/kmod-15-r99.ebuild | 129 +++++++++++++++++++++++++
sys-apps/kmod/metadata.xml | 12 +++
5 files changed, 187 insertions(+)
diff --git a/sys-apps/kmod/files/kmod-15-dynamic-kmod.patch b/sys-apps/kmod/files/kmod-15-dynamic-kmod.patch
new file mode 100644
index 0000000..c93bea6
--- /dev/null
+++ b/sys-apps/kmod/files/kmod-15-dynamic-kmod.patch
@@ -0,0 +1,16 @@
+do not statically link kmod against its own libraries
+
+https://bugs.gentoo.org/493630
+http://thread.gmane.org/gmane.linux.kernel.modules/1206
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -817,7 +817,7 @@
+ @BUILD_TOOLS_TRUE@ tools/static-nodes.c
+
+ @BUILD_TOOLS_TRUE@tools_kmod_LDADD = libkmod/libkmod-util.la \
+-@BUILD_TOOLS_TRUE@ libkmod/libkmod-internal.la
++@BUILD_TOOLS_TRUE@ libkmod/libkmod.la
+
+
+ # ------------------------------------------------------------------------------
diff --git a/sys-apps/kmod/files/kmod-15-use-strndup.patch b/sys-apps/kmod/files/kmod-15-use-strndup.patch
new file mode 100644
index 0000000..7d56480
--- /dev/null
+++ b/sys-apps/kmod/files/kmod-15-use-strndup.patch
@@ -0,0 +1,12 @@
+diff -Naur kmod-15.orig/libkmod/libkmod-util.c kmod-15/libkmod/libkmod-util.c
+--- kmod-15.orig/libkmod/libkmod-util.c 2014-01-16 14:11:37.002012850 +0000
++++ kmod-15/libkmod/libkmod-util.c 2014-01-16 14:10:36.709009479 +0000
+@@ -324,7 +324,7 @@
+ {
+ char *start, *end;
+
+- start = strndupa(path, len);
++ start = strndup(path, len);
+ end = start + len;
+
+ /*
diff --git a/sys-apps/kmod/files/kmod-static-nodes b/sys-apps/kmod/files/kmod-static-nodes
new file mode 100644
index 0000000..43d8431
--- /dev/null
+++ b/sys-apps/kmod/files/kmod-static-nodes
@@ -0,0 +1,18 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/kmod/files/kmod-static-nodes,v 1.1 2013/08/09 19:08:18 ssuominen Exp $
+
+description="Create list of required static device nodes for the current kernel"
+
+depend() {
+ after dev-mount
+ before tmpfiles.dev dev
+}
+
+start() {
+ ebegin "Creating list of required static device nodes for the current kernel"
+ checkpath -q -d /run/tmpfiles.d
+ kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
+ eend $?
+}
diff --git a/sys-apps/kmod/kmod-15-r99.ebuild b/sys-apps/kmod/kmod-15-r99.ebuild
new file mode 100644
index 0000000..09cc20f
--- /dev/null
+++ b/sys-apps/kmod/kmod-15-r99.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/kmod/kmod-15-r1.ebuild,v 1.1 2013/12/09 01:55:28 vapier Exp $
+
+EAPI=5
+inherit autotools eutils libtool multilib toolchain-funcs versionator
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://kernel/linux/utils/kernel/kmod/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
+fi
+
+DESCRIPTION="library and tools for managing linux kernel modules"
+HOMEPAGE="http://git.kernel.org/?p=utils/kernel/kmod/kmod.git"
+
+LICENSE="LGPL-2"
+SLOT="0"
+IUSE="debug doc lzma +openrc static-libs +tools zlib"
+
+# Upstream does not support running the test suite with custom configure flags.
+# I was also told that the test suite is intended for kmod developers.
+# So we have to restrict it.
+# See bug #408915.
+RESTRICT="test"
+
+RDEPEND="!sys-apps/module-init-tools
+ !sys-apps/modutils
+ lzma? ( >=app-arch/xz-utils-5.0.4-r1 )
+ openrc? ( !<sys-apps/openrc-0.12 )
+ zlib? ( >=sys-libs/zlib-1.2.6 )" #427130
+DEPEND="${RDEPEND}
+ dev-libs/libxslt
+ doc? ( dev-util/gtk-doc )
+ lzma? ( virtual/pkgconfig )
+ zlib? ( virtual/pkgconfig )"
+
+pkg_setup() {
+ [[ $(tc-getCPP) == *cpp ]] && ! version_is_at_least 4.6 $(gcc-version) && \
+ die "You need at least GNU GCC 4.6.x to build this package." #481020
+}
+
+src_prepare() {
+ if [ ! -e configure ]; then
+ if use doc; then
+ gtkdocize --copy --docdir libkmod/docs || die
+ else
+ touch libkmod/docs/gtk-doc.make
+ fi
+ eautoreconf
+ else
+ epatch "${FILESDIR}"/${PN}-15-dynamic-kmod.patch #493630
+ epatch "${FILESDIR}"/${PN}-15-use-strndup.patch
+ elibtoolize
+ fi
+
+ # Restore possibility of running --enable-static wrt #472608
+ sed -i \
+ -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --with-rootlibdir=/$(get_libdir) \
+ --enable-shared \
+ $(use_enable static-libs static) \
+ $(use_enable tools) \
+ $(use_enable debug) \
+ $(use_enable doc gtk-doc) \
+ $(use_with lzma xz) \
+ $(use_with zlib)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+
+ if use tools; then
+ local bincmd sbincmd
+ for sbincmd in depmod insmod lsmod modinfo modprobe rmmod; do
+ dosym /bin/kmod /sbin/${sbincmd}
+ done
+
+ # These are also usable as normal user
+ for bincmd in lsmod modinfo; do
+ dosym kmod /bin/${bincmd}
+ done
+ fi
+
+ cat <<-EOF > "${T}"/usb-load-ehci-first.conf
+ softdep uhci_hcd pre: ehci_hcd
+ softdep ohci_hcd pre: ehci_hcd
+ EOF
+
+ insinto /lib/modprobe.d
+ doins "${T}"/usb-load-ehci-first.conf #260139
+
+ use openrc && doinitd "${FILESDIR}"/kmod-static-nodes
+}
+
+pkg_postinst() {
+ if use openrc; then
+ if [[ -L ${ROOT}etc/runlevels/boot/static-nodes ]]; then
+ ewarn "Removing old conflicting static-nodes init script from the boot runlevel"
+ rm -f "${ROOT}"etc/runlevels/boot/static-nodes
+ fi
+
+ # Add kmod to the runlevel automatically if this is the first install of this package.
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ if [[ -x ${ROOT}etc/init.d/kmod-static-nodes && -d ${ROOT}etc/runlevels/sysinit ]]; then
+ ln -s /etc/init.d/kmod-static-nodes "${ROOT}"/etc/runlevels/sysinit/kmod-static-nodes
+ fi
+ fi
+
+ if [[ -e ${ROOT}etc/runlevels/sysinit ]]; then
+ if [[ ! -e ${ROOT}etc/runlevels/sysinit/kmod-static-nodes ]]; then
+ ewarn
+ ewarn "You need to add kmod-static-nodes to the sysinit runlevel for"
+ ewarn "kernel modules to have required static nodes!"
+ ewarn "Run this command:"
+ ewarn "\trc-update add kmod-static-nodes sysinit"
+ fi
+ fi
+ fi
+}
diff --git a/sys-apps/kmod/metadata.xml b/sys-apps/kmod/metadata.xml
new file mode 100644
index 0000000..97fc7c5
--- /dev/null
+++ b/sys-apps/kmod/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <maintainer>
+ <email>udev-bugs@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name='openrc'>Install the OpenRC init scripts</flag>
+ <flag name='tools'>Install module loading/unloading tools.</flag>
+ </use>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-18 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-18 14:32 [gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/kmod/, sys-apps/kmod/files/ Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox