public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/23523] New: [systemtap-3.3] Cross compiled stap segfaults during stp script compilation for module.function probe
@ 2018-08-13 22:02 ashis.chandra at gmail dot com
  0 siblings, 0 replies; only message in thread
From: ashis.chandra at gmail dot com @ 2018-08-13 22:02 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23523

            Bug ID: 23523
           Summary: [systemtap-3.3] Cross compiled stap segfaults during
                    stp script compilation for module.function probe
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: ashis.chandra at gmail dot com
  Target Milestone: ---

I have built the elfutils and stap translator on x86_64 (build=x86_64), to run
on x86_64 (host=x86_64) and to generate binaries (.ko) for ARM32 (target=ARM).
I am using this stap till pass 4, only to generate .ko. (I have corresponding
staprun which is built on x86_64, to run on ARM - using which I will actually
run the probe in a ARM target under test)

Probing kernel.function works fine. While I try to probe module.function, the
stap compilation fails with SIGSEGV at pass2.

Note that, On the build m/c I can not compile the script for currently running
kernel - because build arch is x86_64 and the target arch is ARM.

I think the problem is happening because, for loadable modules the translator
could not able to understand the reloc addresses correctly; note the difference
of address range and PC where the probe is supposed to be inserted for a kernel
function probe, and for a module function probe:

SUCCESS: (for kernel.function)
===========
Pass 1: parsed user script and 452 library scripts using
65384virt/43916res/5084shr/38996data kb, in 20usr/120sys/141real ms.
Attempting to extract kernel debuginfo build ID from
/home/uidq2217/Workspace/otp-toolchain-mdm9x28-1.y/../otp-mdm9x28-2.36.2.0/release/fs/devel/../../../package/opensource/linux/vmlinux.id
focused on module 'kernel' = [0xc0000000-0xc09598b4, bias 0 file
/home/uidq2217/Workspace/otp-toolchain-mdm9x28-1.y/../otp-mdm9x28-2.36.2.0/release/fs/devel/../../../package/opensource/linux/vmlinux
ELF machine arm*| (code 40)
probe SyS_read@fs/read_write.c:562 kernel reloc=.dynamic pc=0xc0106598
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using
96152virt/75308res/5884shr/69764data kb, in 340usr/80sys/419real ms.
function recursion-analysis: max-nesting 0  non-recursive
probe 0 ('kernel.function("SyS_read@fs/read_write.c:562")') locks nothing
2 statements for probe probe_3566
Attempting to extract kernel debuginfo build ID from
/home/uidq2217/Workspace/otp-toolchain-mdm9x28-1.y/../otp-mdm9x28-2.36.2.0/release/fs/devel/../../../package/opensource/linux/vmlinux.id
dump_unwindsyms kernel index=0 base=0xc0000000
Found build-id in kernel, length 20, start at 0xc0791fbc

FAIL: (for module.function)
===========
Pass 1: parsed user script and 452 library scripts using
65384virt/43916res/5084shr/38996data kb, in 100usr/10sys/116real ms.
focused on module 'mmc_core' = [0x10000-0x2ce5c, bias 0 file
/home/uidq2217/Workspace/otp-toolchain-mdm9x28-1.y/../otp-mdm9x28-2.36.2.0/release/fs/devel/../../../package/opensource/linux/drivers/mmc/core/mmc_core.ko
ELF machine arm*| (code 40)
probe mmc_attach_mmc@drivers/mmc/core/mmc.c:2781 module=mmc_core pc=0xb81c
./stap-compile.sh: line 18: 59666 Segmentation fault      stap -vv -W -p 4 -g
-a arm -B CROSS_COMPILE=${CROSS} -I ${STAP_TAPSET_PATH} -R ${STAP_RUNTIME_PATH}
-r ${SYSROOT}/../../../package/opensource/linux --sysroot=${SYSROOT} -m
${STAP_MODULE} ${STAP_SCRIPT}

My stap command is:
===================
stap -vv -W -p 4 -g -a arm -B CROSS_COMPILE=${CROSS} -I ${STAP_TAPSET_PATH} -R
${STAP_RUNTIME_PATH} -r ${SYSROOT}/../../../package/opensource/linux
--sysroot=${SYSROOT} -m ${STAP_MODULE} ${STAP_SCRIPT}

I have modified $PATH and $LD_LIBRARY_PATH, to correctly take the cross gcc
toolchain and runtime libraries, while `stap` is invoked.

The stack trace from the core:
==============================
#0  dwarf_query::add_probe_point (this=this@entry=0x7ffeac0bc660,
dw_funcname=..., filename=..., line=line@entry=2781,
scope_die=scope_die@entry=0x383f908, addr=<optimized out>,
    addr@entry=47132) at ../tapsets.cxx:1541
#1  0x0000000000544ed0 in query_statement (func=..., file=...,
line=line@entry=2781, scope_die=scope_die@entry=0x383f908,
stmt_addr=stmt_addr@entry=47132, q=q@entry=0x7ffeac0bc660)
    at ../tapsets.cxx:1810
