2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 19:39:24 +00:00
Commit Graph

10497 Commits

Author SHA1 Message Date
Christian Brauner
eda2b7467e mainloop: disable IORING_SETUP_SQPOLL for now
It's a bit more complicated to use then I envisioned here.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:22:02 +02:00
Christian Brauner
3f3e75c4e2 mainloop: add comments about multishot and oneshot cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:22:02 +02:00
Christian Brauner
620f6c9caa mainloop: s/handler_name/name/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:22:00 +02:00
Christian Brauner
1306659ecb mainloop: move variables into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:59 +02:00
Christian Brauner
14f8022a59 memory_utils: make cleanup handler as unused
They are sometimes used to just clean something up automatically at end
of scope but the variables themselves might not be actually used.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:57 +02:00
Christian Brauner
502998699a mainloop: fix io_uring cleanup handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:56 +02:00
Christian Brauner
4fc38d526e mainloop: remove CANCEL_RAISE flag
This is really not needed since we're not checking it anywhere anyway.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:54 +02:00
Christian Brauner
771161376e mainloop: minor fixes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:53 +02:00
Tycho Andersen
eb218b3943 mainloop: s,sys/poll,poll
I get the following warning (which then fails the build because of
-Werror):

In file included from mainloop.c:11:
/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
2021-10-14 17:21:51 +02:00
Simon Deziel
2aad32dca2 lxc-download: add LXC version/compat level to user-agent
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
2021-10-14 17:21:50 +02:00
Christian Brauner
b1f9aee5c4 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-10-14 17:21:46 +02:00
Thomas Parrott
aa96b8e35b doc: Adds mention of ability to specify manual IPv4 broadcast address
See also https://github.com/lxc/lxd/pull/9103

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2021-10-14 17:21:42 +02:00
Christian Brauner
5210178135 tree-wide: s/lxc_epoll_descr/lxc_async_descr/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:39 +02:00
Christian Brauner
cff59253a0 conf: log session keyring failure on WARN level
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:37 +02:00
Christian Brauner
27217f7c54 cgroups: log at warning instead of error level
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-14 17:21:35 +02:00
Edênis Freindorfer Azevedo
983c0dd85a Improve bash completion.
Use as much as possible from each command `--help` for completion.

Some options require a long list of completions that should be dumped by
some command option. These are not added here yet.

Examples of those are: `lxc-info --config`, `lxc-execute --define` and
`lxc-start --define`.

Signed-off-by: Edenis Freindorfer Azevedo <edenisfa@gmail.com>
2021-10-14 17:21:32 +02:00
Edênis Freindorfer Azevedo
2d317f2596 Create rules to add/remove symlinks for bash completion.
By default, there is no out-of-the-box bash completion for lxc tools.
This is due to dynamic loading of completions, that requires the
completion filename to be the same as the command (e.g. `lxc-start`
expects a completion filename `lxc-start`). But all commands are in file
`lxc`, which is not read.

Signed-off-by: Edenis Freindorfer Azevedo <edenisfa@gmail.com>
2021-10-14 17:21:29 +02:00
Edênis Freindorfer Azevedo
ce97c9de05 Fix typo on documentation for lxc-{attach,execute}.
According to `[1]`, `lxc-attach` uses `-u,-g` instead of `--u,--g`.
According to `[2]`, `lxc-execute` uses `-u,-g` instead of `--u,--g`.

- [1] https://github.com/lxc/lxc/blob/stable-4.0/src/lxc/tools/lxc_attach.c#L131-L132
- [2] https://github.com/lxc/lxc/blob/stable-4.0/src/lxc/tools/lxc_execute.c#L59-L60

Signed-off-by: Edenis Freindorfer Azevedo <edenisfa@gmail.com>
2021-10-14 17:21:23 +02:00
Edênis Freindorfer Azevedo
b8c4234ef1 Fix typo on documentation for lxc-autostart.
According to `[1,2]`, this command has `--groups` instead of `--group`.

- [1] https://github.com/lxc/lxc/blob/stable-4.0/src/lxc/tools/lxc_autostart.c#L64
- [2] https://github.com/lxc/lxc/blob/stable-4.0/src/lxc/tools/lxc_autostart.c#L84

