[CRIU] [RFC 0/2] Handle unix stream sockets with mismatch in shutdown state

Andrey Ryabinin aryabinin at virtuozzo.com
Thu May 19 08:55:35 PDT 2016


It appears that it's possible to create AF_UNIX stream sockets with mismatch
in shutdown state:
	Error (sk-unix.c:378): sk unix: Shutdown mismatch 38859:1 -> 38858:0
	Error (cr-dump.c:1309): Dump files (pid: 5060) failed with -1
	Error (cr-dump.c:1611): Dumping FAILED.

You just need to call shutdown() before connect() (see second patch with test).

This may sound like a bug in the kernel, however the kernel always checks shutdown
state on both ends before read()/write(), so from userspace POV sockets with mismatched
shutdown state behave the same way as with matched state.
So do we need such workaround in CRIU? or should I just fix this in kernel? or both?

Andrey Ryabinin (2):
  sk-unix: ignore shutdown mismatch in unix sockets
  test/sockets: add test for shut down stream unix sockets

 criu/sk-unix.c                  |  20 +++----
 test/zdtm/static/Makefile       |   1 +
 test/zdtm/static/sockets03.c    | 118 ++++++++++++++++++++++++++++++++++++++++
 test/zdtm/static/sockets03.desc |   1 +
 4 files changed, 129 insertions(+), 11 deletions(-)
 create mode 100644 test/zdtm/static/sockets03.c
 create mode 100644 test/zdtm/static/sockets03.desc

-- 
2.7.3



More information about the CRIU mailing list