Skip to content

Commit a316b10

Browse files
justincormackTibor Vass
authored and
Tibor Vass
committed
Initialize nss libraries in Glibc so that the dynamic libraries are loaded in the host
environment not in the chroot from untrusted files. See also OpenVZ https://github.com/kolyshkin/vzctl/blob/a3f732ef751998913fcf0a11b3e05236b51fd7e9/src/enter.c#L227-L234 Signed-off-by: Justin Cormack <[email protected]> (cherry picked from commit cea6dca993c2b4cfa99b1e7a19ca134c8ebc236b) Signed-off-by: Tibor Vass <[email protected]>
1 parent 17fe47d commit a316b10

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/chrootarchive/archive.go

+9
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ import (
44
"fmt"
55
"io"
66
"io/ioutil"
7+
"net"
78
"os"
9+
"os/user"
810
"path/filepath"
911

1012
"github.com/docker/docker/pkg/archive"
1113
"github.com/docker/docker/pkg/idtools"
1214
)
1315

16+
func init() {
17+
// initialize nss libraries in Glibc so that the dynamic libraries are loaded in the host
18+
// environment not in the chroot from untrusted files.
19+
_, _ = user.Lookup("docker")
20+
_, _ = net.LookupHost("localhost")
21+
}
22+
1423
// NewArchiver returns a new Archiver which uses chrootarchive.Untar
1524
func NewArchiver(idMapping *idtools.IdentityMapping) *archive.Archiver {
1625
if idMapping == nil {

0 commit comments

Comments
 (0)