From: Steven Rostedt on
On Fri, 2010-07-09 at 22:33 +0200, Sam Ravnborg wrote:
> On Fri, Jul 09, 2010 at 03:56:42PM -0400, Steven Rostedt wrote:

> This looks like a fix that just hide the real bug.
> If I remember the original report correct the problem is
> that the symbol:
>
> __start_syscalls_metadata
>
> Does not point to a valid syscall entry.
>
> The symbol is assigned in vmlinux.lds.h like this:
> #define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
> *(__syscalls_metadata) \
> VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
>
> Now consider what is happening if we have the following scanario:
>
> . equals 0x1004 so __start_syscalls_metadata is set to 0x1004
> But __syscall_metadata require 8 byte alignment so it starts at 0x1008.


I did not know that the linker could start a section at a half a word
size. That seems to me to be a linker bug.

If a word for a box is 8 bytes than the linker had better start sections
on 8 byte boundaries. Otherwise I would think other things may break.

For 4 byte word boxes, this should be safe anyway.

-- Steve



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on
On Fri, 2010-07-09 at 22:53 +0200, Sam Ravnborg wrote:

> But in this case we have no control of the value of "." (current address)
> when we have processed (_ftrace_events) so it may even be at a 2 byte boundary.
> The linker will add padding as needed to satisfy the alignmnet of
> __syscalls_metadata - but that padding will be inbetween "." and the first
> member in __syscalls_metadata.

Fine, but this is a separate issue. I doubt the "ALIGN(8);" would have
helped us anyway. Remember what the issue we had:

ffffffff8173c438 <__start_syscalls_metadata>:
...

ffffffff8173c440 <__syscall_meta__mmap>:


__start_syscalls_metadata was already aligned to 8, but for some strange
reason, gcc decided to align the first member to 16.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on
On Fri, 2010-07-09 at 14:25 -0700, Linus Torvalds wrote:
> On Fri, Jul 9, 2010 at 1:33 PM, Sam Ravnborg <sam(a)ravnborg.org> wrote:
> >
> > Something like this:
> > (whitespace damaged)
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index 48c5299..64430d3 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -133,7 +133,8 @@
> > #endif
> >
> > #ifdef CONFIG_FTRACE_SYSCALLS
> > -#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
> > +#define TRACE_SYSCALLS() . = ALIGN(8); \
> > + VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
> > *(__syscalls_metadata) \
> > VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
> > #else
>
> If this is confirmed to fix it, then I would much prefer this version.

Zeev,

Can you try Sam's version and remove mine. I'd like to see if that fixes
the issue too.

Thanks,

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/