std: rename from comp
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m59s
Test / Sandbox (race detector) (push) Successful in 4m10s
Test / Hakurei (race detector) (push) Successful in 5m4s
Test / Flake checks (push) Successful in 1m28s

Seccomp lookup tables are going to be relocated here, and PNR constants.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-11-05 02:47:43 +09:00
parent 9ac63aac0c
commit c1399f5030
25 changed files with 223 additions and 223 deletions

View File

@@ -1,8 +1,8 @@
package seccomp_test
import (
. "hakurei.app/container/comp"
. "hakurei.app/container/seccomp"
. "hakurei.app/container/std"
)
var bpfExpected = bpfLookup{

View File

@@ -1,8 +1,8 @@
package seccomp_test
import (
. "hakurei.app/container/comp"
. "hakurei.app/container/seccomp"
. "hakurei.app/container/std"
)
var bpfExpected = bpfLookup{

View File

@@ -4,14 +4,14 @@ import (
"crypto/sha512"
"encoding/hex"
"hakurei.app/container/comp"
"hakurei.app/container/seccomp"
"hakurei.app/container/std"
)
type (
bpfPreset = struct {
seccomp.ExportFlag
comp.FilterPreset
std.FilterPreset
}
bpfLookup map[bpfPreset][sha512.Size]byte
)

View File

@@ -6,8 +6,8 @@ import (
"syscall"
"testing"
. "hakurei.app/container/comp"
. "hakurei.app/container/seccomp"
. "hakurei.app/container/std"
)
func TestLibraryError(t *testing.T) {

View File

@@ -5,32 +5,32 @@ package seccomp
import (
. "syscall"
"hakurei.app/container/comp"
"hakurei.app/container/std"
)
func Preset(presets comp.FilterPreset, flags ExportFlag) (rules []NativeRule) {
func Preset(presets std.FilterPreset, flags ExportFlag) (rules []NativeRule) {
allowedPersonality := PersonaLinux
if presets&comp.PresetLinux32 != 0 {
if presets&std.PresetLinux32 != 0 {
allowedPersonality = PersonaLinux32
}
presetDevelFinal := presetDevel(ScmpDatum(allowedPersonality))
l := len(presetCommon)
if presets&comp.PresetDenyNS != 0 {
if presets&std.PresetDenyNS != 0 {
l += len(presetNamespace)
}
if presets&comp.PresetDenyTTY != 0 {
if presets&std.PresetDenyTTY != 0 {
l += len(presetTTY)
}
if presets&comp.PresetDenyDevel != 0 {
if presets&std.PresetDenyDevel != 0 {
l += len(presetDevelFinal)
}
if flags&AllowMultiarch == 0 {
l += len(presetEmu)
}
if presets&comp.PresetExt != 0 {
if presets&std.PresetExt != 0 {
l += len(presetCommonExt)
if presets&comp.PresetDenyNS != 0 {
if presets&std.PresetDenyNS != 0 {
l += len(presetNamespaceExt)
}
if flags&AllowMultiarch == 0 {
@@ -40,21 +40,21 @@ func Preset(presets comp.FilterPreset, flags ExportFlag) (rules []NativeRule) {
rules = make([]NativeRule, 0, l)
rules = append(rules, presetCommon...)
if presets&comp.PresetDenyNS != 0 {
if presets&std.PresetDenyNS != 0 {
rules = append(rules, presetNamespace...)
}
if presets&comp.PresetDenyTTY != 0 {
if presets&std.PresetDenyTTY != 0 {
rules = append(rules, presetTTY...)
}
if presets&comp.PresetDenyDevel != 0 {
if presets&std.PresetDenyDevel != 0 {
rules = append(rules, presetDevelFinal...)
}
if flags&AllowMultiarch == 0 {
rules = append(rules, presetEmu...)
}
if presets&comp.PresetExt != 0 {
if presets&std.PresetExt != 0 {
rules = append(rules, presetCommonExt...)
if presets&comp.PresetDenyNS != 0 {
if presets&std.PresetDenyNS != 0 {
rules = append(rules, presetNamespaceExt...)
}
if flags&AllowMultiarch == 0 {