]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
3 years agocommands_utils: don't leak memory
Christian Brauner [Mon, 1 Feb 2021 21:34:33 +0000 (22:34 +0100)]
commands_utils: don't leak memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use correct put method
Christian Brauner [Mon, 1 Feb 2021 21:13:03 +0000 (22:13 +0100)]
attach: use correct put method

Fixes: Coverity 1472763
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: prevent UAF
Christian Brauner [Mon, 1 Feb 2021 21:11:38 +0000 (22:11 +0100)]
attach: prevent UAF

Fixes: Coverity 1472761
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3644 from brauner/2021-02-01/fixes_3
Stéphane Graber [Mon, 1 Feb 2021 20:26:08 +0000 (15:26 -0500)]
Merge pull request #3644 from brauner/2021-02-01/fixes_3

attach: harden open() calls

3 years agoattach: file descriptor based fdinfo handling
Christian Brauner [Mon, 1 Feb 2021 19:25:51 +0000 (20:25 +0100)]
attach: file descriptor based fdinfo handling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agofile_utils: remove O_NOFOLLOW from open_at() defaults
Christian Brauner [Mon, 1 Feb 2021 19:17:16 +0000 (20:17 +0100)]
file_utils: remove O_NOFOLLOW from open_at() defaults

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolsm: harden read_file_at()
Christian Brauner [Mon, 1 Feb 2021 19:15:16 +0000 (20:15 +0100)]
lsm: harden read_file_at()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agotree-wide: extend read_file_at()
Christian Brauner [Mon, 1 Feb 2021 19:12:03 +0000 (20:12 +0100)]
tree-wide: extend read_file_at()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: harden open calls
Christian Brauner [Mon, 1 Feb 2021 19:03:29 +0000 (20:03 +0100)]
attach: harden open calls

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agosyscall_wrappers: add PROTECT_LOOKUP, PROTECT_OPEN, PROTECT_LOOKUP_WITH_SYMLINKS...
Christian Brauner [Mon, 1 Feb 2021 16:08:06 +0000 (17:08 +0100)]
syscall_wrappers: add PROTECT_LOOKUP, PROTECT_OPEN, PROTECT_LOOKUP_WITH_SYMLINKS, PROTECT_OPEN_WITH_TRAILING_SYMLINKS

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agofile_utils: add open_at()
Christian Brauner [Mon, 1 Feb 2021 16:03:59 +0000 (17:03 +0100)]
file_utils: add open_at()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3642 from brauner/2021-02-01/fixes
Stéphane Graber [Mon, 1 Feb 2021 15:17:18 +0000 (10:17 -0500)]
Merge pull request #3642 from brauner/2021-02-01/fixes

attach: rework id handling

3 years agoMerge pull request #3643 from brauner/2021-02-01/fixes_2
Stéphane Graber [Mon, 1 Feb 2021 15:14:49 +0000 (10:14 -0500)]
Merge pull request #3643 from brauner/2021-02-01/fixes_2

cgroups: remove pointless NULL checks

3 years agocgroups: initialize variable
Christian Brauner [Mon, 1 Feb 2021 14:44:59 +0000 (15:44 +0100)]
cgroups: initialize variable

Fixes: Coverity 1472651
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: remove pointless NULL checks
Christian Brauner [Mon, 1 Feb 2021 14:20:43 +0000 (15:20 +0100)]
cgroups: remove pointless NULL checks

