Skip to content

Commit d3ca96d

Browse files
ayushr2gvisor-bot
authored andcommitted
Add support for spec.Process.User.Umask.
If this field is specified, then initialize kernel.CreateProcessArgs.Umask with it. Otherwise default to 0022. Fixes #11022 PiperOrigin-RevId: 684925583
1 parent f9c7e51 commit d3ca96d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

runsc/boot/loader.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,18 @@ func createProcessArgs(id string, spec *specs.Spec, conf *config.Config, creds *
703703
wd = "/"
704704
}
705705

706+
umask := uint(0022)
707+
if spec.Process.User.Umask != nil {
708+
umask = uint(*spec.Process.User.Umask) & 0777
709+
}
710+
706711
// Create the process arguments.
707712
procArgs := kernel.CreateProcessArgs{
708713
Argv: spec.Process.Args,
709714
Envv: env,
710715
WorkingDirectory: wd,
711716
Credentials: creds,
712-
Umask: 0022,
717+
Umask: umask,
713718
Limits: ls,
714719
MaxSymlinkTraversals: linux.MaxSymlinkTraversals,
715720
UTSNamespace: k.RootUTSNamespace(),

0 commit comments

Comments
 (0)