From f4cb0870acd980a35e6e87b5bcf548a4452fd6a7 Mon Sep 17 00:00:00 2001 From: Kevin Tian Date: Fri, 6 Aug 2010 16:37:47 +0800 Subject: module-init-tools: fix depmod caused segfault issue memset is required after malloc in grab_module, or else random segfault may happen. The fix is from Mark Hatle . Upstream bug is reported as: https://bugzilla.kernel.org/show_bug.cgi?id=16528 Signed-off-by: Kevin Tian --- .../module-init-tools/files/grab_module_memset.patch | 19 +++++++++++++++++++ .../module-init-tools/module-init-tools-cross_3.12.bb | 2 +- meta/packages/module-init-tools/module-init-tools.inc | 3 ++- .../module-init-tools/module-init-tools_3.12.bb | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 meta/packages/module-init-tools/files/grab_module_memset.patch diff --git a/meta/packages/module-init-tools/files/grab_module_memset.patch b/meta/packages/module-init-tools/files/grab_module_memset.patch new file mode 100644 index 000000000..955025531 --- /dev/null +++ b/meta/packages/module-init-tools/files/grab_module_memset.patch @@ -0,0 +1,19 @@ +# this patch is from Mark Hatle , who ran into +# a random segfault using the latest module-init-tools (3.12) and finally +# trace back to depmod.c:grab_module, which appears that the new malloc(...) +# setups up things, but never clears the memory that was just allocated. +# +# Kevin Tian , 2010-08-06 + +diff --git a/depmod.c b/depmod.c +index 647e5e6..46e03e0 100644 +--- a/depmod.c ++++ b/depmod.c +@@ -313,6 +313,7 @@ static struct module *grab_module(const char *dirname, const char *filename) + + new = NOFAIL(malloc(sizeof(*new) + + strlen(dirname?:"") + 1 + strlen(filename) + 1)); ++ memset(new, 0x00, sizeof(*new) + strlen(dirname?:"") + 1 + strlen(filename) + 1); + if (dirname) + sprintf(new->pathname, "%s/%s", dirname, filename); + else diff --git a/meta/packages/module-init-tools/module-init-tools-cross_3.12.bb b/meta/packages/module-init-tools/module-init-tools-cross_3.12.bb index c4b411846..08bf1a95e 100644 --- a/meta/packages/module-init-tools/module-init-tools-cross_3.12.bb +++ b/meta/packages/module-init-tools/module-init-tools-cross_3.12.bb @@ -1,5 +1,5 @@ require module-init-tools.inc -PR = "r0" +PR = "r1" inherit cross PROVIDES += "virtual/${TARGET_PREFIX}depmod virtual/${TARGET_PREFIX}depmod-2.6" diff --git a/meta/packages/module-init-tools/module-init-tools.inc b/meta/packages/module-init-tools/module-init-tools.inc index 7c9b3f7fa..f1319ad90 100644 --- a/meta/packages/module-init-tools/module-init-tools.inc +++ b/meta/packages/module-init-tools/module-init-tools.inc @@ -13,7 +13,8 @@ FILES_module-init-tools-insmod-static = "${sbindir}/insmod.static" SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/module-init-tools/module-init-tools-${PV}.tar.bz2 \ file://ignore_arch_directory.patch \ file://modutils_extension.patch \ - file://disable_man.patch" + file://disable_man.patch \ + file://grab_module_memset.patch" inherit autotools diff --git a/meta/packages/module-init-tools/module-init-tools_3.12.bb b/meta/packages/module-init-tools/module-init-tools_3.12.bb index 6fd9d9dc0..6c312b4ce 100644 --- a/meta/packages/module-init-tools/module-init-tools_3.12.bb +++ b/meta/packages/module-init-tools/module-init-tools_3.12.bb @@ -1,5 +1,5 @@ require module-init-tools.inc -PR = "r0" +PR = "r1" # autotools set prefix to /usr, however we want them in /bin and /sbin bindir = "/bin" -- cgit v1.2.3