We're already ensuring before that conf isn't NULL.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: stash host uid and host gid in attach_context
Christian Brauner [Mon, 1 Feb 2021 14:16:56 +0000 (15:16 +0100)]
attach: stash host uid and host gid in attach_context

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: fix error checking for dup2()
Christian Brauner [Mon, 1 Feb 2021 13:51:41 +0000 (14:51 +0100)]
attach: fix error checking for dup2()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: fix logging for stdfd replacement
Christian Brauner [Mon, 1 Feb 2021 13:50:55 +0000 (14:50 +0100)]
attach: fix logging for stdfd replacement

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: log failues to dup2() with SYSDEBUG()
Christian Brauner [Mon, 1 Feb 2021 13:44:45 +0000 (14:44 +0100)]
attach: log failues to dup2() with SYSDEBUG()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoutils: use SYSTRACE() when logging stdio permission fixup failures
Christian Brauner [Mon, 1 Feb 2021 13:35:42 +0000 (14:35 +0100)]
utils: use SYSTRACE() when logging stdio permission fixup failures

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: document attach_context
Christian Brauner [Mon, 1 Feb 2021 11:23:43 +0000 (12:23 +0100)]
attach: document attach_context

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: simplify opening of /proc/self
Christian Brauner [Mon, 1 Feb 2021 11:23:26 +0000 (12:23 +0100)]
attach: simplify opening of /proc/self

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move uid and gid handling to get_attach_context()
Christian Brauner [Mon, 1 Feb 2021 11:22:42 +0000 (12:22 +0100)]
attach: move uid and gid handling to get_attach_context()

the less we do in do_attach(), the better.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: initialize init_pid field to -ESRCH
Christian Brauner [Mon, 1 Feb 2021 10:43:47 +0000 (11:43 +0100)]
attach: initialize init_pid field to -ESRCH

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: unifiy /proc/<init-pid>/status parsing
Christian Brauner [Mon, 1 Feb 2021 10:37:22 +0000 (11:37 +0100)]
attach: unifiy /proc/<init-pid>/status parsing

and move it out of do_attach(). The less we do in the container's context the
better.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agofile_utils: add fdopenat()
Christian Brauner [Mon, 1 Feb 2021 10:11:15 +0000 (11:11 +0100)]
file_utils: add fdopenat()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3641 from brauner/2021-01-30/fixes
Stéphane Graber [Sun, 31 Jan 2021 22:13:25 +0000 (17:13 -0500)]
Merge pull request #3641 from brauner/2021-01-30/fixes

attach: pidfd-based hardening and file-descriptor-only LSM interactions

3 years agolsm/apparmor: cleanup apparmor_process_label_set()
Christian Brauner [Sun, 31 Jan 2021 20:48:00 +0000 (21:48 +0100)]
lsm/apparmor: cleanup apparmor_process_label_set()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: hardening through use of pidfds
Christian Brauner [Sun, 31 Jan 2021 19:44:09 +0000 (20:44 +0100)]
attach: hardening through use of pidfds

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: file descriptors based LSM handling
Christian Brauner [Sun, 31 Jan 2021 18:26:53 +0000 (19:26 +0100)]
attach: file descriptors based LSM handling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: align methods
Christian Brauner [Sat, 30 Jan 2021 20:54:45 +0000 (21:54 +0100)]
cgroups: align methods

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3639 from brauner/2021-01-28/fixes
Stéphane Graber [Sat, 30 Jan 2021 19:23:25 +0000 (14:23 -0500)]
Merge pull request #3639 from brauner/2021-01-28/fixes

cgroups: fixes and improvements

3 years agocgroups: use PTR_TO_U64()
Christian Brauner [Sat, 30 Jan 2021 16:28:32 +0000 (17:28 +0100)]
cgroups: use PTR_TO_U64()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: don't needless check for NULL
Christian Brauner [Sat, 30 Jan 2021 16:07:55 +0000 (17:07 +0100)]
attach: don't needless check for NULL

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolog: add lxc_log_trace() helper
Christian Brauner [Sat, 30 Jan 2021 11:17:08 +0000 (12:17 +0100)]
log: add lxc_log_trace() helper

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: use bpf log when logging at trace level
Christian Brauner [Sat, 30 Jan 2021 11:15:31 +0000 (12:15 +0100)]
cgroups: use bpf log when logging at trace level

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoseccomp: use lxc_log_get_level()
Christian Brauner [Sat, 30 Jan 2021 11:10:21 +0000 (12:10 +0100)]
seccomp: use lxc_log_get_level()

This will now enable LXD users to dump the seccomp filter in the log when
logging at TRACE level.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolog: rework lxc_log_get_level()
Christian Brauner [Sat, 30 Jan 2021 11:10:09 +0000 (12:10 +0100)]
log: rework lxc_log_get_level()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: use cleanup macro for consistency
Christian Brauner [Sat, 30 Jan 2021 11:00:28 +0000 (12:00 +0100)]
cgroups: use cleanup macro for consistency

