Skip to content

Commit d82235c

Browse files
committed
merge #4444 into opencontainers/runc:main
lifubang (1): dmz: cloned binary: set +x permissions when creating regular tmpfile LGTMs: kolyshkin cyphar
2 parents 798ba5c + 9fa324c commit d82235c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcontainer/dmz/cloned_binary_linux.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ func Memfd(comment string) (*os.File, SealFunc, error) {
6464
}
6565

6666
func sealFile(f **os.File) error {
67-
if err := (*f).Chmod(0o511); err != nil {
68-
return err
69-
}
7067
// When sealing an O_TMPFILE-style descriptor we need to
7168
// re-open the path as O_PATH to clear the existing write
7269
// handle we have.
@@ -108,6 +105,9 @@ func mktemp(dir string) (*os.File, SealFunc, error) {
108105
if err := os.Remove(file.Name()); err != nil {
109106
return nil, nil, fmt.Errorf("unlinking classic tmpfile: %w", err)
110107
}
108+
if err := file.Chmod(0o511); err != nil {
109+
return nil, nil, fmt.Errorf("chmod classic tmpfile: %w", err)
110+
}
111111
var stat unix.Stat_t
112112
if err := unix.Fstat(int(file.Fd()), &stat); err != nil {
113113
return nil, nil, fmt.Errorf("cannot fstat classic tmpfile: %w", err)

0 commit comments

Comments
 (0)