bk://linux-sam.bkbits.net/kbuild kaos@ocs.com.au|ChangeSet|20050102201755|27523 kaos # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/02 19:02:55-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild # # mm/memory.c # 2005/01/02 19:02:51-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/01/02 21:17:55+01:00 kaos@ocs.com.au # kallsyms: Avoid kallsyms corner case on _etext and _einittext # # Avoid kallsyms corner case on _etext and _einittext with # CONFIG_KALLSYMS_ALL=n. # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # scripts/kallsyms.c # 2005/01/01 11:22:13+01:00 kaos@ocs.com.au +9 -0 # kallsyms: Avoid kallsyms corner case on _etext and _einittext # # ChangeSet # 2005/01/01 19:42:58-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-kbuild # # mm/memory.c # 2005/01/01 19:42:54-08:00 akpm@bix.(none) +0 -0 # Auto merged # # include/linux/mm.h # 2005/01/01 19:42:54-08:00 akpm@bix.(none) +0 -0 # Auto merged # # include/asm-x86_64/page.h # 2005/01/01 19:42:54-08:00 akpm@bix.(none) +0 -0 # Auto merged # # arch/x86_64/mm/init.c # 2005/01/01 19:42:54-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/12/29 00:15:39+01:00 sam@mars.ravnborg.org # kbuild: Use -isystem `gcc --print-file-name=include` # # Using "-nostdinc -isystem `gcc --print-file-name=include" let # us see full path to compiler specific files when compiling with make V=1 # Furthermore it lets us use same definition for sparse (CHECKFLAGS) and the kernel. # Tested with gcc 3.3.4 only. # # Signed-off-by: Sam Ravnborg # # scripts/Makefile.build # 2004/12/29 00:15:17+01:00 sam@mars.ravnborg.org +0 -1 # This assignment is done in top-level Makefile for now # # Makefile # 2004/12/29 00:15:17+01:00 sam@mars.ravnborg.org +3 -1 # Use full path to dir with compiler specific files # # ChangeSet # 2004/12/28 23:00:28+01:00 ahaas@airmail.net # kbuild: Trivial Makefile patch # # The comment doesn't match the function name. # # From: "Art Haas" # Signed-off-by: Sam Ravnborg # # Makefile # 2004/12/24 18:24:28+01:00 ahaas@airmail.net +1 -1 # kbuild: Trivial Makefile patch # # ChangeSet # 2004/12/28 22:59:46+01:00 sam@mars.ravnborg.org # kbuild: skip localversion files with '~' anywhere in their name # # Idea from: Blaisorblade # Signed-off-by: Sam Ravnborg # # Makefile # 2004/12/28 22:59:28+01:00 sam@mars.ravnborg.org +5 -6 # skip localversion files with '~' anywhere in their name # # ChangeSet # 2004/12/28 22:42:36+01:00 mpm@selenic.com # kbuild: make kernelrelease # # This patch makes it easy to programmatically get at the kernel # makefile's idea of the kernel version from external scripts and # makefiles with something like V=`make kernelrelease`. # # Alternatives include parsing Makefile (errorprone and broken by things # like localversion) and running the C preprocessor on version.h (which # requires a) building version.h somewhere and b) is really ugly). # # From: Matt Mackall # Signed-off-by: Sam Ravnborg # # Makefile # 2004/12/21 01:18:25+01:00 mpm@selenic.com +3 -0 # kbuild: make kernelrelease # # ChangeSet # 2004/12/28 22:16:26+01:00 kaos@ocs.com.au # kallsyms: gate page is part of the kernel, honour CONFIG_KALLSYMS_ALL # # * Treat the gate page as part of the kernel, to improve kernel backtraces. # # * Honour CONFIG_KALLSYMS_ALL, all symbols are valid, not just text. # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # kernel/kallsyms.c # 2004/11/28 04:42:24+01:00 kaos@ocs.com.au +11 -4 # kallsyms: gate page is part of the kernel, honour CONFIG_KALLSYMS_ALL # # ChangeSet # 2004/12/28 22:16:00+01:00 kaos@ocs.com.au # kallsyms: Add in_gate_area_no_task() # # Add in_gate_area_no_task() for use in places where no task is valid # (e.g. kallsyms). If you have a valid task, use in_gate_area() as # before. # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # mm/memory.c # 2004/11/28 04:42:20+01:00 kaos@ocs.com.au +1 -1 # kallsyms: Add in_gate_area_no_task() # # include/linux/mm.h # 2004/11/28 04:42:20+01:00 kaos@ocs.com.au +6 -0 # kallsyms: Add in_gate_area_no_task() # # arch/x86_64/mm/init.c # 2004/11/28 04:42:20+01:00 kaos@ocs.com.au +10 -0 # kallsyms: Add in_gate_area_no_task() # # ChangeSet # 2004/12/28 22:15:34+01:00 kaos@ocs.com.au # kallsyms: Clean up x86-64 special casing of in_gate_area() # # x86-64 has special case code for in_gate_area(), but it is not clean. # # * Replace CONFIG_ARCH_GATE_AREA with __HAVE_ARCH_GATE_AREA. # ARCH_GATE_AREA is not a config option. # # * The definitions of get_gate_vma() and in_gate_area() are identical in # include/asm-x86_64/page.h and include/linux/mm.h. Fold the duplicate # definitions into include/linux/mm.h. # # Does not affect kallsyms directly, this patch just creates a clean base # for patch 2. # # Signed-off-by: Keith Owens # Signed-off-by: Sam Ravnborg # # mm/memory.c # 2004/11/28 04:42:14+01:00 kaos@ocs.com.au +2 -2 # kallsyms: Clean up x86-64 special casing of in_gate_area() # # include/linux/mm.h # 2004/11/28 04:42:14+01:00 kaos@ocs.com.au +0 -2 # kallsyms: Clean up x86-64 special casing of in_gate_area() # # include/asm-x86_64/page.h # 2004/11/28 04:42:14+01:00 kaos@ocs.com.au +1 -7 # kallsyms: Clean up x86-64 special casing of in_gate_area() # # ChangeSet # 2004/12/28 19:12:15+01:00 sam@mars.ravnborg.org # kbuild: drop use of /usr/bin/env in top-level Makefile # # The use of env is not needed, and caused the output makefile to be # created in some setups where it was not supposed to. # Seems to be an issue with GNU sh-utils version of env. # # One user also reported env to be located in another place (/usr/local/bin/..). # This patch fixes bug: http://bugme.osdl.org/show_bug.cgi?id=3953 # # Thanks to "Mark Williams (MWP)" for helping tracking this down. # # Signed-off-by: Sam Ravnborg # # Makefile # 2004/12/28 19:11:36+01:00 sam@mars.ravnborg.org +1 -1 # Drop usage of /usr/bin/env # diff -Nru a/Makefile b/Makefile --- a/Makefile 2005-01-02 23:12:32 -08:00 +++ b/Makefile 2005-01-02 23:12:32 -08:00 @@ -149,14 +149,13 @@ # careful not to include files twice if building in the source # directory. LOCALVERSION from the command line override all of this -ifeq ($(objtree),$(srctree)) -localversion-files := $(wildcard $(srctree)/localversion*) -else -localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*) -endif +localver := $(objtree)/localversion* $(srctree)/localversion* +localver := $(sort $(wildcard $(localver))) +# skip backup files (containing '~') +localver := $(foreach f, $(localver), $(if $(findstring ~, $(f)),,$(f))) LOCALVERSION = $(subst $(space),, \ - $(shell cat /dev/null $(localversion-files:%~=)) \ + $(shell cat /dev/null $(localver)) \ $(patsubst "%",%,$(CONFIG_LOCALVERSION))) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) @@ -291,7 +290,7 @@ $(call cc-option, $(1),$(2)) # cc-option-yn -# Usage: flag := $(call gcc-option-yn, -march=winchip-c6) +# Usage: flag := $(call cc-option-yn, -march=winchip-c6) cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) @@ -331,7 +330,10 @@ KALLSYMS = scripts/kallsyms PERL = perl CHECK = sparse + +NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ +CHECKFLAGS += $(NOSTDINC_FLAGS) MODFLAGS = -DMODULE CFLAGS_MODULE = $(MODFLAGS) AFLAGS_MODULE = $(MODFLAGS) @@ -339,7 +341,6 @@ CFLAGS_KERNEL = AFLAGS_KERNEL = -NOSTDINC_FLAGS = -nostdinc -iwithprefix include # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option @@ -389,7 +390,7 @@ # using a seperate output directory. This allows convinient use # of make in output directory outputmakefile: - $(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \ + $(Q)if test ! $(srctree) -ef $(objtree); then \ $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ > $(objtree)/Makefile; \ @@ -1209,6 +1210,9 @@ checkstack: $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ $(PERL) $(src)/scripts/checkstack.pl $(ARCH) + +kernelrelease: + @echo $(KERNELRELEASE) # FIXME Should go into a make.lib or something # =========================================================================== diff -Nru a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c --- a/arch/x86_64/mm/init.c 2005-01-02 23:12:32 -08:00 +++ b/arch/x86_64/mm/init.c 2005-01-02 23:12:32 -08:00 @@ -614,3 +614,13 @@ struct vm_area_struct *vma = get_gate_vma(task); return (addr >= vma->vm_start) && (addr < vma->vm_end); } + +/* Use this when you have no reliable task/vma, typically from interrupt + * context. It is less reliable than using the task's vma and may give + * false positives. + */ +int in_gate_area_no_task(unsigned long addr) +{ + return ((addr >= VSYSCALL_START) && (addr < VSYSCALL_END) || + (addr >= VSYSCALL32_BASE) && (addr < VSYSCALL32_END)); +} diff -Nru a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h --- a/include/asm-x86_64/page.h 2005-01-02 23:12:32 -08:00 +++ b/include/asm-x86_64/page.h 2005-01-02 23:12:32 -08:00 @@ -134,13 +134,7 @@ (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#define CONFIG_ARCH_GATE_AREA 1 - -#ifndef __ASSEMBLY__ -struct task_struct; -struct vm_area_struct *get_gate_vma(struct task_struct *tsk); -int in_gate_area(struct task_struct *task, unsigned long addr); -#endif +#define __HAVE_ARCH_GATE_AREA 1 #endif /* __KERNEL__ */ diff -Nru a/include/linux/mm.h b/include/linux/mm.h --- a/include/linux/mm.h 2005-01-02 23:12:32 -08:00 +++ b/include/linux/mm.h 2005-01-02 23:12:32 -08:00 @@ -813,10 +813,14 @@ } #endif -#ifndef CONFIG_ARCH_GATE_AREA extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); +#ifdef __HAVE_ARCH_GATE_AREA +int in_gate_area_no_task(unsigned long addr); int in_gate_area(struct task_struct *task, unsigned long addr); -#endif +#else +int in_gate_area_no_task(unsigned long addr); +#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) +#endif /* __HAVE_ARCH_GATE_AREA */ #endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */ diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c --- a/kernel/kallsyms.c 2005-01-02 23:12:32 -08:00 +++ b/kernel/kallsyms.c 2005-01-02 23:12:32 -08:00 @@ -18,6 +18,13 @@ #include #include #include +#include + +#ifdef CONFIG_KALLSYMS_ALL +#define all_var 1 +#else +#define all_var 0 +#endif /* These will be re-linked against their real values during the second link stage */ extern unsigned long kallsyms_addresses[] __attribute__((weak)); @@ -30,7 +37,7 @@ extern unsigned long kallsyms_markers[] __attribute__((weak)); /* Defined by the linker script. */ -extern char _stext[], _etext[], _sinittext[], _einittext[]; +extern char _stext[], _etext[], _sinittext[], _einittext[], _end[]; static inline int is_kernel_inittext(unsigned long addr) { @@ -44,7 +51,7 @@ { if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) return 1; - return 0; + return in_gate_area_no_task(addr); } /* expand a compressed symbol data into the resulting uncompressed string, @@ -147,7 +154,7 @@ namebuf[KSYM_NAME_LEN] = 0; namebuf[0] = 0; - if (is_kernel_text(addr) || is_kernel_inittext(addr)) { + if (all_var || is_kernel_text(addr) || is_kernel_inittext(addr)) { unsigned long symbol_end=0; /* do a binary search on the sorted kallsyms_addresses array */ @@ -181,7 +188,7 @@ if (is_kernel_inittext(addr)) symbol_end = (unsigned long)_einittext; else - symbol_end = (unsigned long)_etext; + symbol_end = all_var ? (unsigned long)_end : (unsigned long)_etext; } *symbolsize = symbol_end - kallsyms_addresses[low]; diff -Nru a/mm/memory.c b/mm/memory.c --- a/mm/memory.c 2005-01-02 23:12:32 -08:00 +++ b/mm/memory.c 2005-01-02 23:12:32 -08:00 @@ -2094,7 +2094,7 @@ EXPORT_SYMBOL(vmalloc_to_pfn); -#if !defined(CONFIG_ARCH_GATE_AREA) +#if !defined(__HAVE_ARCH_GATE_AREA) #if defined(AT_SYSINFO_EHDR) struct vm_area_struct gate_vma; @@ -2120,7 +2120,7 @@ #endif } -int in_gate_area(struct task_struct *task, unsigned long addr) +int in_gate_area_no_task(unsigned long addr) { #ifdef AT_SYSINFO_EHDR if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END)) @@ -2129,4 +2129,4 @@ return 0; } -#endif +#endif /* __HAVE_ARCH_GATE_AREA */ diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build --- a/scripts/Makefile.build 2005-01-02 23:12:32 -08:00 +++ b/scripts/Makefile.build 2005-01-02 23:12:32 -08:00 @@ -83,7 +83,6 @@ # Linus' kernel sanity checking tool ifneq ($(KBUILD_CHECKSRC),0) - CHECKFLAGS += -I$(shell $(CC) -print-file-name=include) ifeq ($(KBUILD_CHECKSRC),2) quiet_cmd_force_checksrc = CHECK $< cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; diff -Nru a/scripts/kallsyms.c b/scripts/kallsyms.c --- a/scripts/kallsyms.c 2005-01-02 23:12:32 -08:00 +++ b/scripts/kallsyms.c 2005-01-02 23:12:32 -08:00 @@ -184,6 +184,15 @@ if ((s->addr < _stext || s->addr > _etext) && (s->addr < _sinittext || s->addr > _einittext)) return 0; + /* Corner case. Discard any symbols with the same value as + * _etext or _einittext, they can move between pass 1 and 2 + * when the kallsyms data is added. If these symbols move then + * they may get dropped in pass 2, which breaks the kallsyms + * rules. + */ + if ((s->addr == _etext && strcmp(s->sym + 1, "_etext")) || + (s->addr == _einittext && strcmp(s->sym + 1, "_einittext"))) + return 0; } /* Exclude symbols which vary between passes. */