From d77eb99d2a3e75fca4e0f1a623a64df414abea6c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 8 Jul 2026 22:29:57 +0300 Subject: [PATCH] socket: don't restore ucred from kernel messages ucred.pid is zero for kernel messages and in this case it is impossible to restore it. Signed-off-by: Andrei Vagin Signed-off-by: Cyrill Gorcunov (cherry picked from commit 70948c510699aa8a2d28fc1669ad25dd81a6b102) Signed-off-by: Ahmed Elaidy Reviewed-by: Alexander Mikhalitsyn --- criu/sk-queue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/criu/sk-queue.c b/criu/sk-queue.c index f38d8972c..ae19bbc20 100644 --- a/criu/sk-queue.c +++ b/criu/sk-queue.c @@ -160,7 +160,9 @@ static int dump_sk_creds(struct ucred *ucred, SkPacketEntry *pe, int flags) int ret; /* Does a process exist? */ - if (pidns) { + if (ucred->pid == 0) { + ret = 0; + } else if (pidns) { snprintf(path, sizeof(path), "%d", ucred->pid); ret = faccessat(get_service_fd(CR_PROC_FD_OFF), path, R_OK, 0); } else { @@ -389,7 +391,7 @@ static int send_one_pkt(int fd, struct sk_packet *pkt) * boundaries messages should be saved. */ - if (entry->ucred) { + if (entry->ucred && entry->ucred->pid) { struct ucred *ucred; struct cmsghdr *ch;