lkml.org 
[lkml]   [2010]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH][GIT PULL][for 2.6.35] tracing: Add alignment to syscall metadata declarations
    On Fri, Jul 09, 2010 at 04:46:14PM -0400, Steven Rostedt wrote:
    > 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.

    In this case the linker does not start a section - we are in the
    middle of an output section.

    *(__syscalls_metadata)

    Is only used to tell the linker that it shall include the content
    of the "__syscalls_metadata" input section in the current output section.

    So what we have here is something like this:

    .data : AT(ADDR(.data) - LOAD_OFFSET) {
    *(_ftrace_events)
    __start_syscalls_metadata = .;
    *(__syscalls_metadata)
    }

    .data is the outpud section - and the linker will align the output section
    to the biggest alignmnet it see within the referenced input sections.

    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.

    Sam


    \
     
     \ /
      Last update: 2010-07-09 22:55    [W:3.552 / U:0.348 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site