11 Sep, 2015

1 commit


20 Nov, 2014

1 commit

  • Stack traces that happen from function tracing check if the address
    on the stack is a __kernel_text_address(). That is, is the address
    kernel code. This calls core_kernel_text() which returns true
    if the address is part of the builtin kernel code. It also calls
    is_module_text_address() which returns true if the address belongs
    to module code.

    But what is missing is ftrace dynamically allocated trampolines.
    These trampolines are allocated for individual ftrace_ops that
    call the ftrace_ops callback functions directly. But if they do a
    stack trace, the code checking the stack wont detect them as they
    are neither core kernel code nor module address space.

    Adding another field to ftrace_ops that also stores the size of
    the trampoline assigned to it we can create a new function called
    is_ftrace_trampoline() that returns true if the address is a
    dynamically allocate ftrace trampoline. Note, it ignores trampolines
    that are not dynamically allocated as they will return true with
    the core_kernel_text() function.

    Link: http://lkml.kernel.org/r/20141119034829.497125839@goodmis.org

    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Acked-by: Thomas Gleixner
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

14 Feb, 2014

1 commit

  • main_extable_sort_needed is used by the build system and needs
    to be a normal ELF symbol. Make it visible so that LTO
    does not remove or mangle it.

    Signed-off-by: Andi Kleen
    Link: http://lkml.kernel.org/r/1391845930-28580-8-git-send-email-ak@linux.intel.com
    Signed-off-by: H. Peter Anvin

    Andi Kleen
     

29 Nov, 2013

1 commit


12 Sep, 2013

1 commit

  • At least on ARM no-MMU the extable is empty and so there is nothing to
    sort. So add a check for the table to be empty which effectively only
    changes that the misleading pr_notice is suppressed.

    Signed-off-by: Uwe Kleine-König
    Cc: Ingo Molnar
    Cc: David Daney
    Cc: "H. Peter Anvin"
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

15 Apr, 2013

1 commit

  • Now that we do sort the __extable at build time, we actually are
    interested only in the case where we still do need to sort it.

    Signed-off-by: Borislav Petkov
    Cc: David Daney
    Link: http://lkml.kernel.org/r/1366023109-12098-1-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Borislav Petkov
     

20 Apr, 2012

1 commit


20 May, 2011

2 commits

  • A new utility function (core_kernel_data()) is used to determine if a
    passed in address is part of core kernel data or not. It may or may not
    return true for RO data, but this utility must work for RW data.

    Thus both _sdata and _edata must be defined and continuous,
    without .init sections that may later be freed and replaced by
    volatile memory (memory that can be freed).

    This utility function is used to determine if data is safe from
    ever being freed. Thus it should return true for all RW global
    data that is not in a module or has been allocated, or false
    otherwise.

    Also change core_kernel_data() back to the more precise _sdata condition
    and document the function.

    Signed-off-by: Steven Rostedt
    Acked-by: Ralf Baechle
    Acked-by: Hirokazu Takata
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Cc: Geert Uytterhoeven
    Cc: Roman Zippel
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: Kyle McMartin
    Cc: Helge Deller
    Cc: JamesE.J.Bottomley
    Link: http://lkml.kernel.org/r/1305855298.1465.19.camel@gandalf.stny.rr.com
    Signed-off-by: Ingo Molnar
    ----
    arch/alpha/kernel/vmlinux.lds.S | 1 +
    arch/m32r/kernel/vmlinux.lds.S | 1 +
    arch/m68k/kernel/vmlinux-std.lds | 2 ++
    arch/m68k/kernel/vmlinux-sun3.lds | 1 +
    arch/mips/kernel/vmlinux.lds.S | 1 +
    arch/parisc/kernel/vmlinux.lds.S | 3 +++
    kernel/extable.c | 12 +++++++++++-
    7 files changed, 20 insertions(+), 1 deletion(-)

    Steven Rostedt
     
  • Some architectures such as Alpha do not define _sdata but _data:

    kernel/built-in.o: In function `core_kernel_data':
    kernel/extable.c:77: undefined reference to `_sdata'

    So expand the scope of the data range to the text addresses too,
    this might be more correct anyway because this way we can
    cover readonly variables as well.

    Cc: Paul E. McKenney
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-i878c8a0e0g0ep4v7i6vxnhz@git.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

19 May, 2011

