@@ -152,20 +152,22 @@ func (p *setnsProcess) start() (retErr error) {
152
152
}
153
153
}
154
154
}
155
- // set rlimits, this has to be done here because we lose permissions
156
- // to raise the limits once we enter a user-namespace
157
- if err := setupRlimits (p .config .Rlimits , p .pid ()); err != nil {
158
- return fmt .Errorf ("error setting rlimits for process: %w" , err )
159
- }
155
+
160
156
if err := utils .WriteJSON (p .messageSockPair .parent , p .config ); err != nil {
161
157
return fmt .Errorf ("error writing config to pipe: %w" , err )
162
158
}
163
159
164
160
ierr := parseSync (p .messageSockPair .parent , func (sync * syncT ) error {
165
161
switch sync .Type {
166
162
case procReady :
167
- // This shouldn't happen.
168
- panic ("unexpected procReady in setns" )
163
+ // Set rlimits, this has to be done here because we lose permissions
164
+ // to raise the limits once we enter a user-namespace
165
+ if err := setupRlimits (p .config .Rlimits , p .pid ()); err != nil {
166
+ return fmt .Errorf ("error setting rlimits for ready process: %w" , err )
167
+ }
168
+
169
+ // Sync with child.
170
+ return writeSync (p .messageSockPair .parent , procRun )
169
171
case procHooks :
170
172
// This shouldn't happen.
171
173
panic ("unexpected procHooks in setns" )
@@ -495,7 +497,7 @@ func (p *initProcess) start() (retErr error) {
495
497
return err
496
498
}
497
499
case procReady :
498
- // set rlimits, this has to be done here because we lose permissions
500
+ // Set rlimits, this has to be done here because we lose permissions
499
501
// to raise the limits once we enter a user-namespace
500
502
if err := setupRlimits (p .config .Rlimits , p .pid ()); err != nil {
501
503
return fmt .Errorf ("error setting rlimits for ready process: %w" , err )
0 commit comments