Signed-off-by: Edenis Freindorfer Azevedo <edenisfa@gmail.com>
2021-10-14 17:21:18 +02:00
Stéphane Graber
cec7cb14b2 Merge pull request #3969 from brauner/2021-09-03.fixes.stable
tests: fix config file tests
2021-09-13 08:41:51 -04:00
Christian Brauner
671a65391f tests: fix config file tests
Link: https://bugs.launchpad.net/bugs/1943441
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-13 14:11:05 +02:00
Stéphane Graber
5cbc29d1eb doc/api-extensions: Grammar fix
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2021-08-09 19:42:00 +02:00
Christian Brauner
c9d9085b3f lsm/apparmor: use cleanup macro
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-09 17:38:41 +02:00
Christian Brauner
fcf3e60765 lsm/apparmor: log failure to write AppArmor profile
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-09 17:38:39 +02:00
Christian Brauner
a80856010c network: fix container with empty network namespaces
Fixes: #3922
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-09 17:38:36 +02:00
Christian Brauner
60f6207ac2 tests: add test for rootfs mount options
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:11 +02:00
Christian Brauner
7997d7fb1c conf: allow mount options for rootfs when using new mount api
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:10 +02:00
Christian Brauner
c2c8a897a8 mount_utils: make some mount helpers static inline
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:09 +02:00
Christian Brauner
72acfa2795 conf: let parse_vfs_attr() handle legacy mount flags as well
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:09 +02:00
Christian Brauner
88c348f376 conf: log failure to create tty mountpoint
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:08 +02:00
Christian Brauner
2d7001d9d8 conf: refactor lxc_recv_ttys_from_child()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:07 +02:00
Christian Brauner
bca3805913 conf: fix logging in lxc_idmapped_mounts_child()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:06 +02:00
Christian Brauner
124f9b8b9e mount_utils: introduce mount_at()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-03 16:18:02 +02:00
Christian Brauner
02998e6c4d terminal: fail on unknown error during TIOCGPTPEER
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:21 +02:00
Christian Brauner
4c75aa656c terminal: move native terminal allocation from error logging to info
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:20 +02:00
Christian Brauner
e33da9473f conf: handle kernels without TIOCGPTPEER
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:19 +02:00
Christian Brauner
617195aa62 start: allow containers to use a native console
After all of the previous rework we can make it possible for a container
to use a console allocated from the container's devpts instance.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:18 +02:00
Christian Brauner
28321bd615 terminal: remove unused argument from lxc_devpts_terminal()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:17 +02:00
Christian Brauner
292a6d4852 conf: rework console setup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:16 +02:00
Christian Brauner
7de17c5d7d file_utils: add open_at_same()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:15 +02:00
Christian Brauner
914c8117e6 conf: use mount_fd() during console mounting
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:14 +02:00
Christian Brauner
c1e81360dc conf: use mount_fd() in lxc_setup_dev_console()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:13 +02:00
Christian Brauner
2ca395e000 conf: use mount_fd() helper when mounting ttys
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:11 +02:00
Christian Brauner
97cb264385 mount_utils: add mount_fd()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:10 +02:00
Christian Brauner
d9fd5a83df conf: stash pty_nr in struct lxc_terminal
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:09 +02:00
Christian Brauner
425875136b conf: move lxc_create_ttys() before pivot root
This is the last setup step that occured after pivot root.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:08 +02:00
Christian Brauner
b83fc7ff53 terminal: split out lxc_devpts_terminal() helper
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:07 +02:00
Christian Brauner
0f427a9f98 string_utils: cast __s64 to long long signed int
Link: https://launchpadlibrarian.net/550723147/buildlog_snap_ubuntu_focal_ppc64el_lxd-latest-edge_BUILDING.txt.gz
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:06 +02:00
Christian Brauner
e428dfdfc4 conf: merge devpts setup and move before pivot root
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:05 +02:00
Christian Brauner
d413c48628 terminal: don't use ttyname_r() for native terminal allocation
Since we can call that function from another mount namespace we need to
do this manually.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-02 14:45:04 +02:00