#2  0x000000000054524d in query_func_info (entrypc=47132, fi=...,
q=q@entry=0x7ffeac0bc660) at ../tapsets.cxx:2095
#3  0x0000000000545a92 in query_cu (cudie=cudie@entry=0x3823500,
q=q@entry=0x7ffeac0bc660) at ../tapsets.cxx:2394
#4  0x0000000000546638 in dwarf_query::query_module_functions
(this=this@entry=0x7ffeac0bc660) at ../tapsets.cxx:2445
#5  0x00000000005477c3 in dwarf_query::query_module_dwarf (this=0x7ffeac0bc660)
at ../tapsets.cxx:1129
#6  0x0000000000549070 in dwarf_query::handle_query_module
(this=0x7ffeac0bc660) at ../tapsets.cxx:1228
#7  0x000000000050766e in query_module (mod=0x37588d0, name=0x3758a80
"mmc_core", addr=65536, q=0x7ffeac0bc660) at ../tapsets.cxx:2642
#8  0x00007fc074f86f71 in dwfl_getmodules (dwfl=0x374b3f0,
callback=callback@entry=0x506d10 <query_module(Dwfl_Module*, void**, char
const*, Dwarf_Addr, base_query*)>,
    arg=arg@entry=0x7ffeac0bc660, offset=1, offset@entry=0) at
../../libdwfl/dwfl_getmodules.c:86
#9  0x00000000005bf563 in dwflpp::iterate_over_modules<void>
(this=this@entry=0x374af50,
    callback=callback@entry=0x506d10 <query_module(Dwfl_Module*, void**, char
const*, Dwarf_Addr, base_query*)>, data=data@entry=0x7ffeac0bc660) at
../dwflpp.cxx:409
#10 0x000000000053bd4f in dwflpp::iterate_over_modules<base_query>
(data=0x7ffeac0bc660, callback=0x506d10 <query_module(Dwfl_Module*, void**,
char const*, Dwarf_Addr, base_query*)>,
    this=0x374af50) at ../dwflpp.h:238
#11 dwarf_builder::build (this=0x373e340, sess=..., base=0x3677db0,
location=0x14bc520, parameters=..., finished_results=std::vector of length 0,
capacity 0) at ../tapsets.cxx:8621
#12 0x0000000000481e54 in match_node::find_and_build (this=0x3740a30, s=...,
p=p@entry=0x3677db0, loc=loc@entry=0x14bc520, pos=pos@entry=3,
results=std::vector of length 0, capacity 0,
    builders=std::set with 0 elements) at ../elaborate.cxx:474
#13 0x000000000048296f in match_node::find_and_build (this=0x3740950, s=...,
p=p@entry=0x3677db0, loc=loc@entry=0x14bc520, pos=pos@entry=2,
results=std::vector of length 0, capacity 0,
    builders=std::set with 0 elements) at ../elaborate.cxx:648
#14 0x000000000048296f in match_node::find_and_build (this=0x3740890, s=...,
p=p@entry=0x3677db0, loc=loc@entry=0x14bc520, pos=pos@entry=1,
results=std::vector of length 0, capacity 0,
    builders=std::set with 0 elements) at ../elaborate.cxx:648
#15 0x000000000048296f in match_node::find_and_build (this=0x10ed240, s=...,
p=p@entry=0x3677db0, loc=loc@entry=0x14bc520, pos=pos@entry=0,
results=std::vector of length 0, capacity 0,
    builders=std::set with 0 elements) at ../elaborate.cxx:648
#16 0x000000000048389d in derive_probes (s=..., p=0x3677db0, dps=std::vector of
length 0, capacity 0, optional=optional@entry=false,
rethrow_errors=rethrow_errors@entry=false)
    at ../elaborate.cxx:1022
#17 0x000000000048666f in semantic_pass_symbols (s=...) at
../elaborate.cxx:1890
#18 0x0000000000496ccc in semantic_pass (s=...) at ../elaborate.cxx:2441
#19 0x0000000000411288 in passes_0_4 (s=...) at ../main.cxx:945
#20 0x000000000040b0f2 in main (argc=<optimized out>, argv=<optimized out>) at
../main.cxx:1412
======================

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-13 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 22:02 [Bug translator/23523] New: [systemtap-3.3] Cross compiled stap segfaults during stp script compilation for module.function probe ashis.chandra at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).