modsign: Fix 32bit ELF table interpretation from David Howells (rhbz 825944)

This commit is contained in:
Josh Boyer 2012-05-30 16:57:16 -04:00
parent be64ba5ea6
commit ad6b974304
2 changed files with 32 additions and 1 deletions

View File

@ -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 <jwboyer@redhat.com>
- modsign: Fix 32bit ELF table interpretation from David Howells (rhbz 825944)
* Tue May 29 2012 Josh Boyer <jwboyer@redhat.com> - 3.5.0-0.rc0.git9.1
- Linux v3.4-8261-ga01ee16

26
modsign-fix-elf-rel.patch Normal file
View File

@ -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 }