aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--pkg/host/host_linux.go26
2 files changed, 21 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 298beca9b..4b80b3bd3 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -18,6 +18,7 @@ Google Inc.
Julia Hansbrough
Dan Austin
Victor Hsieh
+ Michael A. Specter
Baozeng Ding
Lorenzo Stoakes
Jeremy Huang
diff --git a/pkg/host/host_linux.go b/pkg/host/host_linux.go
index 67ca37047..b4b83d188 100644
--- a/pkg/host/host_linux.go
+++ b/pkg/host/host_linux.go
@@ -312,18 +312,32 @@ func isSupportedSocket(c *prog.Syscall) (bool, string) {
}
func isSupportedOpenAt(c *prog.Syscall) (bool, string) {
+ var fd int
+ var err error
+
fname, ok := extractStringConst(c.Args[1])
if !ok || len(fname) == 0 || fname[0] != '/' {
return true, ""
}
- fd, err := syscall.Open(fname, syscall.O_RDONLY, 0)
- if fd != -1 {
- syscall.Close(fd)
+
+ modes := []int{syscall.O_RDONLY, syscall.O_WRONLY, syscall.O_RDWR}
+
+ // Attempt to extract flags from the syscall description
+ if mode, ok := c.Args[2].(*prog.ConstType); ok {
+ modes = []int{int(mode.Val)}
}
- if err != nil {
- return false, fmt.Sprintf("open(%v) failed: %v", fname, err)
+
+ for _, mode := range modes {
+ fd, err = syscall.Open(fname, mode, 0)
+ if fd != -1 {
+ syscall.Close(fd)
+ }
+ if err == nil {
+ return true, ""
+ }
}
- return true, ""
+
+ return false, fmt.Sprintf("open(%v) failed: %v", fname, err)
}
func isSupportedMount(c *prog.Syscall, sandbox string) (bool, string) {