Paul:
I noticed that when passing a zero address to kallsyms_lookup(), the kernel
thought it was a valid kernel address, even if it was not for the specific
architecture I was running things on.This was because is_kernel_extratext() was checking against labels that don't
exist on many archs. Since PPC is the only kernel which defines _extra_text,
(which doesn't seem to be used anymore?) there are three options:
- make the check dependant on PPC
- make the check dependant on extratext being populated
- remove _extra_text support from:
linux-2.6.x/arch/ppc/kernel/vmlinux.lds.S
linux-2.6.x/include/asm-generic/sections.h
linux-2.6.x/kernel/kallsyms.c
linux-2.6.x/scripts/kallsyms.cSince I don't know the history on that label I thought I would ask (since you
seem to be the only arch using it) before I sent a patch.-Robin
Because #1 & #2 are trivial, here is what I was thinking:
- make the check dependant on PPC
===================================================================
--- linux-2.6.x/kernel/kallsyms.c (revision 3760)
+++ linux-2.6.x/kernel/kallsyms.c (working copy)
@@ -51,7 +51,8 @@
static inline int is_kernel_extratext(unsigned long addr)
{
+ #ifdef CONFIG_PPC
if (addr >= (unsigned long)_sextratext
&& addr <= (unsigned long)_eextratext)
return 1;
+ #endif
return 0;
}OR
- make the check dependant on extratext being populated
===================================================================
--- linux-2.6.x/kernel/kallsyms.c (revision 3760)
+++ linux-2.6.x/kernel/kallsyms.c (working copy)
@@ -51,7 +51,8 @@
static inline int is_kernel_extratext(unsigned long addr)
{
if (addr >= (unsigned long)_sextratext
- && addr <= (unsigned long)_eextratext)
+ && addr <= (unsigned long)_eextratext
+ && _sextratext && _eextratext)
return 1;
ret...
OK, it looks like:
David Woodhouse added this functionality 5 May 2005:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commi...and then Jon Loeliger removed everything in this section 17 Sep 2005
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commi...David/Jon:
Is this section still used on PPC, or can the entire support for extratext be removed?
Thanks
-
I think it can die.
--
dwmw2-
Agreed. For history, see this:
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019734.html
and
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019736.html
and
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019751.html
HTH,
jdl-
From: Robin Getz <rgetz@blackfin.uclinux.org>
when passing a zero address to kallsyms_lookup(), the kernel thought it was a
valid kernel address, even if it is not. This is because is_ksym_addr() called
is_kernel_extratext() and checked against labels that don't exist on many
archs (which default as zero). Since PPC was the only kernel which defines
_extra_text, (in 2005), and no longer needs it, this patch removes _extra_text
support.arch/ppc/kernel/vmlinux.lds.S | 5 -----
include/asm-generic/sections.h | 2 --
kernel/kallsyms.c | 11 +----------
scripts/kallsyms.c | 12 +++---------
4 files changed, 4 insertions(+), 26 deletions(-)Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
cc: David Woodhouse <dwmw2@infradead.org>
cc: Jon Loeliger <jdl@freescale.com>
cc: Paul Mackerras <paulus@samba.org>----
For some history (provided by Jon):
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019734.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019736.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019751.htmlIndex: kernel/kallsyms.c
===================================================================
--- kernel/kallsyms.c (revision 3780)
+++ kernel/kallsyms.c (working copy)
@@ -48,14 +48,6 @@
return 0;
}-static inline int is_kernel_extratext(unsigned long addr)
-{
- if (addr >= (unsigned long)_sextratext
- && addr <= (unsigned long)_eextratext)
- return 1;
- return 0;
-}
-
static inline int is_kernel_text(unsigned long addr)
{
if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
@@ -79,8 +71,7 @@
if (all_var)
return is_kernel(addr);- return is_kernel_text(addr) || is_kernel_inittext(addr) ||
- is_kernel_extratext(addr);
+ return is_kernel_text(addr) || is_kernel_inittext(addr);
}/* expand a compressed symbol data into the resulting uncompressed string,
Index: include/asm-ge...
On Fri, 26 Oct 2007 15:43:56 -0400
I hit numerous rejects here. I am not sure which kernel you patched but I
Please prepare patches in `patch -p1' form. This should have been
--- foo/kernel/kallsyms.c (revision 3780)
I don't understand why this hunk is changing _einittext handling, and I
suspect this was a mistake, so I left that bit out.I ended up with this:
From: Robin Getz <rgetz@blackfin.uclinux.org>
When passing a zero address to kallsyms_lookup(), the kernel thought it was
a valid kernel address, even if it is not. This is because is_ksym_addr()
called is_kernel_extratext() and checked against labels that don't exist on
many archs (which default as zero). Since PPC was the only kernel which
defines _extra_text, (in 2005), and no longer needs it, this patch removes
_extra_text support.For some history (provided by Jon):
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019734.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019736.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019751.htmlSigned-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jon Loeliger <jdl@freescale.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---arch/ppc/kernel/vmlinux.lds.S | 5 -----
include/asm-generic/sections.h | 2 --
kernel/kallsyms.c | 11 +----------
scripts/kallsyms.c | 24 ++++++++++--------------
4 files changed, 11 insertions(+), 31 deletions(-)diff -puN arch/ppc/kernel/vmlinux.lds.S~remove-support-for-un-needed-_extratext-section arch/ppc/kernel/vmlinux.lds.S
--- a/arch/ppc/kernel/vmlinux.lds.S~remove-support-for-un-needed-_extratext-section
+++ a/arch/ppc/kernel/vmlinux.lds.S
@@ -143,11 +143,6 @@ SECTIONS. = ALIGN(4096);
__init_end = .;
...
I didn't think I did change the _einittext handling - just removed
_eextratext, and removed the trailing ||, and closed the parentheses for
the if statement.- (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) ||
+ (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")))?
-
i think you'd want:
if (_sextratext && _eextratext &&
... everything else ...
-mike
-
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Hiten Pandya | Re: up? (emacs docbook xml ide) |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| David Miller | Slow DOWN, please!!! |
git: | |
| Evgeniy Polyakov | Re: [BUG] New Kernel Bugs |
| Gerrit Renker | [PATCH 14/37] dccp: Tidy up setsockopt calls |
| David Woodhouse | tun: add tun_flags, owner, group attributes in sysfs |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
