fasterthanlime/mevi

mevi panics when ran on sandboxed chromium

Closed this issue · 1 comments

Command : target/release/mevi chromium
Result :

2023-03-23T14:52:11.818086Z  WARN mevi::tracer: a thread is changing the brk for the process, we should handle that
[26942] => [1] mapping 7fdf7a100000..7fdf7a102000 (8 KiB) with NotResident
The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: crates/mevi/src/tracer.rs:200

'hack' to bypass the issue ? :

diff --git a/crates/mevi/src/tracer.rs b/crates/mevi/src/tracer.rs
index 4518cb1..dd0dbc4 100644
--- a/crates/mevi/src/tracer.rs
+++ b/crates/mevi/src/tracer.rs
@@ -195,7 +195,9 @@ impl Tracer {
                                         "{tid} => {for_tid} mapping {range:x?} ({}) with {state:?}",
                                         formatter(range.end - range.start)
                                     );
-                                    let target = self.tracees.get(&for_tid).unwrap();
+                                    let target = self.tracees.get(&for_tid);
+                                    if target.is_some() {
+                                    let target = target.unwrap();
                                     match &target.kind {
                                         TraceeKind::Fresh => unreachable!(),
                                         TraceeKind::Process { uffd, .. } => {
@@ -213,6 +215,7 @@ impl Tracer {
                                             panic!("thread {for_tid} of process {pid} mapping memory should show up in the parent");
                                         }
                                     }
+                                }

                                     let ev = MeviEvent::TraceeEvent(
                                         for_tid,

'hack' to bypass the issue ? :

That'll get rid of the crash, sure, but it won't be correct.

I've tried real hard to get mevi working with Chromium, and have failed after a week+ of efforts. I don't really want to get rid of that panic without fixing the underlying cause.

Btw, if you're trying to make changes to get it working with Chromium - you will have to disable all its sandboxing mechanisms, just like the README Indicates for Firefox. The sandboxing mechanisms will break mevi for sure - even crashpad_handler is tricky to deal with (due to its use of ptrace).