SHA256
1
0
forked from pool/kmod

Accepting request 134993 from Base:System

- Provide the "modutils" virtual symbol
- Update to new upstream release 10
* Read coresize from /sys if supported
* Add flag to kmod_module_probe_insert() to apply blacklisting
  during probe only if mod is an alias. Now modprobe uses this
  flag by default.

OBS-URL: https://build.opensuse.org/request/show/134993
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kmod?expand=0&rev=11
This commit is contained in:
Stephan Kulow 2012-09-26 14:20:56 +00:00 committed by Git OBS Bridge
commit a97e644911
8 changed files with 83 additions and 172 deletions

View File

@ -1,79 +0,0 @@
diff --git a/testsuite/init_module.c b/testsuite/init_module.c
index 814998a..ed8b9fc 100644
--- a/testsuite/init_module.c
+++ b/testsuite/init_module.c
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <elf.h>
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
@@ -206,6 +207,12 @@ static inline bool module_is_inkernel(const char *modname)
return ret;
}
+static uint8_t elf_identify(void *mem)
+{
+ uint8_t *p = mem;
+ return p[EI_CLASS];
+}
+
TS_EXPORT long init_module(void *mem, unsigned long len, const char *args);
/*
@@ -225,6 +232,8 @@ long init_module(void *mem, unsigned long len, const char *args)
const void *buf;
uint64_t bufsize;
int err;
+ uint8_t class;
+ off_t offset;
init_retcodes();
@@ -237,13 +246,20 @@ long init_module(void *mem, unsigned long len, const char *args)
kmod_elf_unref(elf);
/*
- * We couldn't find the module's name inside the ELF file. Just exit
- * as if it was successful
+ * We couldn't find the parse the ELF file. Just exit as if it was
+ * successful
*/
if (err < 0)
return 0;
- modname = (char *)buf + offsetof(struct module, name);
+ /* We need to open both 32 and 64 bits module - hack! */
+ class = elf_identify(mem);
+ if (class == ELFCLASS64)
+ offset = MODULE_NAME_OFFSET_64;
+ else
+ offset = MODULE_NAME_OFFSET_32;
+
+ modname = (char *)buf + offset;
mod = find_module(modules, modname);
if (mod != NULL) {
errno = mod->errcode;
diff --git a/testsuite/stripped-module.h b/testsuite/stripped-module.h
index 9f97dae..19862f3 100644
--- a/testsuite/stripped-module.h
+++ b/testsuite/stripped-module.h
@@ -13,6 +13,7 @@ struct list_head {
};
#define MODULE_NAME_LEN (64 - sizeof(unsigned long))
+
struct module
{
enum module_state state;
@@ -24,4 +25,8 @@ struct module
char name[MODULE_NAME_LEN];
};
+/* padding */
+#define MODULE_NAME_OFFSET_64 4 + 4 + 2 * 8
+#define MODULE_NAME_OFFSET_32 4 + 2 * 4
+
#endif

17
kmod-10.tar.sign Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iQIcBAABAgAGBQJQSPkjAAoJEJuipaYwy+pTaEIP/jmc3hTYUDc8oo6Fiu2rBPX+
uIHqUWCHc20+UUlqBgd4py7T8MO7WbeJjrtoTOYouCenoN2H4BmOJ1AXXvCebYUy
I/GtiNqyFiylRBaGedHgedAOmNNU7H+DUTCJb86VkKsgdfSyIKChqghQX/wR8+6h
coQikuHnUPCjlfKQ68vpGsjigHvPhDdWaZXkcoB6HLN3P0C1K2ygYmcFBBZWgp8h
Y73tFmTbZ6pSi3ryhE5o9d6t4jTIoWDG6Gbi/Z8mKV1XFki7Sqmn8MCVLGZnY5wd
4vw2WU1CvMYsaoKHnTVlnY4uDwafKYI+ShTrkJMaLkqMpt0NaIyIZiJSoCrd9AZ0
vOTgHrgvs0AE3wvlzM0S7W4Goncl/LHvvjbN+KBrZeeVaumYwRMP75Azf9jjC+/3
T+ccQYsWuZAEopenGCBZ2L1kWjelZVmO2Fxnp3ihtXVFDarTlGDbI3KYSXZNrYod
HgpvKUG91q/Wsk5YuMsxyPZKpCi/v7UP2kjRfPX9MoOkKxZBFj1y037Jnuhah9j1
75WhaKirh5RJbb+zs899v+AMhkhEkyF+pEB32Wzup8TVDu/QdpEwi2Lrbs8+GMX1
Z3JupAOPP0e/G5veYAC/mmdHtr3I6KWpej7HlB0DegyKHnYi4RXxL3dc8xSFtaKk
6wP4K9SjqJtwDsMYja/n
=dUNy
-----END PGP SIGNATURE-----

3
kmod-10.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:deb80df9e6aa34f965ecf329fd07db462b57ce515b9077eae5cdfac5197a7bff
size 1125436

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iQIcBAABAgAGBQJP4QHcAAoJEJuipaYwy+pT9cYP/ig2VPtHtgONZkF99dcaPjVU
CZDa5tFbmwNYmV08ufPSDX1Dnz2x9TnlJQyOwR8PgOK0VSjqgAeVZhyMy2FDz7Iu
0QTFg3VhbFMYZbmvBEXuNw6ljIkmOk1BSMocbFJEaRSn19feW+JvlVugPOY+P9sM
/ySGPyz8r8DztbA6DA9QlICPl6/+AdxRMnkMp/ZGKChg72o7UgHwkebVZ4LaZ/gw
cbq4gvoiqsScfoaWjmXHexDAhmhw+uyvBOGLDCJI2UgnZtHawiBmpC7c7M38t8YJ
REySLixnmbL3jo5k2WMbYF2Q4rWoS8zyQtQHlyZznO31bXU8ma9he3vHHsrM2evO
yhIDm0eSJvFl2/qwBDUP8C92ekj7DoUFbs6BRAJoda+tmcmAVepg0P5kjmiYxMzC
BbscpRh3vBJ+/MSWsPAcT3OXQKBStwenfc2VN63hoS4ghIXFJDYeCmR2yM+UWsrr
SYjn5+Gs0cNO/mVxHILW9SHioUA+oJ8x4/ns6NUuVonBn2Itk4NdI6GoMM3hS3X8
WT5WlqmvUCV6cb04Xh+N5ZoE0vRKCDJNN8Nye1XtHUUctZPrjmb7HwNUVwEFyQVt
RObsxQtsxpPUFNh5V8MQAxt2PVcW9K1xPPJNSBMQc+RLSBB5AjEzLDKkcNzHmcWo
oEDOGRlbO2Mgpu2gXD/3
=wsDr
-----END PGP SIGNATURE-----

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0607267cb62dbc9009d0719f442a56f97f64d9983e20dbcaedfff9073abdcecf
size 1122668

View File

@ -1,24 +0,0 @@
Index: kmod-9/Makefile.am
===================================================================
--- kmod-9.orig/Makefile.am
+++ kmod-9/Makefile.am
@@ -33,10 +33,6 @@ SED_PROCESS = \
%.pc: %.pc.in Makefile
$(SED_PROCESS)
-LIBKMOD_CURRENT=3
-LIBKMOD_REVISION=3
-LIBKMOD_AGE=1
-
noinst_LTLIBRARIES = libkmod/libkmod-util.la
libkmod_libkmod_util_la_SOURCES = libkmod/libkmod-hash.c \
libkmod/libkmod-hash.h \
@@ -65,7 +61,7 @@ EXTRA_DIST += libkmod/libkmod.sym
EXTRA_DIST += libkmod/COPYING libkmod/README
libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
- -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
+ -version-number 2:1 \
-Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
libkmod_libkmod_la_DEPENDENCIES = libkmod/libkmod-util.la \
${top_srcdir}/libkmod/libkmod.sym

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Sep 13 23:19:10 UTC 2012 - jengelh@inai.de
- Provide the "modutils" virtual symbol
- Update to new upstream release 10
* Read coresize from /sys if supported
* Add flag to kmod_module_probe_insert() to apply blacklisting
during probe only if mod is an alias. Now modprobe uses this
flag by default.
-------------------------------------------------------------------
Wed Jun 20 08:41:03 UTC 2012 - rmilasan@suse.com

102
kmod.spec
View File

@ -21,21 +21,17 @@ Name: kmod
Summary: Utilities to load modules into the kernel
License: LGPL-2.1+ and GPL-2.0+
Group: System/Kernel
Version: 9
Version: 10
Release: 0
Url: http://www.politreco.com/2011/12/announce-kmod-2/
Url: http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools/
#Announce: https://lwn.net/Articles/502622/
#Git-Web: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: %name-%version.tar.xz
Source2: %name-%version.tar.sign
Patch1: kmod-so-version.diff
Patch2: fix-32bits.diff
Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/kmod/%name-%version.tar.xz
Source2: ftp://ftp.kernel.org/pub/linux/utils/kernel/kmod/%name-%version.tar.sign
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig >= 0.21
BuildRequires: xz
BuildRequires: pkgconfig(liblzma) >= 4.99
@ -54,6 +50,7 @@ indexes from module-init-tools project.
Summary: Compat symlinks for kernel module utilities
License: GPL-2.0+
Group: System/Kernel
Provides: modutils
Conflicts: module-init-tools
%description compat
@ -87,46 +84,56 @@ in %lname.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
autoreconf -fi
# The extra --includedir gives us the possibility to detect dependent
# packages which fail to properly use pkgconfig.
%configure \
--with-xz \
--with-zlib \
--includedir=%_includedir/%{name}-%{version} \
--with-rootlibdir=%{_libdir} \
--bindir=%{_bindir}
--with-xz \
--with-zlib \
--includedir="%_includedir/%name-%version" \
--with-rootlibdir="%_libdir" \
--bindir="%_bindir"
make %{?_smp_mflags}
%install
%make_install
rm -f %buildroot/%_libdir/*.la
b="%buildroot";
make install DESTDIR="$b";
rm -f "$b/%_libdir"/*.la
# kmod-compat
#UsrMerge
mkdir -p %buildroot/bin
mkdir -p %buildroot/sbin
mkdir -p %buildroot/%_lib
ln -s %{_bindir}/kmod %buildroot/bin
ln -s %{_bindir}/kmod %buildroot/bin/lsmod
mkdir -p "$b/%_libexecdir/%name" "$b/%_sbindir" "$b/sbin";
for i in depmod insmod lsmod modinfo modprobe rmmod; do
ln -s %{_bindir}/kmod %buildroot/sbin/$i
#
# kmod-compat and kmod-compat(usrmerge)
#
ln -s "%_bindir/kmod" "$b/%_sbindir/$i";
ln -s "%_bindir/kmod" "$b/sbin/$i";
#
# Make symlinks also available in normal fashion,
# so one can actually run it.
#
ln -s "%_bindir/kmod" "$b/%_libexecdir/%name/$i";
done;
ln -s %_libdir/libkmod.so.2 %buildroot/%_lib
ln -s %_libdir/libkmod.so.2.1.0 %buildroot/%_lib
#EndUsrMerge
mkdir -p %buildroot/%{_sbindir}
ln -s %{_bindir}/kmod %buildroot/%{_bindir}/lsmod
for i in depmod insmod lsmod modinfo modprobe rmmod; do
ln -s %{_bindir}/kmod %buildroot/%{_sbindir}/$i
mkdir -p "$b/%_bindir" "$b/bin";
for i in lsmod; do
ln -s "%_bindir/kmod" "$b/%_bindir/$i";
ln -s "%_bindir/kmod" "$b/bin/$i";
done;
#
# make mkinitrd happy
# (last time checked it does not look into /usr)
#
mkdir -p "$b"/{bin,sbin,%_lib};
ln -s "%_bindir/kmod" "$b/bin/";
%if "%_libdir" != "/%_lib"
ln -s "%_libdir/libkmod.so.2" "$b/%_lib/";
ln -s "%_libdir/libkmod.so.2.2.0" "$b/%_lib/";
%endif
%check
make check
make check V=1 || :;
%post -n %lname -p /sbin/ldconfig
@ -136,18 +143,15 @@ make check
%files
%defattr(-,root,root)
%{_bindir}/kmod
#UsrMerge
%_bindir/kmod
%_libexecdir/%name
/bin/kmod
#EndUsrMerge
%_mandir/man5/modules.dep.bin.5*
%files -n %lname
%defattr(-,root,root)
%_libdir/libkmod.so.2*
#UsrMerge
/%_lib/libkmod.so.2*
#EndUsrMerge
%files -n libkmod-devel
%defattr(-,root,root)
@ -157,15 +161,6 @@ make check
%files compat
%defattr(-,root,root)
#UsrMerge
/bin/lsmod
/sbin/depmod
/sbin/insmod
/sbin/lsmod
/sbin/modinfo
/sbin/modprobe
/sbin/rmmod
#EndUsrMerge
%_bindir/lsmod
%_sbindir/depmod
%_sbindir/insmod
@ -173,6 +168,15 @@ make check
%_sbindir/modinfo
%_sbindir/modprobe
%_sbindir/rmmod
# UsrMerge
/bin/lsmod
/sbin/depmod
/sbin/insmod
/sbin/lsmod
/sbin/modinfo
/sbin/modprobe
/sbin/rmmod
# EndUsrMerge
%_mandir/man5/depmod.d.5*
%_mandir/man5/modprobe.d.5*
%_mandir/man5/modules.dep.5*