Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Oct 2015 17:19:26 +0300
From:      Sergey Zakharchenko <doublef.mobile@gmail.com>
To:        freebsd-virtualization@freebsd.org
Subject:   Docker: jail: name cannot be numeric fix
Message-ID:  <CADYCxoOGAyBe=bzxX0OB=q4N6qM7ZcnP1-oKbEGmYjy9pQMVww@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello,

This is just a quick note that the problem mentioned in the Docker
wiki https://wiki.freebsd.org/Docker :

> {{{
> docker run -t -i centos /bin/bash
> jail: name cannot be numeric (unless it is the jid
> }}}
>
> Unknown: Noticed when re-running a container.

is not of an 'unknown' origin: it lies in sys/kern/kern_jail.c 's
detection of numeric JIDs, which dates back to 2009:

https://svnweb.freebsd.org/base/head/sys/kern/kern_jail.c?revision=285685&view=markup

else if (*namelc == '0' || (strtoul(namelc, &p, 10) != jid && *p == '\0')))

It thinks everything that starts with a '0' is numeric, and doesn't
check that it's the only character, e.g. namelc[1] == '\0'. This check
is incorrect for some of the hex jail names that Docker generates.
This is demonstrated by e.g. the following:

 ---> Running in 062a4f391fd9
jail: name cannot be numeric (unless it is the jid)

Should I send a PR?

Best regards,

-- 
DoubleF



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADYCxoOGAyBe=bzxX0OB=q4N6qM7ZcnP1-oKbEGmYjy9pQMVww>