Skip to content

Commit 2da32e5

Browse files
committed
pkg/mgrconfig: change the snapshot attr semantics
At the moment of its introduction, the attribute was overridable by enable_syscalls. However, since some of the malicious calls are actually variants of generic syscalls (e.g. ioctl), it has de-facto made it very easy to enable them also on non-snapshot instances. Do not let enable_syscalls override this. Instead, only activate snapshot calls on the snapshot instances.
1 parent 8fc3779 commit 2da32e5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/syscall_descriptions_syntax.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ Call attributes are:
110110
string argument is a fsck-like command that will be called to verify the filesystem.
111111
"remote_cover": wait longer to collect remote coverage for this call.
112112
"kfuzz_test": the call is a kfuzztest target.
113-
"snapshot": the call is enabled by default only in snapshot fuzzing mode,
114-
but "enable_syscalls" and "disable_syscalls" config parameters override this.
113+
"snapshot": the call can only be enabled in snapshot fuzzing mode.
115114
It is generally used to mark calls that are not safe to execute in non-snapshot mode
116115
(can lead to false positives, or lost connections to test machines.
117116
```

pkg/mgrconfig/load.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,17 @@ func ParseEnabledSyscalls(target *prog.Target, enabled, disabled []string,
438438
}
439439
} else {
440440
for _, call := range target.Syscalls {
441-
if call.Attrs.Snapshot && (descriptionsMode&SnapshotDescriptions) == 0 {
442-
continue
443-
}
444441
syscalls[call.ID] = true
445442
}
446443
}
447-
444+
if descriptionsMode&SnapshotDescriptions == 0 {
445+
// Drop snapshot calls in the non-snapshot mode.
446+
for _, call := range target.Syscalls {
447+
if call.Attrs.Snapshot {
448+
delete(syscalls, call.ID)
449+
}
450+
}
451+
}
448452
for call := range syscalls {
449453
if target.Syscalls[call].Attrs.Disabled ||
450454
(descriptionsMode&AutoDescriptions) == 0 && target.Syscalls[call].Attrs.Automatic ||

0 commit comments

Comments
 (0)