os-checker / MIRAI

docker image: zjpzjp/mirai:latest
MIT License
0 stars 0 forks source link

MIRAI 使用记录 #6

Open zjp-CN opened 2 months ago

zjp-CN commented 2 months ago
图片

![808eb78db63b557fe1b9075e7b18b95](https://github.com/user-attachments/assets/1433a31a-f4ec-4531-b103-adf075355f37) ![61404eae6bb17ca372493d456b4afaa](https://github.com/user-attachments/assets/9ee85190-9d3a-46c6-89b5-1a06b8e4279d)

MIRAI 有些做的好的地方:

warning: possible Invalid page size!
   --> src/cap/mod.rs:230:41
    |
230 |                 let topA = botA + MASK!(pageBitsForSize(cap1.get_frame_size()));
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pub fn pageBitsForSize(page_size: usize) -> usize {
    match page_size {
        RISCV_4K_Page => RISCVPageBits,
        RISCV_Mega_Page => RISCVMegaPageBits,
        RISCV_Giga_Page => RISCVGigaPageBits,
        _ => panic!("Invalid page size!"),
    }
}
zjp-CN commented 2 months ago

测试 kern-crates/rtc 时,MIRAI 无法处理的函数会在除 --diag=default 之外的诊断上报告:

warning: the called function did not resolve to an implementation with a MIR body
  --> src/goldfish.rs:32:24
   |
32 |         let time_low = self.region.read_at(RTC_TIME_LOW);
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

我认为 os-checker 应该使用 --diag=default 参数,展示少的误报结果。

(p.s. MIRAI 虽然将误报视为自己的错误,但也存在误报)

zjp-CN commented 2 months ago

cargo mirai 会遵照 .cargo/config.toml 的 target;并且也支持识别 --target 参数

https://github.com/os-checker/dockerfiles/commit/11de2507d76312f0d8d4aab2f32da05e31e7df70