[Devel] [PATCH 3/5] socket: don't restore ucred from kernel messages
Andrey Vagin
avagin at openvz.org
Sat Feb 18 22:58:14 PST 2017
From: Andrei Vagin <avagin at virtuozzo.com>
ucred.pid is zero for kernel messages and in this case it is
impossible to restore it.
Signed-off-by: Andrei Vagin <avagin at 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
More information about the Devel
mailing list