Skip to content

Commit

Permalink
introspection: regenerate UUID if state is empty
Browse files Browse the repository at this point in the history
The /var/lib/containerd/io.containerd.grpc.v1.introspection/uuid file
stores a UUID to identify the particular containerd daemon responding to
requests.  The file should either exist with a UUID, or not exist.
However, it has been observed that the file can be truncated with 0
bytes, which will then fail to be parsed as a valid UUID.

As a defensive practice, detect a 0-length file and overwrite with a new
UUID rather than failing.

Fixes: containerd#10491
Signed-off-by: Samuel Karp <[email protected]>
  • Loading branch information
samuelkarp authored and k8s-infra-cherrypick-robot committed Jul 25, 2024
1 parent d157b85 commit a4846fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/introspection/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func (l *Local) getUUID() (string, error) {
}
return "", err
}
if len(data) == 0 {
return l.generateUUID()
}
u := string(data)
if _, err := uuid.Parse(u); err != nil {
return "", err
Expand Down

0 comments on commit a4846fc

Please sign in to comment.