Commit Graph

9144 Commits

Author SHA1 Message Date
Christian Brauner
b3ed206162
cgroups: honor lxc.cgroup.pattern if set explicitly
Link: https://discuss.linuxcontainers.org/t/lxc-cgroup-pattern-is-not-being-honored
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-02-28 11:07:39 +01:00
Stéphane Graber
bf04c8508d
Merge pull request #3268 from brauner/2020-02-25/cgroups
cgroups: remove unused method and cleanup cgroup_exit()
2020-02-25 20:34:18 +01:00
Christian Brauner
c3f5890cfe
cgroups: remove unused method and cleanup cgroup_exit()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-02-25 13:38:32 +01:00
Stéphane Graber
ecf79d49e7
Merge pull request #3265 from brauner/2020-02-13/fix_setgroups
tree-wide: improve setgroups() dropping
2020-02-13 01:10:31 +01:00
Christian Brauner
b58214ac30
tree-wide: improve setgroups() dropping
Drop groups before we change to userns root.

Reported-by: Teddy Reed <teddy.reed@gmail.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-02-13 00:16:15 +01:00
Christian Brauner
1d5f322246
Merge pull request #3264 from tych0/fix-leak
lxclock: fix a small memory leak
2020-02-10 18:06:39 +01:00
Tycho Andersen
b8a6a00cc3 lxclock: fix a small memory leak
if (!name), we allocate an unnamed semaphore, but if we then fail to
allocate/create the lock, we don't free this semaphore, and we just leak
it.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2020-02-10 08:14:33 -07:00
Christian Brauner
a5ee97e629
Merge pull request #3261 from blenk92/fix-parse-config
container.conf: Fix parsing of config options:
2020-02-05 19:49:48 +01:00
Maximilian Blenk
20c3318a80 container.conf: Document that order is important in config_jump_table
Add a comment that documents that more specific options of a
namespace have to be added above more generic options in
config_jump_table.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-02-05 19:31:40 +01:00
Maximilian Blenk
9aee23ad1b container.conf: Fix option ordering in config_jump_table
Currently lxc.selinux.context.keyring is placed after
lxc.selinux.context in config_jump_table. This entails that if
lxc.selinux.context.keyring is specified, lxc.selinux.context will be
matched to that option. This commit places the
lxc.selinux.context.keyring before lxc.selinux.context

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-02-05 19:28:35 +01:00
Maximilian Blenk
52ab03ac19 container.conf: Fix off by 2 in option parsing
This commit fixes a off by 2 in config option parsing
(due to missing parenthesis). The error occurs if for instance
lxc.net.0.type is parsed. In that case, the .0 is removed from the
string. However, due to the missing parenthesis, the null terminating
character is off by two which means the modified config option would
be lxc.net.typepe instead of lxc.net.type.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-02-05 19:18:25 +01:00
Christian Brauner
a8b9febda3
Merge pull request #3260 from blenk92/add-keyring-option
Add keyring option
2020-01-31 15:56:54 +01:00
Maximilian Blenk
ad36e96a3d doc: Add doc for keyring options
Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-01-31 14:33:10 +01:00
Maximilian Blenk
8f818a8454 container.conf: Add option to disable session keyring creation
lxc set's up a new session keyring for every container by default.
There might be valid use-cases where this is not wanted / needed
(e.g. systemd by default creates a new session keyring anyway).

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-01-31 14:33:10 +01:00
Maximilian Blenk
4fef78bc33 container.conf: Add option to set keyring SELinux context
lxc set's up a new session keyring for every container by default.
If executed on an SELinux enabled system, by default, the keyring
inherits the label of the creating process. If executed with the
currently available SELinux policy, this means that the keyring
is labeled with the lxc_t type. Applications inside the container,
however, might expect that the keyring is labeled with a certain
context (and will fail to access the keyring if it's not explicitly
allowed in the global policy). This patch introduces the config
option lxc.selinux.context.keyring which enables to specify the
label of the newly created keyring. That is, the keyring can be
labeled with the label expected by the started application.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2020-01-31 14:33:01 +01:00
Christian Brauner
f5a15e1e3d
Merge pull request #3259 from chobostar/fix_default_cgroup_pattern
cgroups: fix default cgroup pattern
2020-01-27 14:11:12 +01:00
Kirill Petrov
4ba0393577 cgroups: fix default cgroup pattern
Signed-off-by: Kirill Petrov <yakutskkirill@mail.ru>
2020-01-27 11:51:36 +03:00
Stéphane Graber
5f77c7d574
Merge pull request #3255 from brauner/2020-01-16/fix_monitor_hang
start: fix container killing logic
2020-01-17 08:18:10 -05:00
Christian Brauner
11c7d34961
start: fix container killing logic
We need to account for the case where pidfd's are not supported by the kernel
in question.

Closes: #3254
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-16 18:03:39 +01:00
Christian Brauner
917a7c1594
Merge pull request #3253 from tomponline/tp-network-mtu
network: Restore fixed MTU functionality
2020-01-15 11:15:13 +01:00
Thomas Parrott
a00fbab580 network: Restore fixed MTU functionality
If MTU setting is provided in network device config then always use it rather than inheriting from the link device.

Affected both bridge and router veth modes.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2020-01-15 09:57:15 +00:00
Stéphane Graber
e0f8043530
Merge pull request #3251 from brauner/master
test: increase timeout for api reboot tests
2020-01-14 09:58:33 -05:00
Christian Brauner
bd6741f8e9
Merge pull request #3250 from lifeng68/fix_lxc
cgroup.c: fix memory leak at cgroup init failed
2020-01-14 14:11:53 +01:00
Christian Brauner
fb2ac06720
test: increase timeout for api reboot tests
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-14 13:50:45 +01:00
LiFeng
e2a8c0c360 cgroup.c: fix memory leak at cgroup init failed
Signed-off-by: LiFeng <lifeng68@huawei.com>
2020-01-14 04:17:13 -05:00
Stéphane Graber
6f6bd4128e
Merge pull request #3248 from brauner/2020-01-05/veth_devices
network: improve veth device creation
2020-01-10 08:38:28 -05:00
Christian Brauner
8bf64b77ac
network: rework network device creation
This makes all the codepaths easier to follow and also moves and renames
devices in one single step.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-10 12:36:47 +01:00
Christian Brauner
0104c121a7
network: fix network device removal
We can't delete by netdev->ifindex since that's the ifindex of the device in
the container, not on the host. The correct thing is done below.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 18:08:48 +01:00
Christian Brauner
3919322d52
tests: log api reboot test failures
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 17:10:14 +01:00
Christian Brauner
0858c829b4
network: fix typ and formatting in comment
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 16:54:50 +01:00
Christian Brauner
542563017d
network: improve veth device creation
This allows us to avoid having to move the network device. It also allows us to
work around a kernel bug that in combination with a recent change in systemd
244 causes uses of systemd-networkd to not get an ip address.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 16:54:48 +01:00
Stéphane Graber
90ddf3c0d7
Merge pull request #3249 from brauner/2020-01-09/bugfixes
handle kernel version <--> header incompatibility
2020-01-09 10:47:36 -05:00
Christian Brauner
c718fac185
start: handle kernel header and kernel incompatability
We might e.g. be compiled in a container with old kernel headers. In this
scenario CLONE_PIDFD will work but pidfd_send_signal() might not be detected
because __NR_pidfd_send_signal is not defined because the kernel headers don't
match the kernel version.

This explains and fixes test-suite hangs on Jenkins I've recently debugged.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 12:30:14 +01:00
Christian Brauner
38bbeb799e
tests: timeout after 60 seconds
That should be more than enough to reboot.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 12:28:54 +01:00
Christian Brauner
1126d14815
mainloop: add missing \n
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-01-09 12:28:19 +01:00
Serge Hallyn
f036cc8a2c
Merge pull request #3241 from brauner/2019-12-25/remove_procfs_pidfd_support
start: remove procfs pidfd support
2020-01-08 09:45:57 -06:00
Stéphane Graber
26eb73ca7e
Merge pull request #3247 from Rachid-Koucha/patch-1
Suppress useless udhcpc directory
2020-01-04 14:11:50 -05:00
Rachid Koucha
eeea2ef1b1
Suppress useless udhcpc directory
The udhcpc directory is created with "mkdir -p" at the place dynamically specified by "busybox udhcpc --help".

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2020-01-03 10:48:41 +01:00
Christian Brauner
2b0d48477a
Merge pull request #3244 from Rachid-Koucha/master
Adaptation to latest busybox
2019-12-27 13:38:07 +01:00
Christian Brauner
d55ea1ec6c
Merge pull request #3243 from Rachid-Koucha/patch-1
Word repetition in comment
2019-12-27 12:08:26 +01:00
Rachid Koucha
e76e315c11
Adaptation to latest busybox
In busybox 1.30, the help of udhcpc for "-s" option changed:
--> busybox v1.27.2: -s,--script PROG	Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
--> busybox v1.30.1: -s PROG		Run PROG at DHCP events (default /etc/udhcpc/default.script)
So, I changed the command line which extracts the script name to make it work for both versions

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-27 08:49:00 +01:00
Christian Brauner
b94283e19f
start: remove procfs pidfd support
We'll only rely on proper anon-inode based pidfd support in the future.
There's no good reason to use the procfs fallback. All the fancy features we
might want to use are only available with anon-inode pidfds.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-26 13:01:03 +01:00
Rachid Koucha
f073d46045
Word repetition in comment
create_run_template(): Double "will mount" in a comment

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-26 11:51:54 +01:00
Stéphane Graber
33db34ef94
Merge pull request #3238 from brauner/2019-12-23/travis
travis: enable -fsanitize=undefined
2019-12-25 17:12:34 -05:00
Christian Brauner
2d50f34074
Merge pull request #3239 from vikaig/fix-shebang
cmd: fix shebang
2019-12-23 22:42:33 +01:00
vikaig
aac4e12abd cmd: fix shebang
Signed-off-by: vikaig <vikaig99@gmail.com>
2019-12-23 23:31:53 +02:00
Christian Brauner
384db5d761
travis: enable -fsanitize=undefined
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-23 22:12:09 +01:00
Christian Brauner
b4fde4ec4c
Merge pull request #3235 from xinhua9569/master
fd: only add valid fd to mainloop
2019-12-23 11:35:53 +01:00
dongxinhua
4879faffbf fd: only add valid fd to mainloop
Signed-off-by: dongxinhua <dongxinhua@huawei.com>
2019-12-23 16:45:36 +08:00
Christian Brauner
c7ba882842
Merge pull request #3233 from xinhua9569/master
seccomp: support s390 seccomp
2019-12-17 03:03:38 +01:00