* Perf is crashing inside Flatpak runtime
@ 2024-07-25 13:37 bbhtt
2024-07-26 1:24 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: bbhtt @ 2024-07-25 13:37 UTC (permalink / raw)
To: linux-perf-users
Hello,
We were reported by a user that perf is crashing inside the
`org.freedesktop.Sdk` Flatpak runtime.
To reproduce, please install Flatpak for your distribution [1] and
then install the `org.freedesktop.Sdk` runtime using the command
`flatpak install org.freedesktop.Sdk//23.08`. Then get a working shell
inside the sandbox using
`flatpak run --command=sh --devel org.freedesktop.Sdk//23.08`.
Once inside the sandbox, run `perf record -v -- ls` and see that it
crashes.
The output and a backtrace is below. Any help is appreciated. The
downstream issue can be found at [2].
```
perf --version
perf version 6.9.9
perf record -v -- ls
DEBUGINFOD_URLS=
No PMU found for 'cycles:Pu'
Failed to read max cpus, using default of 4096
nr_cblocks: 0
affinity: SYS
mmap flush: 1
comp level: 0
Problems creating module maps, continuing anyway...
No PMU found for 'cycles:u'
No PMU found for 'instructions:u'
No PMU found for 'cpu-clock:u'
mmap size 528384B
libperf: Miscounted nr_mmaps 0 vs 1
Control descriptor is not initialized
WARNING: No sample_id_all support, falling back to unordered processing
Couldn't start the BPF side band thread:
BPF programs starting from now on won't be annotatable
perf: Segmentation fault
Obtained 13 stack frames.
perf(sighandler_dump_stack+0x48) [0x55fab63072a8]
/usr/lib/x86_64-linux-gnu/libc.so.6(+0x3ee80) [0x7f2f4ac51e80]
perf(perf_cpu_map__max+0x4) [0x55fab63f3104]
perf(+0x1de854) [0x55fab635d854]
perf(perf_event__synthesize_cpu_map+0x56) [0x55fab6360c76]
perf(+0x854cf) [0x55fab62044cf]
perf(+0x88e2c) [0x55fab6207e2c]
perf(cmd_record+0xf95) [0x55fab620b155]
perf(+0x12e8b1) [0x55fab62ad8b1]
perf(main+0x687) [0x55fab61f30e7]
/usr/lib/x86_64-linux-gnu/libc.so.6(+0x2808a) [0x7f2f4ac3b08a]
/usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7f2f4ac3b14b]
perf(_start+0x25) [0x55fab61f3425]
Segmentation fault (core dumped)
```
```
perf_cpu_map__max (map=0x0) at cpumap.c:382
382 return __perf_cpu_map__nr(map) > 0
(gdb) bt
#0 perf_cpu_map__max (map=0x0) at cpumap.c:382
#1 0x0000555555732854 in cpu_map_data__alloc (syn_data=syn_data@entry=0x7fffffff7c80, header_size=header_size@entry=8) at util/synthetic-events.c:1289
#2 0x0000555555735c76 in cpu_map_event__new (map=<optimized out>) at util/synthetic-events.c:1337
#3 perf_event__synthesize_cpu_map (tool=tool@entry=0x555555eb4b80 <record>, map=<optimized out>,
process=process@entry=0x5555555db480 <process_synthesized_event>, machine=machine@entry=0x0) at util/synthetic-events.c:1357
#4 0x00005555555d94cf in record__synthesize (tail=tail@entry=false, rec=0x555555eb4b80 <record>) at builtin-record.c:2103
#5 0x00005555555dce2c in __cmd_record (argc=argc@entry=1, argv=argv@entry=0x7fffffffd880, rec=0x555555eb4b80 <record>) at builtin-record.c:2536
#6 0x00005555555e0155 in cmd_record (argc=<optimized out>, argv=<optimized out>) at builtin-record.c:4257
#7 0x00005555556828b1 in run_builtin (p=p@entry=0x555555eb7728 <commands+264>, argc=argc@entry=4, argv=argv@entry=0x7fffffffd880) at perf.c:349
#8 0x00005555555c80e7 in handle_internal_command (argv=<optimized out>, argc=4) at perf.c:402
#9 run_argv (argv=<synthetic pointer>, argcp=<synthetic pointer>) at perf.c:446
#10 main (argc=<optimized out>, argv=0x7fffffffd880) at perf.c:562
```
[1]: https://flatpak.org/setup/
[2]: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1739
- bbhtt
https://bbhtt.github.io/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Perf is crashing inside Flatpak runtime
2024-07-25 13:37 Perf is crashing inside Flatpak runtime bbhtt
@ 2024-07-26 1:24 ` Namhyung Kim
2024-07-26 2:13 ` bbhtt.zn0i8
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-07-26 1:24 UTC (permalink / raw)
To: bbhtt.zn0i8; +Cc: linux-perf-users
Hello,
On Thu, Jul 25, 2024 at 07:07:09PM +0530, bbhtt wrote:
> Hello,
>
> We were reported by a user that perf is crashing inside the
> `org.freedesktop.Sdk` Flatpak runtime.
>
> To reproduce, please install Flatpak for your distribution [1] and
> then install the `org.freedesktop.Sdk` runtime using the command
> `flatpak install org.freedesktop.Sdk//23.08`. Then get a working shell
> inside the sandbox using
> `flatpak run --command=sh --devel org.freedesktop.Sdk//23.08`.
>
> Once inside the sandbox, run `perf record -v -- ls` and see that it
> crashes.
>
> The output and a backtrace is below. Any help is appreciated. The
> downstream issue can be found at [2].
Thanks for the report. I tried to reproduce it with v6.9.9 but my
system worked fine. Is there anything special on your system?
I guess you're running on x86..
Btw I'm not familiar with Flatpak, does it run on the host kernel?
>
> ```
> perf --version
> perf version 6.9.9
>
> perf record -v -- ls
> DEBUGINFOD_URLS=
> No PMU found for 'cycles:Pu'
> Failed to read max cpus, using default of 4096
Maybe this is the problem.
> nr_cblocks: 0
> affinity: SYS
> mmap flush: 1
> comp level: 0
> Problems creating module maps, continuing anyway...
> No PMU found for 'cycles:u'
> No PMU found for 'instructions:u'
> No PMU found for 'cpu-clock:u'
Hmm.. no PMUs? Is it running a guest kernel or is sysfs mounted
correctly?
Thanks,
Namhyung
> mmap size 528384B
> libperf: Miscounted nr_mmaps 0 vs 1
> Control descriptor is not initialized
> WARNING: No sample_id_all support, falling back to unordered processing
> Couldn't start the BPF side band thread:
> BPF programs starting from now on won't be annotatable
> perf: Segmentation fault
> Obtained 13 stack frames.
> perf(sighandler_dump_stack+0x48) [0x55fab63072a8]
> /usr/lib/x86_64-linux-gnu/libc.so.6(+0x3ee80) [0x7f2f4ac51e80]
> perf(perf_cpu_map__max+0x4) [0x55fab63f3104]
> perf(+0x1de854) [0x55fab635d854]
> perf(perf_event__synthesize_cpu_map+0x56) [0x55fab6360c76]
> perf(+0x854cf) [0x55fab62044cf]
> perf(+0x88e2c) [0x55fab6207e2c]
> perf(cmd_record+0xf95) [0x55fab620b155]
> perf(+0x12e8b1) [0x55fab62ad8b1]
> perf(main+0x687) [0x55fab61f30e7]
> /usr/lib/x86_64-linux-gnu/libc.so.6(+0x2808a) [0x7f2f4ac3b08a]
> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7f2f4ac3b14b]
> perf(_start+0x25) [0x55fab61f3425]
> Segmentation fault (core dumped)
> ```
>
> ```
> perf_cpu_map__max (map=0x0) at cpumap.c:382
> 382 return __perf_cpu_map__nr(map) > 0
> (gdb) bt
> #0 perf_cpu_map__max (map=0x0) at cpumap.c:382
> #1 0x0000555555732854 in cpu_map_data__alloc (syn_data=syn_data@entry=0x7fffffff7c80, header_size=header_size@entry=8) at util/synthetic-events.c:1289
> #2 0x0000555555735c76 in cpu_map_event__new (map=<optimized out>) at util/synthetic-events.c:1337
> #3 perf_event__synthesize_cpu_map (tool=tool@entry=0x555555eb4b80 <record>, map=<optimized out>,
> process=process@entry=0x5555555db480 <process_synthesized_event>, machine=machine@entry=0x0) at util/synthetic-events.c:1357
> #4 0x00005555555d94cf in record__synthesize (tail=tail@entry=false, rec=0x555555eb4b80 <record>) at builtin-record.c:2103
> #5 0x00005555555dce2c in __cmd_record (argc=argc@entry=1, argv=argv@entry=0x7fffffffd880, rec=0x555555eb4b80 <record>) at builtin-record.c:2536
> #6 0x00005555555e0155 in cmd_record (argc=<optimized out>, argv=<optimized out>) at builtin-record.c:4257
> #7 0x00005555556828b1 in run_builtin (p=p@entry=0x555555eb7728 <commands+264>, argc=argc@entry=4, argv=argv@entry=0x7fffffffd880) at perf.c:349
> #8 0x00005555555c80e7 in handle_internal_command (argv=<optimized out>, argc=4) at perf.c:402
> #9 run_argv (argv=<synthetic pointer>, argcp=<synthetic pointer>) at perf.c:446
> #10 main (argc=<optimized out>, argv=0x7fffffffd880) at perf.c:562
> ```
>
> [1]: https://flatpak.org/setup/
> [2]: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1739
>
> - bbhtt
>
> https://bbhtt.github.io/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Perf is crashing inside Flatpak runtime
2024-07-26 1:24 ` Namhyung Kim
@ 2024-07-26 2:13 ` bbhtt.zn0i8
0 siblings, 0 replies; 3+ messages in thread
From: bbhtt.zn0i8 @ 2024-07-26 2:13 UTC (permalink / raw)
To: Namhyung Kim, linux-perf-users
On 26/07/24 06:54, Namhyung Kim - namhyung at kernel.org wrote:
> Hello,
>
> On Thu, Jul 25, 2024 at 07:07:09PM +0530, bbhtt wrote:
>> Hello,
>>
>> We were reported by a user that perf is crashing inside the
>> `org.freedesktop.Sdk` Flatpak runtime.
>>
>> To reproduce, please install Flatpak for your distribution [1] and
>> then install the `org.freedesktop.Sdk` runtime using the command
>> `flatpak install org.freedesktop.Sdk//23.08`. Then get a working shell
>> inside the sandbox using
>> `flatpak run --command=sh --devel org.freedesktop.Sdk//23.08`.
>>
>> Once inside the sandbox, run `perf record -v -- ls` and see that it
>> crashes.
>>
>> The output and a backtrace is below. Any help is appreciated. The
>> downstream issue can be found at [2].
>
> Thanks for the report. I tried to reproduce it with v6.9.9 but my
> system worked fine. Is there anything special on your system?
> I guess you're running on x86..
>
> Btw I'm not familiar with Flatpak, does it run on the host kernel?
>
>>
>> ```
>> perf --version
>> perf version 6.9.9
>>
>> perf record -v -- ls
>> DEBUGINFOD_URLS=
>> No PMU found for 'cycles:Pu'
>> Failed to read max cpus, using default of 4096
>
> Maybe this is the problem.
>
>> nr_cblocks: 0
>> affinity: SYS
>> mmap flush: 1
>> comp level: 0
>> Problems creating module maps, continuing anyway...
>> No PMU found for 'cycles:u'
>> No PMU found for 'instructions:u'
>> No PMU found for 'cpu-clock:u'
>
> Hmm.. no PMUs? Is it running a guest kernel or is sysfs mounted
> correctly?
>
> Thanks,
> Namhyung
>
I think that was the issue here. Flatpak mounts its own subset of
sysfs inside the sandbox and doesn't have access to the host's
sysfs by default. Giving it access to that with
`flatpak run --filesystem=/sys ...` seems to at least not cause it to
crash.
Thanks!
- bbhtt
https://bbhtt.github.io/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-26 2:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 13:37 Perf is crashing inside Flatpak runtime bbhtt
2024-07-26 1:24 ` Namhyung Kim
2024-07-26 2:13 ` bbhtt.zn0i8
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox