From ad6b974304db9b325ee33defdedd155cb1a7fe40 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 30 May 2012 16:57:16 -0400 Subject: [PATCH] modsign: Fix 32bit ELF table interpretation from David Howells (rhbz 825944) --- kernel.spec | 7 ++++++- modsign-fix-elf-rel.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 modsign-fix-elf-rel.patch diff --git a/kernel.spec b/kernel.spec index 7f022691d..a7c9abd1a 100644 --- a/kernel.spec +++ b/kernel.spec @@ -62,7 +62,7 @@ Summary: The Linux kernel # For non-released -rc kernels, this will be appended after the rcX and # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3" # -%global baserelease 1 +%global baserelease 2 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -676,6 +676,7 @@ Patch800: linux-2.6-crash-driver.patch # crypto/ Patch900: modsign-20120510.patch +Patch901: modsign-fix-elf-rel.patch # virt + ksm patches Patch1555: fix_xen_guest_on_old_EC2.patch @@ -1384,6 +1385,7 @@ ApplyPatch linux-2.6-e1000-ich9-montevina.patch # crypto/ ApplyPatch modsign-20120510.patch +ApplyPatch modsign-fix-elf-rel.patch # Assorted Virt Fixes ApplyPatch fix_xen_guest_on_old_EC2.patch @@ -2298,6 +2300,9 @@ fi # ||----w | # || || %changelog +* Wed May 30 2012 Josh Boyer +- modsign: Fix 32bit ELF table interpretation from David Howells (rhbz 825944) + * Tue May 29 2012 Josh Boyer - 3.5.0-0.rc0.git9.1 - Linux v3.4-8261-ga01ee16 diff --git a/modsign-fix-elf-rel.patch b/modsign-fix-elf-rel.patch new file mode 100644 index 000000000..bced16061 --- /dev/null +++ b/modsign-fix-elf-rel.patch @@ -0,0 +1,26 @@ +--- a/kernel/module-verify.c ++++ a/kernel/module-verify.c +@@ -391,16 +391,19 @@ static int extract_elf_rel(struct module_verify_data *mvdata, + #endif + } __packed relocation; + ++ const Elf_Shdr *relsec, *symsec, *strsec; + const Elf_Rel *reloc; + const Elf_Sym *symbols, *symbol; + const char *strings; + unsigned long r_sym; + size_t nsyms, loop; + +- nsyms = mvdata->sections[secix].sh_size / sizeof(Elf_Sym); +- symbols = mvdata->buffer + mvdata->sections[secix].sh_offset; +- strings = mvdata->buffer + +- mvdata->sections[mvdata->sections[secix].sh_link].sh_offset; ++ relsec = &mvdata->sections[secix]; ++ symsec = &mvdata->sections[relsec->sh_link]; ++ strsec = &mvdata->sections[symsec->sh_link]; ++ nsyms = symsec->sh_size / sizeof(Elf_Sym); ++ symbols = mvdata->buffer + symsec->sh_offset; ++ strings = mvdata->buffer + strsec->sh_offset; + + /* Contribute the relevant bits from a join of + * { REL, SYMBOL, SECTION }