runsc-race: Fix compile time errors on arm64

runsc/fsgofer/filter/extra_filters_race.go:38:3: undefined: unix.SYS_OPEN
runsc/fsgofer/filter/extra_filters_race.go:42:3: undefined: unix.SYS_TIME
This commit is contained in:
Andrei Vagin
2022-05-12 16:21:45 -07:00
parent a7cad2b092
commit bc80e774c0
8 changed files with 120 additions and 10 deletions
+2
View File
@@ -12,6 +12,8 @@ go_library(
"extra_filters.go",
"extra_filters_msan.go",
"extra_filters_race.go",
"extra_filters_race_amd64.go",
"extra_filters_race_arm64.go",
"filter.go",
],
visibility = [
+2 -5
View File
@@ -25,7 +25,7 @@ import (
// instrumentationFilters returns additional filters for syscalls used by TSAN.
func instrumentationFilters() seccomp.SyscallRules {
Report("TSAN is enabled: syscall filters less restrictive!")
return seccomp.SyscallRules{
return archInstrumentationFilters(seccomp.SyscallRules{
unix.SYS_BRK: {},
unix.SYS_CLOCK_NANOSLEEP: {},
unix.SYS_CLONE: {},
@@ -33,10 +33,7 @@ func instrumentationFilters() seccomp.SyscallRules {
unix.SYS_MMAP: {},
unix.SYS_MUNLOCK: {},
unix.SYS_NANOSLEEP: {},
unix.SYS_OPEN: {},
unix.SYS_OPENAT: {},
unix.SYS_SET_ROBUST_LIST: {},
// Used within glibc's malloc.
unix.SYS_TIME: {},
}
})
}
@@ -0,0 +1,30 @@
// Copyright 2022 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build race
// +build race
package filter
import (
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/seccomp"
)
func archInstrumentationFilters(f seccomp.SyscallRules) seccomp.SyscallRules {
f[unix.SYS_OPEN] = []seccomp.Rule{}
// Used within glibc's malloc.
f[unix.SYS_TIME] = []seccomp.Rule{}
return f
}
@@ -0,0 +1,26 @@
// Copyright 2022 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build race
// +build race
package filter
import (
"gvisor.dev/gvisor/pkg/seccomp"
)
func archInstrumentationFilters(f seccomp.SyscallRules) seccomp.SyscallRules {
return f
}
+2
View File
@@ -11,6 +11,8 @@ go_library(
"extra_filters.go",
"extra_filters_msan.go",
"extra_filters_race.go",
"extra_filters_race_amd64.go",
"extra_filters_race_arm64.go",
"filter.go",
],
visibility = [
+2 -5
View File
@@ -26,7 +26,7 @@ import (
// instrumentationFilters returns additional filters for syscalls used by TSAN.
func instrumentationFilters() seccomp.SyscallRules {
log.Warningf("*** SECCOMP WARNING: TSAN is enabled: syscall filters less restrictive!")
return seccomp.SyscallRules{
return archInstrumentationFilters(seccomp.SyscallRules{
unix.SYS_BRK: {},
unix.SYS_CLOCK_NANOSLEEP: {},
unix.SYS_CLONE: {},
@@ -35,10 +35,7 @@ func instrumentationFilters() seccomp.SyscallRules {
unix.SYS_MMAP: {},
unix.SYS_MUNLOCK: {},
unix.SYS_NANOSLEEP: {},
unix.SYS_OPEN: {},
unix.SYS_OPENAT: {},
unix.SYS_SET_ROBUST_LIST: {},
// Used within glibc's malloc.
unix.SYS_TIME: {},
}
})
}
@@ -0,0 +1,30 @@
// Copyright 2022 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build race
// +build race
package filter
import (
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/seccomp"
)
func archInstrumentationFilters(f seccomp.SyscallRules) seccomp.SyscallRules {
f[unix.SYS_OPEN] = []seccomp.Rule{}
// Used within glibc's malloc.
f[unix.SYS_TIME] = []seccomp.Rule{}
return f
}
@@ -0,0 +1,26 @@
// Copyright 2022 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build race
// +build race
package filter
import (
"gvisor.dev/gvisor/pkg/seccomp"
)
func archInstrumentationFilters(f seccomp.SyscallRules) seccomp.SyscallRules {
return f
}