Skip to content

Commit 2f687a2

Browse files
ayushr2gvisor-bot
authored andcommitted
Validate the process spec on runsc run.
The run command was missing the process spec validation. Updates #11736 PiperOrigin-RevId: 761704978
1 parent 3a06fd3 commit 2f687a2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pkg/test/testutil/testutil.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ func NewSpecWithArgs(args ...string) *specs.Spec {
283283
"PATH=" + os.Getenv("PATH"),
284284
},
285285
Capabilities: specutils.AllCapabilities(),
286+
Cwd: "/",
286287
},
287288
Mounts: []specs.Mount{
288289
// Hide the host /etc to avoid any side-effects.

runsc/cmd/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ func (r *Run) Execute(_ context.Context, f *flag.FlagSet, args ...any) subcomman
9999
}
100100
specutils.LogSpecDebug(spec, conf.OCISeccomp)
101101

102+
if err := validateProcessSpec(spec.Process); err != nil {
103+
return util.Errorf("invalid process spec: %v", err)
104+
}
105+
102106
// Create files from file descriptors.
103107
fdMap := make(map[int]*os.File)
104108
for _, mapping := range r.passFDs {

0 commit comments

Comments
 (0)