From 0dcc51aedf89b92e573eda2e08d284d6a0430ed5 Mon Sep 17 00:00:00 2001 From: Samuel Karp Date: Wed, 24 Jul 2024 16:30:44 -0700 Subject: [PATCH] introspection: regenerate UUID if state is empty 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: https://github.com/containerd/containerd/issues/10491 Signed-off-by: Samuel Karp --- plugins/services/introspection/local.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/services/introspection/local.go b/plugins/services/introspection/local.go index 9a1f9504b..19e7594ef 100644 --- a/plugins/services/introspection/local.go +++ b/plugins/services/introspection/local.go @@ -153,6 +153,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