From a4f00387b8e786e3cbb482da42e595d249a27fd3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 6 Jun 2022 16:02:43 +0300 Subject: [PATCH] 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 (cherry picked from commit 65ea504a97506355c0a5a4d9612a4827a58d6631) Signed-off-by: Ahmed Elaidy Reviewed-by: Alexander Mikhalitsyn --- test/zdtm/static/Makefile | 2 ++ test/zdtm/static/scm07.c | 11 +++++++++++ test/zdtm/static/scm08.c | 1 + test/zdtm/static/scm08.desc | 1 + 4 files changed, 15 insertions(+) create mode 120000 test/zdtm/static/scm08.c create mode 120000 test/zdtm/static/scm08.desc diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile index c2296ccc9..82eeec415 100644 --- a/test/zdtm/static/Makefile +++ b/test/zdtm/static/Makefile @@ -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 diff --git a/test/zdtm/static/scm07.c b/test/zdtm/static/scm07.c index 5474c6b01..e2c0fab66 100644 --- a/test/zdtm/static/scm07.c +++ b/test/zdtm/static/scm07.c @@ -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]); diff --git a/test/zdtm/static/scm08.c b/test/zdtm/static/scm08.c new file mode 120000 index 000000000..11df4e3d7 --- /dev/null +++ b/test/zdtm/static/scm08.c @@ -0,0 +1 @@ +scm07.c \ No newline at end of file diff --git a/test/zdtm/static/scm08.desc b/test/zdtm/static/scm08.desc new file mode 120000 index 000000000..6e2a849cf --- /dev/null +++ b/test/zdtm/static/scm08.desc @@ -0,0 +1 @@ +scm07.desc \ No newline at end of file