Skip to content

Commit

Permalink
merge opencontainers#4444 into opencontainers/runc:main
Browse files Browse the repository at this point in the history
lifubang (1):
  dmz: cloned binary: set +x permissions when creating regular tmpfile

LGTMs: kolyshkin cyphar
  • Loading branch information
cyphar committed Oct 15, 2024
2 parents 798ba5c + 9fa324c commit d82235c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libcontainer/dmz/cloned_binary_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ func Memfd(comment string) (*os.File, SealFunc, error) {
}

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

0 comments on commit d82235c

Please sign in to comment.