std: separate seccomp constants
All checks were successful
Test / Create distribution (push) Successful in 39s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m26s
Test / Sandbox (race detector) (push) Successful in 4m13s
Test / Hpkg (push) Successful in 4m12s
Test / Hakurei (race detector) (push) Successful in 5m9s
Test / Flake checks (push) Successful in 1m28s

This avoids inadvertently using PNRs as syscall numbers.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-11-07 04:02:40 +09:00
parent 34ccda84b2
commit 3d188ef884
12 changed files with 2487 additions and 1330 deletions

View File

@@ -22,7 +22,7 @@ package std
import . "syscall"
var syscallNum = map[string]int{
var syscallNum = map[string]ScmpSyscall{
EOF
my $offset = 0;
@@ -37,16 +37,14 @@ sub fmt {
}
(my $name_upper = $name) =~ y/a-z/A-Z/;
$num = $num + $offset;
if($num > $syscall_cutoff_arch{$uname_arch}){ # not wired in Go standard library
if($state < 0){
print " \"$name\": SYS_$name_upper,\n";
}
else{
print " SYS_$name_upper = $num;\n";
}
if($num > $syscall_cutoff_arch{$uname_arch} && $state == 0){ # not wired in Go standard library
print " SYS_$name_upper = $num\n";
}
elsif($state < 0){
print " \"$name\": SYS_$name_upper,\n";
elsif($state == -1){
print " \"$name\": SNR_$name_upper,\n";
}
elsif($state == 1){
print " SNR_$name_upper ScmpSyscall = SYS_$name_upper\n";
}
else{
return;
@@ -81,10 +79,16 @@ while(<GCC>){
}
}
if($state < 0){
$state = $state + 1;
if($state == -1){
print "}\n\nconst (\n";
goto GENERATE;
}
elsif($state == 0){
print ")\n\nconst (\n";
}
elsif($state == 1){
print ")";
exit;
}
++$state;
goto GENERATE;
print ")";