From 1c938663d58b5b2965976a6f54cc51b5d6f691aa Mon Sep 17 00:00:00 2001 From: Krzysztof Halasa Date: Fri, 11 Jun 2010 01:08:20 +0200 Subject: kbuild: Fix modpost segfault MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alan writes: > program: /home/alan/GitTrees/linux-2.6-mid-ref/scripts/mod/modpost -o > Module.symvers -S vmlinux.o > > Program received signal SIGSEGV, Segmentation fault. It just hit me. It's the offset calculation in reloc_location() which overflows: return (void *)elf->hdr + sechdrs[section].sh_offset + (r->r_offset - sechdrs[section].sh_addr); E.g. for the first rodata r entry: r->r_offset < sechdrs[section].sh_addr and the expression in the parenthesis produces 0xFFFFFFE0 or something equally wise. Reported-by: Alan Signed-off-by: Krzysztof HaƂasa Tested-by: Alan Signed-off-by: Michal Marek --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3318692e4e7..f8779006986 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1342,7 +1342,7 @@ static unsigned int *reloc_location(struct elf_info *elf, int section = sechdr->sh_info; return (void *)elf->hdr + sechdrs[section].sh_offset + - (r->r_offset - sechdrs[section].sh_addr); + r->r_offset - sechdrs[section].sh_addr; } static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) -- cgit v1.2.3 From d5eda75f3a6a08f5a3644764a88d288e62e7823d Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 14 Jun 2010 10:41:10 +0100 Subject: kbuild: fix LOCALVERSION handling to match description In the commit below the version string handling was modified, adding a '+' where no other version information was supplied: commit 85a256d8e0116c8f5ad276730830f5d4d473344d Author: David Rientjes Date: Wed Jan 13 13:01:05 2010 -0800 From the commit the intent was as below: - when CONFIG_LOCALVERSION_AUTO is disabled, a `+' is appended if the repository has been revised beyond a tagged commit and LOCALVERSION= was not passed to "make". However if the user supplies an empty LOCALVERSION on the command line the plus suffix is still added. This form is useful in the case where the build environment knows that the version as specified is correct and complete but does not correspond to a specific tag. This patch changes the implementation to match the documentation such that specifying LOCALVERSION= on the build line is sufficient to suppress any suffix. Signed-off-by: Andy Whitcroft Acked-by: David Rientjes Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 993d1f33592..324130c682d 100644 --- a/Makefile +++ b/Makefile @@ -944,7 +944,7 @@ ifdef CONFIG_LOCALVERSION_AUTO localver-extra = $(scm-identifier) else ifneq ($(scm-identifier),) - ifeq ($(LOCALVERSION),) + ifeq ("$(origin LOCALVERSION)", "undefined") localver-extra = + endif endif -- cgit v1.2.3