18
18
//! in `super::child` (namely `start_ffi()` and `end_ffi()`) to handle this. It is
19
19
//! trivially easy to cause a deadlock or crash by messing this up!
20
20
21
+ use std:: ops:: Range ;
22
+
21
23
/// An IPC request sent by the child process to the parent.
22
24
///
23
25
/// The sender for this channel should live on the child process.
24
26
#[ derive( serde:: Serialize , serde:: Deserialize , Debug , Clone ) ]
25
- pub ( super ) enum TraceRequest {
27
+ pub enum TraceRequest {
26
28
/// Requests that tracing begins. Following this being sent, the child must
27
29
/// wait to receive a `Confirmation` on the respective channel and then
28
30
/// `raise(SIGSTOP)`.
29
31
///
30
32
/// To avoid possible issues while allocating memory for IPC channels, ending
31
33
/// the tracing is instead done via `raise(SIGUSR1)`.
32
- StartFfi ( super :: StartFfiInfo ) ,
34
+ StartFfi ( StartFfiInfo ) ,
33
35
/// Manually overrides the code that the supervisor will return upon exiting.
34
36
/// Once set, it is permanent. This can be called again to change the value.
35
37
OverrideRetcode ( i32 ) ,
36
38
}
37
39
40
+ /// Information needed to begin tracing.
41
+ #[ derive( serde:: Serialize , serde:: Deserialize , Debug , Clone ) ]
42
+ pub struct StartFfiInfo {
43
+ /// A vector of page addresses. These should have been automatically obtained
44
+ /// with `IsolatedAlloc::pages` and prepared with `IsolatedAlloc::prepare_ffi`.
45
+ pub page_ptrs : Vec < usize > ,
46
+ /// The address of an allocation that can serve as a temporary stack.
47
+ /// This should be a leaked `Box<[u8; CALLBACK_STACK_SIZE]>` cast to an int.
48
+ pub stack_ptr : usize ,
49
+ }
50
+
38
51
/// A marker type confirming that the supervisor has received the request to begin
39
52
/// tracing and is now waiting for a `SIGSTOP`.
40
53
///
41
54
/// The sender for this channel should live on the parent process.
42
55
#[ derive( serde:: Serialize , serde:: Deserialize , Debug ) ]
43
- pub ( super ) struct Confirmation ;
56
+ pub struct Confirmation ;
44
57
45
58
/// The final results of an FFI trace, containing every relevant event detected
46
59
/// by the tracer. Sent by the supervisor after receiving a `SIGUSR1` signal.
@@ -53,5 +66,15 @@ pub struct MemEvents {
53
66
/// pessimistically rounded up, and if the type (read/write/both) is uncertain
54
67
/// it is reported as whatever would be safest to assume; i.e. a read + maybe-write
55
68
/// becomes a read + write, etc.
56
- pub acc_events : Vec < super :: AccessEvent > ,
69
+ pub acc_events : Vec < AccessEvent > ,
70
+ }
71
+
72
+ /// A single memory access, conservatively overestimated
73
+ /// in case of ambiguity.
74
+ #[ derive( serde:: Serialize , serde:: Deserialize , Debug ) ]
75
+ pub enum AccessEvent {
76
+ /// A read may have occurred on no more than the specified address range.
77
+ Read ( Range < usize > ) ,
78
+ /// A write may have occurred on no more than the specified address range.
79
+ Write ( Range < usize > ) ,
57
80
}
0 commit comments