[CRIU] [PATCH 4/4] test: add a test for vanilla unshare()

Tycho Andersen tycho.andersen at canonical.com
Thu May 7 07:12:25 PDT 2015


On Thu, May 07, 2015 at 11:10:41AM +0300, Andrew Vagin wrote:
> On Wed, May 06, 2015 at 08:07:54AM -0600, Tycho Andersen wrote:
> > This test currently fails, but replicates (in a slightly hacky way viz. the
> > unshare in zdtm.sh) the case where criu is too greedy matching external mounts.
> > 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > ---
> >  test/zdtm.sh                               |  6 +-
> >  test/zdtm/.gitignore                       |  1 +
> >  test/zdtm/live/static/Makefile             |  1 +
> >  test/zdtm/live/static/mnt_ext_vanilla.c    | 94 ++++++++++++++++++++++++++++++
> >  test/zdtm/live/static/mnt_ext_vanilla.opts |  1 +
> >  5 files changed, 102 insertions(+), 1 deletion(-)
> >  create mode 100644 test/zdtm/live/static/mnt_ext_vanilla.c
> >  create mode 100644 test/zdtm/live/static/mnt_ext_vanilla.opts
> > 
> > diff --git a/test/zdtm.sh b/test/zdtm.sh
> > index 3dee9d6..1478a9c 100755
> > --- a/test/zdtm.sh
> > +++ b/test/zdtm.sh
> > @@ -546,7 +546,11 @@ start_test()
> >  	(
> >  		# Here is no way to set FD_CLOEXEC on 3
> >  		exec 3>&-
> > -		make -C $tdir $tname.pid
> > +		if [ "$tname" = "mnt_ext_vanilla" ]; then
> > +			unshare -m make -C $tdir $tname.pid
> 
> Can we call ushared from the test source code?

Ideally, yes. I think we can reproduce it with a very short test case:

int main(int argc, char ** argv)
{
  unshare(CLONE_NEWNS);
  test_init(argc, argv);

  test_daemon();
  test_waitsig();

  pass();

  return 0;
}

However, when I tried that, I got:

sudo ./zdtm.sh -r static/mnt_ext_vanilla
Execute static/mnt_ext_vanilla
./mnt_ext_vanilla --pidfile=mnt_ext_vanilla.pid --outfile=mnt_ext_vanilla.out
Dump 3391
WARNING: mnt_ext_vanilla returned 1 and left running for debug needs
Test: zdtm/live/static/mnt_ext_vanilla, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/mnt_ext_vanilla, Namespace: 
Dump log   : /home/ubuntu/criu/test/dump/static/mnt_ext_vanilla/3391/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.036499) Error (files-reg.c:822): Can't lookup mount=23 for fd=-3 path=/home/ubuntu/criu/test/zdtm/live/static/mnt_ext_vanilla
(00.036504) Error (cr-dump.c:1639): Dump mappings (pid: 3391) failed with -1
(00.036572) Error (cr-dump.c:1943): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

This is failing somewhere in the VMA code trying to load the actual
executable off of the old mountpoint. I'm not sure how to work around
this.

If I move the unshare() to below test_init(), the testcase passes
successfully, which also seems wrong :)

Tycho


More information about the CRIU mailing list