Re: Segmentation fault running lttctl on SH4 target.

Mathieu Desnoyers <[email protected]> Tue, 13 Nov 2007 07:41:30 -0500
Newsgroups gmane.linux.kernel.tracing
Message-ID <20071113124130.GA7128@Krystal>
* Giuseppe Cavallaro ([email protected]) wrote:
> Hi,
> using both lttng pre7 and pre 14 on my kernel 2.6.23.1 on SH4 target.
> (sorry but I've not added pre23 yet)
> I get a segmentation fault as soon as I run ltt control.
> 
> ------------------------------------------------------
> This is my kernel configuration (only LTT options):
>     ...
>     CONFIG_INSTRUMENTATION=y
>     # CONFIG_PROFILING is not set
>     CONFIG_MARKERS=y
>     CONFIG_LTT_TIMESTAMP=y
>     CONFIG_LTT_SYNTHETIC_TSC=y
>     CONFIG_ARCH_HAS_LTT_CLOCK=y
>     CONFIG_LTT=y
>     CONFIG_LTT_RELAY=y
>     CONFIG_LTT_SERIALIZE=y
>     CONFIG_LTT_MARKER_CONTROL=y
>     CONFIG_LTT_TRACER=y
>     CONFIG_LTT_ALIGNMENT=y
>     CONFIG_LTT_VMCORE=y
>     CONFIG_LTT_HEARTBEAT=y
>     CONFIG_LTT_NETLINK_CONTROL=y
>     CONFIG_LTT_STATEDUMP=y
> 
>     #
>     # Probes
>     #
>     CONFIG_LTT_PROBE_FS=y
>     ...
> --------------------------------------------------------------------
> So after runnig ltt-armall I run the following
> 
> root@root:/home/root# lttctl -n trace -d -l /mnt/debugfs/ltt -t
> /home/root/trace/
> Linux Trace Toolkit Trace Control 0.45-11102007
> 
> ltt_control : trace trace
> 
> 
> Unable to handle kernel paging request at virtual address c045fffc
> pc = 84164fe2
> *pde = 00000000
> Oops: 0001 [#1]
> Modules linked in:
> 
> Pid : 288, Comm:               lttctl
> PC is at memset+0x2e/0x48
> PC  : 84164fe2 SP  : 871c5c80 SR  : 40008000 TEA : c045fffc    Not tainted
> R0  : 0003ffff R1  : 00000000 R2  : 40008001 R3  : ff00001c
> R4  : c0460000 R5  : 00000000 R6  : 00200000 R7  : 00000000
> R8  : c0260000 R9  : 00000000 R10 : 00000200 R11 : 84565a60
> R12 : 87697400 R13 : 87697400 R14 : 84565a20
> MACH: 00000000 MACL: 00000000 GBR : 29695450 PR  : 840492dc
> 
> Call trace:
> [<8416107c>] ltt_relay_create_channel+0xdc/0x240
> [<8406fbc0>] kmem_cache_alloc+0x0/0xa0
> [<8416b220>] strncat+0x0/0x60
> [<8415f702>] ltt_control+0xb82/0xdc0
> [<8401af60>] printk+0x0/0x80
> [<84161880>] ltt_control_input+0x120/0x1e0
> [<8421c820>] skb_dequeue+0x0/0xa0
> [<8401af60>] printk+0x0/0x80
> [<8421d820>] kfree_skb+0x0/0x80
> [<84237500>] netlink_ack+0x0/0x2c0
> [<84238272>] netlink_data_ready+0x12/0x80
> [<842364fe>] netlink_sendskb+0x1e/0x80
> [<84238126>] netlink_sendmsg+0x206/0x340
> [<84216992>] sock_sendmsg+0x72/0x120
> [<84089cae>] dput+0x4e/0x1e0
> [<84090ac8>] mntput_no_expire+0x28/0x140
> [<84033540>] autoremove_wake_function+0x0/0x40
> [<840215d2>] __tasklet_schedule+0xb2/0x100
> [<841a12d6>] asc_interrupt+0x256/0x320
> [<84162756>] ltt_trace+0x16/0x40
> [<840038b0>] do_IRQ+0x30/0x80
> [<84216cf6>] sys_sendto+0x96/0x120
> [<840257ba>] run_timer_softirq+0x1a/0x220
> [<84162756>] ltt_trace+0x16/0x40
> [<8402101a>] tasklet_action+0xfa/0x180
> [<84020c66>] do_softirq+0x66/0x80
> [<84217f56>] sys_socketcall+0x196/0x380
> [<84008224>] syscall_call+0xc/0x10
> [<84217dc0>] sys_socketcall+0x0/0x380
> 
> Process: lttctl (pid: 288, stack limit = 871c4001)
> Stack: (0x871c5c80 to 0x871c6000)
> 5c80: 8437a460 87697434 84565a20 87697414 8416107c 84574000 8406fbc0
> 84342d7c
> 5ca0: 84574160 8416b220 874e8000 87390000 84574168 87390000 87252ac4
> 84566010
> 5cc0: 8415f702 8401af60 00000002 00000000 84566010 84574000 845740fc
> 843477f8
> 5ce0: 84574160 00100000 00000002 00000000 8457413c 00000000 00010000
> 00000002
> 5d00: 00040000 00000002 00100000 84161880 8421c820 8401af60 8421d820
> 84237500
> 5d20: 84517660 84566000 84480800 00000000 00000000 00000000 00000000
> 00000000
> 5d40: 00000000 00000000 84238272 871c5e44 87f91780 84480800 871c5f18
> 87697e00
> 5d60: 00000230 84517600 842364fe 84517600 84238126 00000000 84566000
> 00000230
> 5d80: 00000000 00000000 00000120 00000000 00000000 00000000 00000000
> 84216992
> 5da0: 00000230 00000000 87d8d2e0 871c5f18 00000230 87f91780 871c4000
> 84089cae
> 5dc0: 84090ac8 00000000 00000001 ffffffff 00000000 00000000 00000000
> 00000000
> 5de0: 00000000 844a8060 00000000 00000000 8432b120 844a8060 84033540
> 871c5dfc
> 5e00: 871c5dfc 871c5e0c 840215d2 00000005 871c5e44 84395bc8 84569ce0
> 84395bdc
> 5e20: 841a12d6 84384000 00414008 0000000a 84395bc8 84395bc8 00000000
> 8456b860
> 5e40: 84162756 842e7208 00414008 0000000a 00000230 87f91780 00000000
> 871c5d88
> 5e60: 871c5f18 84384000 84347850 842e71d0 ffffff0f 8456b860 00000079
> 84340840
> 5e80: 840038b0 84216cf6 87f91780 871c5f04 7bc79a40 871c5f18 00000010
> 00000000
> 5ea0: 00000000 00000050 840257ba 84162756 843564a0 871c4000 84384000
> 84384024
> 5ec0: 00000000 ffffff0f 84385314 871c5ed4 8402101a 843084f4 84384000
> 871c4000
> 5ee0: 00000009 ffffff0f 00000005 84384064 00000001 871c5efc 84347850
> 00000005
> 5f00: 871c4000 84020c66 7bc797e8 00414008 29591854 ffffff0f 871c5e98
> 0000000c
> 5f20: 871c5f34 00000001 00000000 00000000 00000000 7bc79c70 00000000
> 00000000
> 5f40: 00000000 84217f56 7bc797e8 871c5f6c 7bc79a40 00000003 00000014
> 0000000b
> 5f60: 871c4000 00414018 0000000c 00000003 7bc79a40 00000230 00000000
> 00414018
> 5f80: 0000000c 84008224 00414008 29591854 ffffff0f 00000021 871c5ff8
> 84217dc0
> 5fa0: 00000000 00000450 7bc79c3c 00000066 0000000b 7bc797d0 00000230
> 00000000
> 5fc0: 0000000c 00000000 7bc7ae63 00402068 29591854 00414008 7bc797e8
> 7bc797d0
> 5fe0: 2962eb40 29580b9c 00008001 29695450 4a8568ad 0000001c 00000048
> 00000160
> Segmentation fault
> root@root:/home/root#
> 
> 
> Using the kernel debugger, it seems the problem is in the
> ltt_relay_create_channel function when the relay_open is invoked with
> the channel_name = "cpu".
> 
> What do you think?
> Do I need to apply any other patches?
> Welcome advice.
> 

Could you add a printk at the beginning of ltt_relay_create_channel() ?
(also at the end to see if it ends correctly..)

Try to show all the arguments received by ltt_relay_create_channel in
this printk.

Also try adding printk just before each strncpy, strncat, strlen in this
function, printing the printers (and possibly the strings) to which they
point.

It might help debugging this further. And maybe it's something specific
to pre14.. updating to the newer pre23 might help, but if yes, I don't
recall any change in this area.. except maybe the changes in the netlink
support in the kernel.

Mathieu


> Regards,
>   Giuseppe
> 
> PS: I confirm that timestamp for SUPERH works fine.

> _______________________________________________
> Ltt-dev mailing list
> [email protected]
> http://listserv.shafik.org/mailman/listinfo/ltt-dev


-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68