and to prevent future mishaps.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: vet parameters more strictly
Christian Brauner [Sat, 30 Jan 2021 10:25:45 +0000 (11:25 +0100)]
cgroups: vet parameters more strictly

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoseccomp: use lxc_log_get_fd()
Christian Brauner [Sat, 30 Jan 2021 10:09:45 +0000 (11:09 +0100)]
seccomp: use lxc_log_get_fd()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolog: add lxc_log_get_fd()
Christian Brauner [Sat, 30 Jan 2021 10:07:43 +0000 (11:07 +0100)]
log: add lxc_log_get_fd()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolog: remove pointless inline
Christian Brauner [Sat, 30 Jan 2021 10:02:10 +0000 (11:02 +0100)]
log: remove pointless inline

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: tweak cgroup initialization
Christian Brauner [Sat, 30 Jan 2021 01:14:00 +0000 (02:14 +0100)]
cgroups: tweak cgroup initialization

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: use zalloc
Christian Brauner [Sat, 30 Jan 2021 01:07:36 +0000 (02:07 +0100)]
cgroups: use zalloc

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: ensure all memory is zeroed
Christian Brauner [Sat, 30 Jan 2021 01:07:21 +0000 (02:07 +0100)]
cgroups: ensure all memory is zeroed

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: don't initiliaze NULL log
Christian Brauner [Sat, 30 Jan 2021 01:07:00 +0000 (02:07 +0100)]
cgroups: don't initiliaze NULL log

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: coding style fixes
Christian Brauner [Sat, 30 Jan 2021 00:10:49 +0000 (01:10 +0100)]
cgroups: coding style fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocroups: improve __do_bpf_program_free
Christian Brauner [Fri, 29 Jan 2021 23:55:19 +0000 (00:55 +0100)]
croups: improve __do_bpf_program_free

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agocgroups: bpf fixes
Christian Brauner [Fri, 29 Jan 2021 23:17:14 +0000 (00:17 +0100)]
cgroups: bpf fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3638 from brauner/2021-01-28/fixes
Stéphane Graber [Sat, 30 Jan 2021 00:58:40 +0000 (19:58 -0500)]
Merge pull request #3638 from brauner/2021-01-28/fixes

attach: improve attach codepaths

