From: Andrei Vagin <ava...@virtuozzo.com>

ucred.pid is zero for kernel messages and in this case it is
impossible to restore it.

Signed-off-by: Andrei Vagin <ava...@virtuozzo.com>
---
 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 e72ca45..88e47b8 100644
--- a/criu/sk-queue.c
+++ b/criu/sk-queue.c
@@ -92,7 +92,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);
@@ -322,7 +324,7 @@ int restore_sk_queue(int fd, unsigned int peer_id)
                        goto err;
                }
 
-               if (entry->ucred) {
+               if (entry->ucred && entry->ucred->pid) {
                        struct ucred *ucred;
                        struct cmsghdr *ch;
 
-- 
1.8.3.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to