diff options
author | Kevin Tian <kevin.tian@intel.com> | 2010-08-06 16:37:47 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-06 18:33:15 +0100 |
commit | f4cb0870acd980a35e6e87b5bcf548a4452fd6a7 (patch) | |
tree | 7168f1111fed02e9e2367bb2b84481fe6dfbd0c0 /meta/packages/module-init-tools | |
parent | 45d237b3bf7262d0a73098b04e8b162528ba99c0 (diff) | |
download | poky-f4cb0870acd980a35e6e87b5bcf548a4452fd6a7.tar.gz |
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 <mark.hatle@windriver.com>.
Upstream bug is reported as:
https://bugzilla.kernel.org/show_bug.cgi?id=16528
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Diffstat (limited to 'meta/packages/module-init-tools')
4 files changed, 23 insertions, 3 deletions
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 0000000000..9550255315 --- /dev/null +++ b/meta/packages/module-init-tools/files/grab_module_memset.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | # this patch is from Mark Hatle <mark.hatle@windriver.com>, who ran into | ||
2 | # a random segfault using the latest module-init-tools (3.12) and finally | ||
3 | # trace back to depmod.c:grab_module, which appears that the new malloc(...) | ||
4 | # setups up things, but never clears the memory that was just allocated. | ||
5 | # | ||
6 | # Kevin Tian <kevin.tian@intel.com>, 2010-08-06 | ||
7 | |||
8 | diff --git a/depmod.c b/depmod.c | ||
9 | index 647e5e6..46e03e0 100644 | ||
10 | --- a/depmod.c | ||
11 | +++ b/depmod.c | ||
12 | @@ -313,6 +313,7 @@ static struct module *grab_module(const char *dirname, const char *filename) | ||
13 | |||
14 | new = NOFAIL(malloc(sizeof(*new) | ||
15 | + strlen(dirname?:"") + 1 + strlen(filename) + 1)); | ||
16 | + memset(new, 0x00, sizeof(*new) + strlen(dirname?:"") + 1 + strlen(filename) + 1); | ||
17 | if (dirname) | ||
18 | sprintf(new->pathname, "%s/%s", dirname, filename); | ||
19 | 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 c4b4118466..08bf1a95e5 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 @@ | |||
1 | require module-init-tools.inc | 1 | require module-init-tools.inc |
2 | PR = "r0" | 2 | PR = "r1" |
3 | inherit cross | 3 | inherit cross |
4 | PROVIDES += "virtual/${TARGET_PREFIX}depmod virtual/${TARGET_PREFIX}depmod-2.6" | 4 | PROVIDES += "virtual/${TARGET_PREFIX}depmod virtual/${TARGET_PREFIX}depmod-2.6" |
5 | 5 | ||
diff --git a/meta/packages/module-init-tools/module-init-tools.inc b/meta/packages/module-init-tools/module-init-tools.inc index 7c9b3f7fa8..f1319ad90d 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" | |||
13 | SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/module-init-tools/module-init-tools-${PV}.tar.bz2 \ | 13 | SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/module-init-tools/module-init-tools-${PV}.tar.bz2 \ |
14 | file://ignore_arch_directory.patch \ | 14 | file://ignore_arch_directory.patch \ |
15 | file://modutils_extension.patch \ | 15 | file://modutils_extension.patch \ |
16 | file://disable_man.patch" | 16 | file://disable_man.patch \ |
17 | file://grab_module_memset.patch" | ||
17 | 18 | ||
18 | inherit autotools | 19 | inherit autotools |
19 | 20 | ||
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 6fd9d9dc0b..6c312b4cec 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 @@ | |||
1 | require module-init-tools.inc | 1 | require module-init-tools.inc |
2 | PR = "r0" | 2 | PR = "r1" |
3 | 3 | ||
4 | # autotools set prefix to /usr, however we want them in /bin and /sbin | 4 | # autotools set prefix to /usr, however we want them in /bin and /sbin |
5 | bindir = "/bin" | 5 | bindir = "/bin" |