3 years agoattach: init file descriptors to -EBADF
Christian Brauner [Fri, 29 Jan 2021 15:36:52 +0000 (16:36 +0100)]
attach: init file descriptors to -EBADF

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move to file descriptor only namespace interactions
Christian Brauner [Fri, 29 Jan 2021 14:13:51 +0000 (15:13 +0100)]
attach: move to file descriptor only namespace interactions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move to file descriptor-only interactions
Christian Brauner [Fri, 29 Jan 2021 13:52:21 +0000 (14:52 +0100)]
attach: move to file descriptor-only interactions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: rework attaching to namespace fds
Christian Brauner [Fri, 29 Jan 2021 13:32:17 +0000 (14:32 +0100)]
attach: rework attaching to namespace fds

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: remove unneeded assignment
Christian Brauner [Fri, 29 Jan 2021 13:27:07 +0000 (14:27 +0100)]
attach: remove unneeded assignment

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use STDIN_FILENO instead of hard-coding 0
Christian Brauner [Fri, 29 Jan 2021 13:26:15 +0000 (14:26 +0100)]
attach: use STDIN_FILENO instead of hard-coding 0

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move new_cwd into tighter scope
Christian Brauner [Fri, 29 Jan 2021 13:24:31 +0000 (14:24 +0100)]
attach: move new_cwd into tighter scope

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use dummy macros to make it easier to follow sync logic
Christian Brauner [Fri, 29 Jan 2021 13:13:37 +0000 (14:13 +0100)]
attach: use dummy macros to make it easier to follow sync logic

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: introduce sync_wait_fd() and sync_wake_fd()
Christian Brauner [Fri, 29 Jan 2021 13:06:53 +0000 (14:06 +0100)]
attach: introduce sync_wait_fd() and sync_wake_fd()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agosync: make all sync helpers return bool
Christian Brauner [Fri, 29 Jan 2021 13:01:59 +0000 (14:01 +0100)]
sync: make all sync helpers return bool

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: introduce sync_wait_pid() and sync_wake_pid()
Christian Brauner [Fri, 29 Jan 2021 12:51:45 +0000 (13:51 +0100)]
attach: introduce sync_wait_pid() and sync_wake_pid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use sync_wait()/sync_wake() where applicable
Christian Brauner [Fri, 29 Jan 2021 12:42:47 +0000 (13:42 +0100)]
attach: use sync_wait()/sync_wake() where applicable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agosync: rename startup synchronization macros
Christian Brauner [Fri, 29 Jan 2021 12:31:57 +0000 (13:31 +0100)]
sync: rename startup synchronization macros

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agosync: export sync_wait() and sync_wake()
Christian Brauner [Fri, 29 Jan 2021 12:28:23 +0000 (13:28 +0100)]
sync: export sync_wait() and sync_wake()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: coding style fixes
Christian Brauner [Fri, 29 Jan 2021 12:19:35 +0000 (13:19 +0100)]
attach: coding style fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: rename attach_clone_payload to attach_payload
Christian Brauner [Fri, 29 Jan 2021 12:15:47 +0000 (13:15 +0100)]
attach: rename attach_clone_payload to attach_payload

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move attach_clone_payload into tighter scope
Christian Brauner [Fri, 29 Jan 2021 12:14:37 +0000 (13:14 +0100)]
attach: move attach_clone_payload into tighter scope

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/close/close_prot_errno_disarm/g
Christian Brauner [Fri, 29 Jan 2021 12:10:14 +0000 (13:10 +0100)]
attach: s/close/close_prot_errno_disarm/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoconfigure: fix static builds with clang-12 and LTO
Christian Brauner [Fri, 29 Jan 2021 12:04:58 +0000 (13:04 +0100)]
configure: fix static builds with clang-12 and LTO

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move getcwd() into tighter scope
Christian Brauner [Fri, 29 Jan 2021 10:43:23 +0000 (11:43 +0100)]
attach: move getcwd() into tighter scope

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: remove obsolete namespace check
Christian Brauner [Fri, 29 Jan 2021 10:39:26 +0000 (11:39 +0100)]
attach: remove obsolete namespace check

We're not going to support kernel without namespaces anyway.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: fix personality handling
Christian Brauner [Fri, 29 Jan 2021 10:31:53 +0000 (11:31 +0100)]
attach: fix personality handling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agolsm: s/lsm_init/lsm_init_static/g
Christian Brauner [Thu, 28 Jan 2021 18:19:32 +0000 (19:19 +0100)]
lsm: s/lsm_init/lsm_init_static/g