1 commit

  • Now that functions may be selected individually, it only makes sense
    that we should allow dynamically allocated trace structures to
    be traced. This will allow perf to allocate a ftrace_ops structure
    at runtime and use it to pick and choose which functions that
    structure will trace.

    Note, a dynamically allocated ftrace_ops will always be called
    indirectly instead of being called directly from the mcount in
    entry.S. This is because there's no safe way to prevent mcount
    from being preempted before calling the function, unless we
    modify every entry.S to do so (not likely). Thus, dynamically allocated
    functions will now be called by the ftrace_ops_list_func() that
    loops through the ops that are allocated if there are more than
    one op allocated at a time. This loop is protected with a
    preempt_disable.

    To determine if an ftrace_ops structure is allocated or not, a new
    util function was added to the kernel/extable.c called
    core_kernel_data(), which returns 1 if the address is between
    _sdata and _edata.

    Cc: Paul E. McKenney
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

06 Apr, 2009

2 commits

  • * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (413 commits)
    tracing, net: fix net tree and tracing tree merge interaction
    tracing, powerpc: fix powerpc tree and tracing tree interaction
    ring-buffer: do not remove reader page from list on ring buffer free
    function-graph: allow unregistering twice
    trace: make argument 'mem' of trace_seq_putmem() const
    tracing: add missing 'extern' keywords to trace_output.h
    tracing: provide trace_seq_reserve()
    blktrace: print out BLK_TN_MESSAGE properly
    blktrace: extract duplidate code
    blktrace: fix memory leak when freeing struct blk_io_trace
    blktrace: fix blk_probes_ref chaos
    blktrace: make classic output more classic
    blktrace: fix off-by-one bug
    blktrace: fix the original blktrace
    blktrace: fix a race when creating blk_tree_root in debugfs
    blktrace: fix timestamp in binary output
    tracing, Text Edit Lock: cleanup
    tracing: filter fix for TRACE_EVENT_FORMAT events
    ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release()
    x86: kretprobe-booster interrupt emulation code fix
    ...

    Fix up trivial conflicts in
    arch/parisc/include/asm/ftrace.h
    include/linux/memory.h
    kernel/extable.c
    kernel/module.c

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-module-and-param:
    module: use strstarts()
    strstarts: helper function for !strncmp(str, prefix, strlen(prefix))
    arm: allow usage of string functions in linux/string.h
    module: don't use stop_machine on module load
    module: create a request_module_nowait()
    module: include other structures in module version check
    module: remove the SHF_ALLOC flag on the __versions section.
    module: clarify the force-loading taint message.
    module: Export symbols needed for Ksplice
    Ksplice: Add functions for walking kallsyms symbols
    module: remove module_text_address()
    module: __module_address
    module: Make find_symbol return a struct kernel_symbol
    kernel/module.c: fix an unused goto label
    param: fix charp parameters set via sysfs

    Fix trivial conflicts in kernel/extable.c manually.

    Linus Torvalds
     

31 Mar, 2009

1 commit

  • Impact: Replace and remove risky (non-EXPORTed) API

    module_text_address() returns a pointer to the module, which given locking
    improvements in module.c, is useless except to test for NULL:

    1) If the module can't go away, use __module_text_address.
    2) Otherwise, just use is_module_text_address().

    Cc: linux-mtd@lists.infradead.org
    Signed-off-by: Rusty Russell

    Rusty Russell
     

23 Mar, 2009

1 commit

  • Impact: cleanup.

    The global mutex text_mutex if declared in linux/memory.h, so
    this file needs to be included into kernel/extable.c, where the
    same mutex is defined. This fixes the following sparse warning:

    kernel/extable.c:32:1: warning: symbol 'text_mutex' was not declared.
    Should it be static?

    Signed-off-by: Dmitri Vorobiev
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Dmitri Vorobiev
     

20 Mar, 2009

