@@ -29,6 +29,8 @@ type Point uint
29
29
// PointX represents the checkpoint X.
30
30
const (
31
31
PointClone Point = iota
32
+ PointExecve
33
+ PointExitNotifyParent
32
34
// Add new Points above this line.
33
35
pointLength
34
36
@@ -47,6 +49,8 @@ const (
47
49
// registered concurrently with invocations of checkpoints).
48
50
type Checker interface {
49
51
Clone (ctx context.Context , mask CloneFieldSet , info CloneInfo ) error
52
+ Execve (ctx context.Context , mask ExecveFieldSet , info ExecveInfo ) error
53
+ ExitNotifyParent (ctx context.Context , mask ExitNotifyParentFieldSet , info ExitNotifyParentInfo ) error
50
54
}
51
55
52
56
// CheckerDefaults may be embedded by implementations of Checker to obtain
@@ -58,6 +62,16 @@ func (CheckerDefaults) Clone(ctx context.Context, mask CloneFieldSet, info Clone
58
62
return nil
59
63
}
60
64
65
+ // Execve implements Checker.Execve.
66
+ func (CheckerDefaults ) Execve (ctx context.Context , mask ExecveFieldSet , info ExecveInfo ) error {
67
+ return nil
68
+ }
69
+
70
+ // ExitNotifyParent implements Checker.ExitNotifyParent.
71
+ func (CheckerDefaults ) ExitNotifyParent (ctx context.Context , mask ExitNotifyParentFieldSet , info ExitNotifyParentInfo ) error {
72
+ return nil
73
+ }
74
+
61
75
// CheckerReq indicates what checkpoints a corresponding Checker runs at, and
62
76
// what information it requires at those checkpoints.
63
77
type CheckerReq struct {
@@ -69,7 +83,9 @@ type CheckerReq struct {
69
83
70
84
// All of the following fields indicate what fields in the corresponding
71
85
// XInfo struct will be requested at the corresponding checkpoint.
72
- Clone CloneFields
86
+ Clone CloneFields
87
+ Execve ExecveFields
88
+ ExitNotifyParent ExitNotifyParentFields
73
89
}
74
90
75
91
// Global is the method receiver of all seccheck functions.
@@ -101,7 +117,9 @@ type state struct {
101
117
// corresponding XInfo struct have been requested by any registered
102
118
// checker, are accessed using atomic memory operations, and are mutated
103
119
// with registrationMu locked.
104
- cloneReq CloneFieldSet
120
+ cloneReq CloneFieldSet
121
+ execveReq ExecveFieldSet
122
+ exitNotifyParentReq ExitNotifyParentFieldSet
105
123
}
106
124
107
125
// AppendChecker registers the given Checker to execute at checkpoints. The
@@ -110,7 +128,11 @@ type state struct {
110
128
func (s * state ) AppendChecker (c Checker , req * CheckerReq ) {
111
129
s .registrationMu .Lock ()
112
130
defer s .registrationMu .Unlock ()
131
+
113
132
s .cloneReq .AddFieldsLoadable (req .Clone )
133
+ s .execveReq .AddFieldsLoadable (req .Execve )
134
+ s .exitNotifyParentReq .AddFieldsLoadable (req .ExitNotifyParent )
135
+
114
136
s .appendCheckerLocked (c )
115
137
for _ , p := range req .Points {
116
138
word , bit := p / 32 , p % 32
0 commit comments