Make it clear that there is nothing to free here.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/lxc_attach_drop_privs/drop_capabilities/g
Christian Brauner [Thu, 28 Jan 2021 18:13:32 +0000 (19:13 +0100)]
attach: s/lxc_attach_drop_privs/drop_capabilities/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/lxc_proc_close_ns_fd/close_nsfds/g
Christian Brauner [Thu, 28 Jan 2021 18:11:23 +0000 (19:11 +0100)]
attach: s/lxc_proc_close_ns_fd/close_nsfds/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: add get_attach_context_nsfds()
Christian Brauner [Thu, 28 Jan 2021 18:08:17 +0000 (19:08 +0100)]
attach: add get_attach_context_nsfds()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move config init into get_attach_context()
Christian Brauner [Thu, 28 Jan 2021 17:59:55 +0000 (18:59 +0100)]
attach: move config init into get_attach_context()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move get_personality() into get_attach_context()
Christian Brauner [Thu, 28 Jan 2021 17:55:17 +0000 (18:55 +0100)]
attach: move get_personality() into get_attach_context()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move lxc_cmd_get_init_pid() int get_attach_context()
Christian Brauner [Thu, 28 Jan 2021 17:48:24 +0000 (18:48 +0100)]
attach: move lxc_cmd_get_init_pid() int get_attach_context()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: split attach_context into allocation and initialization
Christian Brauner [Thu, 28 Jan 2021 17:28:14 +0000 (18:28 +0100)]
attach: split attach_context into allocation and initialization

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/calloc/zalloc/g
Christian Brauner [Thu, 28 Jan 2021 17:13:54 +0000 (18:13 +0100)]
attach: s/calloc/zalloc/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: rename attach_context helpers
Christian Brauner [Thu, 28 Jan 2021 17:05:57 +0000 (18:05 +0100)]
attach: rename attach_context helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/lxc_proc_context_info/attach_context/g
Christian Brauner [Thu, 28 Jan 2021 17:04:23 +0000 (18:04 +0100)]
attach: s/lxc_proc_context_info/attach_context/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: move lxc_proc_context_info to file local scope
Christian Brauner [Thu, 28 Jan 2021 16:55:44 +0000 (17:55 +0100)]
attach: move lxc_proc_context_info to file local scope

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: order variables correctly
Christian Brauner [Thu, 28 Jan 2021 16:53:44 +0000 (17:53 +0100)]
attach: order variables correctly

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: coding style fixes
Christian Brauner [Thu, 28 Jan 2021 16:34:29 +0000 (17:34 +0100)]
attach: coding style fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3637 from brauner/2021-01-27/fixes
Stéphane Graber [Thu, 28 Jan 2021 01:10:55 +0000 (20:10 -0500)]
Merge pull request #3637 from brauner/2021-01-27/fixes

attach: fixes

3 years agoattach: add some DEBUG() logging to stdfd dpulication
Christian Brauner [Wed, 27 Jan 2021 19:55:02 +0000 (20:55 +0100)]
attach: add some DEBUG() logging to stdfd dpulication

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use close_prot_errno_disarm()
Christian Brauner [Wed, 27 Jan 2021 19:52:08 +0000 (20:52 +0100)]
attach: use close_prot_errno_disarm()

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: make do_attach() void
Christian Brauner [Wed, 27 Jan 2021 19:51:20 +0000 (20:51 +0100)]
attach: make do_attach() void

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: mark do_attach() as __noreturn
Christian Brauner [Wed, 27 Jan 2021 19:48:41 +0000 (20:48 +0100)]
attach: mark do_attach() as __noreturn

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: s/attach_child_main/do_attach/g
Christian Brauner [Wed, 27 Jan 2021 19:47:46 +0000 (20:47 +0100)]
attach: s/attach_child_main/do_attach/g

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use free_disarm()
Christian Brauner [Wed, 27 Jan 2021 19:42:21 +0000 (20:42 +0100)]
attach: use free_disarm()

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: coding style fixes
Christian Brauner [Wed, 27 Jan 2021 19:39:35 +0000 (20:39 +0100)]
attach: coding style fixes

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use __do_close for labelfd
Christian Brauner [Wed, 27 Jan 2021 19:37:42 +0000 (20:37 +0100)]
attach: use __do_close for labelfd

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: tweak logging
Christian Brauner [Wed, 27 Jan 2021 19:35:06 +0000 (20:35 +0100)]
attach: tweak logging

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: use __do_free cleanup macro for cwd
Christian Brauner [Wed, 27 Jan 2021 19:28:35 +0000 (20:28 +0100)]
attach: use __do_free cleanup macro for cwd

but still yield memory immediately once we're done with it to not have it lying
around while the parent process is around.

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoattach: invert child/parent handling
Christian Brauner [Wed, 27 Jan 2021 19:24:57 +0000 (20:24 +0100)]
attach: invert child/parent handling

This makes it more consistent with th rest of the shared library.

Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
3 years agoMerge pull request #3636 from brauner/2021-01-27/fixes
Stéphane Graber [Wed, 27 Jan 2021 16:34:01 +0000 (11:34 -0500)]
Merge pull request #3636 from brauner/2021-01-27/fixes

conf: proc and sys mountpoint creation fixes