1 commit

  • Impact: build fix on SH !CONFIG_MMU

    Stephen Rothwell reported this linux-next build failure on the SH
    architecture:

    kernel/built-in.o: In function `disable_all_kprobes':
    kernel/kprobes.c:1382: undefined reference to `text_mutex'
    [...]

    And observed:

    | Introduced by commit 4460fdad85becd569f11501ad5b91814814335ff ("tracing,
    | Text Edit Lock - kprobes architecture independent support") from the
    | tracing tree. text_mutex is defined in mm/memory.c which is only built
    | if CONFIG_MMU is defined, which is not true for sh allmodconfig.

    Move this lock to kernel/extable.c (which is already home to various
    kernel text related routines), which file is always built-in.

    Reported-by: Stephen Rothwell
    Cc: Paul Mundt
    Cc: Mathieu Desnoyers
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

19 Mar, 2009

1 commit

  • Impact: fix incomplete stacktraces

    I noticed such weird stacktrace entries in lockdep dumps:

    [ 0.285956] {HARDIRQ-ON-W} state was registered at:
    [ 0.285956] [] mark_irqflags+0xbe/0x125
    [ 0.285956] [] __lock_acquire+0x674/0x82d
    [ 0.285956] [] lock_acquire+0xfc/0x128
    [ 0.285956] [] rt_spin_lock+0xc8/0xd0
    [ 0.285956] [] 0xffffffffffffffff

    The stacktrace entry is cut off after rt_spin_lock.

    After much debugging i found out that stacktrace entries that
    belong to init symbols dont get printed out, due to commit:

    a2da405: module: Don't report discarded init pages as kernel text.

    The reason is this check added to core_kernel_text():

    - if (addr >= (unsigned long)_sinittext &&
    + if (system_state == SYSTEM_BOOTING &&
    + addr >= (unsigned long)_sinittext &&
    addr
    Cc: Rusty Russell
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

09 Feb, 2009

1 commit

  • When the function graph tracer picks a return address, it ensures this address
    is really a kernel text one by calling __kernel_text_address()

    Actually this path has never been taken.Its role was more likely to debug the tracer
    on the beginning of its development but this function is wasteful since it is called
    for every traced function.

    The fault check is already sufficient.

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

31 Dec, 2008

1 commit

  • * 'core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (63 commits)
    stacktrace: provide save_stack_trace_tsk() weak alias
    rcu: provide RCU options on non-preempt architectures too
    printk: fix discarding message when recursion_bug
    futex: clean up futex_(un)lock_pi fault handling
    "Tree RCU": scalable classic RCU implementation
    futex: rename field in futex_q to clarify single waiter semantics
    x86/swiotlb: add default swiotlb_arch_range_needs_mapping
    x86/swiotlb: add default physbus conversion
    x86: unify pci iommu setup and allow swiotlb to compile for 32 bit
    x86: add swiotlb allocation functions
    swiotlb: consolidate swiotlb info message printing
    swiotlb: support bouncing of HighMem pages
    swiotlb: factor out copy to/from device
    swiotlb: add arch hook to force mapping
    swiotlb: allow architectures to override physbusphys conversions
    swiotlb: add comment where we handle the overflow of a dma mask on 32 bit
    rcu: fix rcutorture behavior during reboot
    resources: skip sanity check of busy resources
    swiotlb: move some definitions to header
    swiotlb: allow architectures to override swiotlb pool allocation
    ...

    Fix up trivial conflicts in
    arch/x86/kernel/Makefile
    arch/x86/mm/init_32.c
    include/linux/hardirq.h
    as per Ingo's suggestions.

    Linus Torvalds
     

08 Dec, 2008

1 commit

  • Impact: trace more functions

    When the function graph tracer is configured, three more files are not
    traced to prevent only four functions to be traced. And this impacts the
    normal function tracer too.

    arch/x86/kernel/process_64/32.c:

    I had crashes when I let this file traced. After some debugging, I saw
    that the "current" task point was changed inside__swtich_to(), ie:
    "write_pda(pcurrent, next_p);" inside process_64.c Since the tracer store
    the original return address of the function inside current, we had
    crashes. Only __switch_to() has to be excluded from tracing.

    kernel/module.c and kernel/extable.c:

    Because of a function used internally by the function graph tracer:
    __kernel_text_address()

    To let the other functions inside these files to be traced, this patch
    introduces the __notrace_funcgraph function prefix which is __notrace if
    function graph tracer is configured and nothing if not.

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

10 Sep, 2008

1 commit


29 Jan, 2008

1 commit

  • Current code could cause a bug in symbol_put_addr() if an arch used
    kmalloc module text: we might think the symbol belongs to the core
    kernel.

    The downside is that this might make backtraces through (discarded)
    init functions harder to read on some archs, but we already have that
    issue for modules and noone has complained.

    Signed-off-by: Rusty Russell

    Rusty Russell
     

16 May, 2006

1 commit

  • Even since a previous patch:

    Fix race between CONFIG_DEBUG_SLABALLOC and modules
    Sun, 27 Jun 2004 17:55:19 +0000 (17:55 +0000)
    http://www.kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commit;h=92b3db26d31cf21b70e3c1eadc56c179506d8fbe

    The function symbol_put_addr() will deadlock the kernel.

    symbol_put_addr() would acquire modlist_lock, then while holding the lock call
    two functions kernel_text_address() and module_text_address() which also try
    to acquire the same lock. This deadlocks the kernel of course.

    This patch changes symbol_put_addr() to not acquire the modlist_lock, it
    doesn't need it since it never looks at the module list directly. Also, it
    now uses core_kernel_text() instead of kernel_text_address(). The latter has
    an additional check for addr inside a module, but we don't need to do that
    since we call module_text_address() (the same function kernel_text_address
    uses) ourselves.

    Signed-off-by: Trent Piepho
    Cc: Zwane Mwaikambo
    Acked-by: Rusty Russell
    Cc: Johannes Stezenbach
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trent Piepho
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds