]> git.ipfire.org Git - thirdparty/lxc.git/commit
confile: use mmap() to parse config file
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 23 Feb 2018 12:24:35 +0000 (13:24 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 24 Feb 2018 20:37:39 +0000 (21:37 +0100)
commit9994d1402c19f8de880f2a6ae361a460a04085d5
tree7d6ab46bb18fe291a245dd068496179adc5c4d64
parent1401329e7789e9d6d5ed1a50a0fad3a7ebf304ae
confile: use mmap() to parse config file

Sigh, this is going to be fun. Essentially, dynamic memory allocation through
malloc() and friends is unsafe when fork()ing in threads. The locking state
that glibc maintains internally might get messed up when the process that
fork()ed calls malloc or calls functions that malloc() internally. Functions
that internally malloc() include fopen(). One solution here is to use open() +
mmap() instead of fopen() + getline().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/Makefile.am
src/lxc/cmd/lxc_user_nic.c
src/lxc/confile.c
src/lxc/lxccontainer.c
src/lxc/parse.c
src/lxc/parse.h
src/lxc/utils.c
src/lxc/utils.h