Skip to content

Commit

Permalink
Ensure we do not edit container config in Exec
Browse files Browse the repository at this point in the history
The existing code grabs the base container's process, and then
modifies it for use with the exec session. This could cause
errors in `podman inspect` or similar on the container, as the
definition of its OCI spec has been changed by the exec session.
The change never propagates to the DB, so it's limited to a
single process, but we should still avoid it when possible - so
deep-copy it before use.

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Jan 4, 2021
1 parent f261bfc commit 960607a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libpod/oci_conmon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,10 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
if err != nil {
return nil, err
}
pspec := c.config.Spec.Process
pspec := new(spec.Process)
if err := JSONDeepCopy(c.config.Spec.Process, pspec); err != nil {
return nil, err
}
pspec.SelinuxLabel = c.config.ProcessLabel
pspec.Args = options.Cmd
for _, cap := range options.CapAdd {
Expand Down

0 comments on commit 960607a

Please sign in to comment.