diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-25 01:52:49 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-25 01:52:49 +0900 |
| commit | 5c4058d5ac7e7944973ca8216c258fc50c194e22 (patch) | |
| tree | c06597903233c75eca5a1edae8b06d93f0f81774 /sandbox | |
| parent | e732dca7629edb503df0c65df5f37a99600d567d (diff) | |
app: run in native sandbox
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'sandbox')
| -rw-r--r-- | sandbox/seccomp/export_test.go | 2 | ||||
| -rw-r--r-- | sandbox/sequential.go | 10 | ||||
| -rw-r--r-- | sandbox/syscall.go | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/sandbox/seccomp/export_test.go b/sandbox/seccomp/export_test.go index 5b23106f..761d0f85 100644 --- a/sandbox/seccomp/export_test.go +++ b/sandbox/seccomp/export_test.go @@ -93,7 +93,7 @@ func TestExport(t *testing.T) { t.Errorf("Close: error = %v", err) return } - if got := digest.Sum(nil); slices.Compare(got, tc.want) != 0 { + if got := digest.Sum(nil); !slices.Equal(got, tc.want) { t.Fatalf("Export() hash = %x, want %x", got, tc.want) return diff --git a/sandbox/sequential.go b/sandbox/sequential.go index d6967035..d0729622 100644 --- a/sandbox/sequential.go +++ b/sandbox/sequential.go @@ -301,7 +301,15 @@ func (l *Symlink) apply(*Params) error { return msg.WrapErr(syscall.EBADE, fmt.Sprintf("path %q is not absolute", l[1])) } - if err := os.Symlink(l[0], toSysroot(l[1])); err != nil { + + target := toSysroot(l[1]) + if err := ensureFile(target, 0444, 0755); err != nil { + return err + } + if err := os.Remove(target); err != nil { + return msg.WrapErr(err, err.Error()) + } + if err := os.Symlink(l[0], target); err != nil { return msg.WrapErr(err, err.Error()) } return nil diff --git a/sandbox/syscall.go b/sandbox/syscall.go index dd1679f0..d477dbc0 100644 --- a/sandbox/syscall.go +++ b/sandbox/syscall.go @@ -22,14 +22,6 @@ func SetDumpable(dumpable uintptr) error { return nil } -func SetPdeathsig(sig syscall.Signal) error { - if _, _, errno := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, uintptr(sig), 0); errno != 0 { - return errno - } - - return nil -} - // IgnoringEINTR makes a function call and repeats it if it returns an // EINTR error. This appears to be required even though we install all // signal handlers with SA_RESTART: see #22838, #38033, #38836, #40846. |
