zdtm: add scm08 test having several SCM_RIGHTS and SCM_CREDENTIALS

This allows us to catch long standing bug in vzcriu when scm-s were not
dumped properly - scm-s from second packet contained both scm-s from
first and second packet. This happenes in case there several SCM_RIGHTS
packets and at least one SCM_CREDENTIALS packets were sent to unix
socket at the same time.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

(cherry picked from commit 65ea504a97506355c0a5a4d9612a4827a58d6631)
Signed-off-by: Ahmed Elaidy <elaidya225@gmail.com>
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
This commit is contained in:
Pavel Tikhomirov 2022-06-06 16:02:43 +03:00 committed by Alexander Mikhalitsyn
parent cf89a0b7d0
commit a4f00387b8
4 changed files with 15 additions and 0 deletions

View file

@ -232,6 +232,7 @@ TST_NOFILE := \
scm05 \
scm06 \
scm07 \
scm08 \
scm09 \
aio00 \
aio01 \
@ -674,6 +675,7 @@ vdso01: LDLIBS += -lrt
scm01: CFLAGS += -DKEEP_SENT_FD
scm02: CFLAGS += -DSEND_BOTH
scm04: CFLAGS += -DSEPARATE
scm08: CFLAGS += -DSEND_ANOTHER_FD
scm09: CFLAGS += -DCLOSE_SENDER_FD
mntns_link_remap: CFLAGS += -DZDTM_LINK_REMAP
mntns_shared_bind02: CFLAGS += -DSHARED_BIND02

View file

@ -160,6 +160,17 @@ int main(int argc, char **argv)
exit(1);
}
#ifdef SEND_ANOTHER_FD
if (send_fd(sk[0], p[1]) < 0) {
pr_perror("Can't send descriptor");
close(sk[0]);
close(sk[1]);
close(p[0]);
close(p[1]);
exit(1);
}
#endif
/* we sent this side of socketpair */
close(p[1]);

1
test/zdtm/static/scm08.c Symbolic link
View file

@ -0,0 +1 @@
scm07.c

1
test/zdtm/static/scm08.desc Symbolic link
View file

@ -0,0 +1 @@
scm07.desc