Skip to content

The pmcstat tool might cause a crash of CheriBSD/Morello. #2391

Open
@xshaun

Description

@xshaun

Some programs themselves (such as SPEC CPU2017 625.x264_s and 525.x264_r) runs well on CheriBSD/Morello. But, using pmcstat to profile them can cause a system crash. These programs are compiled from source code under purecap and purecap-benchmark mode.

The running snapshots look as follows:

# ./x264_s_base.cheribsd-morello-purecap-cheribuild_llvm --dumpyuv 50 --frames 156 -o BuckBunny_New.264 BuckBunny.yuv 1280x720

yuv [info]: 1280x720p 0:0 @ 25/1 fps (cfr)
x264 [info]: using cpu capabilities: none!
x264 [info]: profile High, level 3.1
x264 [info]: frame I:2     Avg QP:16.53  size: 90394                           
x264 [info]: frame P:58    Avg QP:23.50  size: 30334
x264 [info]: frame B:96    Avg QP:28.74  size:  1839
x264 [info]: consecutive B-frames:  1.3% 23.4% 70.1%  5.2%
x264 [info]: mb I  I16..4: 50.3% 38.1% 11.6%
x264 [info]: mb P  I16..4:  0.7%  1.1%  0.2%  P16..4: 37.9% 25.4% 20.5%  0.0%  0.0%    skip:14.2%
x264 [info]: mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 40.4%  1.7%  0.2%  direct: 0.2%  skip:57.5%  L0:38.9% L1:55.4% BI: 5.7%
x264 [info]: 8x8 transform intra:43.7% inter:51.8%
x264 [info]: coded y,uvDC,uvAC intra: 45.6% 58.1% 30.8% inter: 16.8% 16.1% 2.8%
x264 [info]: i16 v,h,dc,p: 82%  9%  7%  2%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 14% 22%  7%  8%  8%  8%  8%  9%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 14% 21%  7%  8%  9%  7%  8%  7%
x264 [info]: i8c dc,h,v,p: 65% 15% 15%  5%
x264 [info]: Weighted P-Frames: Y:0.0%
x264 [info]: ref P L0: 67.1% 21.4%  9.5%  1.9%
x264 [info]: ref B L0: 86.3% 13.0%  0.7%
x264 [info]: ref B L1: 89.5% 10.5%
x264 [info]: kb/s:2713.74

encoded 156 frames, inf fps, 2713.74 kb/s

If using pmcstat to collect hardware event counters, it crashes, causing the operating system reboot, looks as follows:

# pmcstat -d -P CPU_CYCLES -O pmcstat.S1.out -- ./x264_s_base.cheribsd-morello-purecap-cheribuild_llvm --dumpyuv 50 --frames 156 -o BuckBunny_New.264 BuckBunny.yuv 1280x720
The crashed message can not be logged/written into a file even using > xx.out 2>&1

The screenshot is as follows (may be not clear enough, shows: panic: Misaligned access from kernel space!...):
Image

Thanks for John Baldwin and Robert Watson. Thanks for their feedback and comments on this error and bug.

The fuecap is a function to read a single capability from userspace similar copyin/copy_user and it should be return an error like EFAULT instead of panicking if the user space access faults. The problem here seems to be that FreeBSD’s kernel doesn’t do “onfault” handling for access faults. -- John Baldwin.

Could I post this GitHub issue to track this issue and follow the solutions? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions