Commit Graph

486 Commits

Author SHA1 Message Date
Antonio Terceiro
25d1b3fb09 bash: rename main bash completion file
Since the `lxc` binary is actually provided by lxd, the main
bash-completion file needs to be moved away to not conflict with a bash
completion file provided for the `lxc` binary by lxd.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
2022-05-12 10:47:18 -03:00
Christian Brauner
e27637b7b9
build: simplify thread local storage handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
f7d3ef8380
build: only enable LTO for regular builds
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Joan Bruguera
d19c1aa67d autotools: Avoid multiple liblxc.so with --enable-pam
When installing LXC with the default options, a single non-symlink liblxc.so*
(e.g. liblxc.so.1.7.0) file is created:

```
    $ ./autogen.sh && ./configure && make && \
    rm -rf "$HOME/lxci" && make DESTDIR="$HOME/lxci" install && \
    stat -c%N "$HOME/lxci/usr/local/lib/liblxc.so"*
    [...]
    '/home/someone/lxci/usr/local/lib/liblxc.so' -> 'liblxc.so.1'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1' -> 'liblxc.so.1.7.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.7.0'
```

However, when automake>=1.16.5, and the `--enable-pam` option is used, two
non-symlink liblxc.so* (e.g. liblxc.so.1.0.0 and liblxc.so.1.7.0) are
erroneously created:

```
    $ ./autogen.sh && ./configure --enable-pam && make && \
    rm -rf "$HOME/lxci" && make DESTDIR="$HOME/lxci" install && \
    stat -c%N "$HOME/lxci/usr/local/lib/liblxc.so"*
    [...]
    '/home/someone/lxci/usr/local/lib/liblxc.so' -> 'liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1' -> 'liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.7.0'
```

This is due to infighting between libtool's and LXC's versioning:
libtool creates liblxc.so.1.0.0, then LXC's `install-exec-local` hook in
`Makefile.am` moves it to liblxc.so.1.7.0. However, with `--enable-pam`, the
`install-libLTLIBRARIES` target is re-triggered after `install-pamLTLIBRARIES`,
which will create liblxc.so.1.0.0 again.

The bigger problem here is that the install for the pam_cgfs library is done on
the `data` phase of the automake install process instead of the `exec` phase
(https://www.gnu.org/software/automake/manual/html_node/The-Two-Parts-of-Install.html),
which gives `install-libLTLIBRARIES` a chance to run again after the
`install-exec-local` / `install-exec-hook` targets have already run.

To fix this, we add an "exec_" prefix to the pam_cgfs library to make it run
during the `exec` phase (see link above). We also consolidate the various hooks
in the `install-exec-hook` target, which runs after the whole install, avoiding
needing to manually specify the dependencies like in `install-exec-local`.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2021-11-07 17:40:35 +01:00
Christian Brauner
ea0e384ff5
process_utils: add signal_name() helper
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-11-02 10:58:35 +01:00
Diederik de Haas
ac46b35693
Replace deprecated backticks with $() construct
See https://github.com/koalaman/shellcheck/wiki/SC2006 for details.
Not only uses this the recommended construct, it also makes the code
more uniform as in many other places the $() construct was already used.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2021-10-28 20:15:29 +02:00
Stéphane Graber
9985804066
Merge pull request #3963 from brauner/2021-09-03.build
build: add basic meson support
2021-09-14 22:41:55 -04:00
Christian Brauner
8a046c4c56
log: fix cross-compilation with %m modifier
Fixes: #3961
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-13 12:30:52 +02:00
Christian Brauner
784839ae18
build: make sure _GNU_SOURCE is set
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-03 19:06:08 +02:00
Christian Brauner
37acd20e44
configure: add sanitizer flags to LDFLAGS as well
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-01 09:46:58 +02:00
Christian Brauner
543d2f838c
mainloop: add io_uring support
Users can choose to compile liblxc with io_uring support. This will
cause LXC to use io_uring instead of epoll.
We're using both, io_uring's one-shot and multi-shot poll mode depending
on the type of handler.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-10 14:33:48 +02:00
Evgeny Vereshchagin
a390325fdf oss-fuzz: always turn off logging on OSS-Fuzz
Apparently /proc/self/cmd can't be used (reliably) on OSS-Fuzz to figure out
whether the code is run inside the fuzz targets, which causes the
fuzz targets to fill the filesystem with log files.

Related: https://github.com/google/oss-fuzz/issues/5509
Should address https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33835

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-30 11:19:21 +00:00
Evgeny Vereshchagin
a10327e7d8 build-system: turn off lto=thin when building the fuzzers
With lto=thin the fuzzers fail as soon as they start with
```
ERROR: The size of coverage PC tables does not match the
number of instrumented PCs. This might be a compiler bug,
please contact the libFuzzer developers.
Also check https://bugs.llvm.org/show_bug.cgi?id=34636
for possible workarounds (tl;dr: don't use the old GNU ld)
```

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-27 00:34:22 +00:00
Evgeny Vereshchagin
38718ccca0 build-system: add --enable-fuzzers
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-26 19:57:56 +00:00
Christian Brauner
305b3b9c14
configure: fix function detection
Fixes: #3809
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-24 11:19:53 +02:00
Christian Brauner
031e0285fa
mount_utils: add support for mount_setattr() syscall
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-21 10:05:58 +02:00
Evgeny Vereshchagin
d480165a4b autoconf: stop passing -fsanitize=address via AM_LDFLAGS
The snippet is redundant because the build system automatically
passes the sanitizers flags set in AM_CFLAGS to the linker

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-14 00:47:46 +00:00
Christian Brauner
cdfa8f13f2
configure: fix sanitizer compilation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-17 17:26:30 +02:00
Evgeny Vereshchagin
792a48b180 build-system: make it compatible with ASan/UBsan/MSan
Closes: https://github.com/lxc/lxc/issues/3727

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 06:09:35 +00:00
Christian Brauner
5f40423627
autotools: remove --enable-{asan,ubsan} in favor of --enable-sanitizers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 17:35:59 +02:00
Christian Brauner
448439729d
compiler: fix thread_local detection
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 16:03:57 +02:00
Christian Brauner
52ce85046b
conf: fix thread_local support detection
Our detection for TLS wasn't working. Fix it.

Fixes: https://github.com/lxc/lxd/issues/8327
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 13:32:00 +02:00
Christian Brauner
7e4ea7bffd
configure: fix strchrnul conditiona compilation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-21 16:04:35 +01:00
Christian Brauner
88cf3229fe
string_utils: provide a version of strchrnul() in case it's not available
This should only happen on Android.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-20 12:34:36 +01:00
Christian Brauner
b1abf15db2
macro: define __aligned_u64 to handle kernels without such support
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-17 19:28:26 +01:00
Christian Brauner
928937b114
cgroups: remove compile-time bpf support detection
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-18 12:42:34 +01:00
Christian Brauner
ac11febd37
mount_utils: add locked flag helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-08 09:53:34 +01:00
Christian Brauner
e8aaef8159
syscalls: add close_range()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-03 09:45:30 +01:00
Christian Brauner
6d6bfd4f6c
configure: fix static builds with clang-12 and LTO
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-01-29 13:04:58 +01:00
Christian Brauner
b59bc011e3
autotools: update build
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-01-25 17:04:43 +01:00
Christian Brauner
1aaf81c338
configure: add AC_SYS_LARGEFILE checking
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-01-25 12:51:31 +01:00
Christian Brauner
014a65ef16
configure: support static binaries
Including openssl handling.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-01-22 19:30:15 +01:00
Eneas U de Queiroz
67cd8bde2d
configure: skip libseccomp tests if it is disabled
Move the block checking for libseccomp api compatibility inside
AM_COND_IF([ENABLE_SECCOMP] ... ).

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2021-01-16 13:58:22 -03:00
Christian Brauner
2b0c810617
syscalls: add openat2()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-08-09 19:52:30 +02:00
Christian Brauner
7f1d397bbd
syscalls: add fsmount()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-07-23 10:20:50 +02:00
Christian Brauner
9edfcaa822
syscalls: add fsconfig()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-07-23 10:20:50 +02:00
Christian Brauner
749bc40479
syscalls: add fspick()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-07-23 10:20:50 +02:00
Christian Brauner
49b21cd7d9
syscalls: add fsopen()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-07-23 10:20:48 +02:00
Christian Brauner
35eb5cdcb3
openpty: improve implementation and handling of platforms without it
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-07-06 10:57:47 +02:00
Christian Brauner
2f46fe6e7a
process_utils: make lxc use clone3() whenever possible
No more weird api quirks between architectures and cool new features.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-05-15 16:08:31 +02:00
Christian Brauner
96086a6b7b
process_utils: add clone3() support
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-05-15 13:42:56 +02:00
Christian Brauner
f40988c773
process_utils: introduce new process_utils.{c,h}
This will be the central place for all process management helpers. This also
removes raw_syscalls.{c,h}.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-05-15 12:32:28 +02:00
Christian Brauner
6acf25e36a
gcc: add -Warray-bounds, -Wrestrict, -Wreturn-local-addr, -Wstringop-overflow
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-05-05 09:21:33 +02:00
Christian Brauner
cf68ffd9e2
conf: support console setup on containers without rootfs
This depends on the new mount api.

Closes #3164.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-05-04 13:26:43 +02:00
Christian Brauner
538337ee9d
configure: fix coverity builds
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-04-16 10:03:45 +02:00
Christian Brauner
64a2547c0a
travis: coverity gets confused about the %m printf extension in glibc
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-04-15 21:27:53 +02:00
Wolfgang Bumiller
b62782546c allow running lxc-monitord as a system daemon
lxc-monitord instances are spawned on demand and, if this
happens from a service, the daemon is considered part of
it by systemd, as it is running in the same cgroups. This
can be avoided by leaving it running permanently.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-03-31 15:34:56 +02:00
Stéphane Graber
c40aa8c893
configure.ac: Reset devel flag post-release
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-03-24 16:36:14 -04:00
Stéphane Graber
a8565bb4aa
Release LXC 4.0.0
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-03-24 16:35:48 -04:00
Christian Brauner
fef909cf62
make dist: add missing files
deleted:    CODING_STYLE.md
deleted:    LICENSE.GPL2
deleted:    LICENSE.LGPL2.1
deleted:    README.md
deleted:    coccinelle/exit.cocci
deleted:    coccinelle/run-coccinelle.sh
deleted:    coccinelle/while-true.cocci
deleted:    doc/api-extensions.md
deleted:    src/tests/lxc-test-exit-code
deleted:    src/tests/travis.sh

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-24 20:37:00 +01:00