File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,31 @@ func (v *Validator) CheckProcess() (msgs []string) {
218218 }
219219 }
220220
221+ if len (process .Args ) == 0 {
222+ msgs = append (msgs , fmt .Sprintf ("args must not be empty" ))
223+ } else {
224+ if filepath .IsAbs (process .Args [0 ]) {
225+ var rootfsPath string
226+ if filepath .IsAbs (v .spec .Root .Path ) {
227+ rootfsPath = v .spec .Root .Path
228+ } else {
229+ rootfsPath = filepath .Join (v .bundlePath , v .spec .Root .Path )
230+ }
231+ absPath := filepath .Join (rootfsPath , process .Args [0 ])
232+ fileinfo , err := os .Stat (absPath )
233+ if os .IsNotExist (err ) {
234+ logrus .Warnf ("executable %q is not available in rootfs currently" , process .Args [0 ])
235+ } else if err != nil {
236+ msgs = append (msgs , err .Error ())
237+ } else {
238+ m := fileinfo .Mode ()
239+ if m .IsDir () || m & 0111 == 0 {
240+ msgs = append (msgs , fmt .Sprintf ("arg %q is not executable" , process .Args [0 ]))
241+ }
242+ }
243+ }
244+ }
245+
221246 for index := 0 ; index < len (process .Capabilities ); index ++ {
222247 capability := process .Capabilities [index ]
223248 if ! capValid (capability ) {
You can’t perform that action at this time.
0 commit comments