lxc-attach always returns 0 as success if child process has terminated by signal for jammy

Bug #2073080 reported by Leesoo Ahn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
New
Undecided
Unassigned

Bug Description

lxc 5.0.0 has a critical issue that 'lxc-attach' always returns 0 representing of success if a process running by 'lxc-attach' has been terminated by all sort of signals. but we are expecting it is on failure.

As the following logs, although it got SIGHUP, but lxc-attach returns 0.
---------------------------------------
[pid 161677] --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=0, si_uid=0} ---
[pid 161675] <... epoll_wait resumed>[{events=EPOLLHUP, data={u32=537443984, u64=94773285797520}}], 10, -1) = 1
[pid 161675] read(6, <unfinished ...>
[pid 161677] +++ killed by SIGHUP +++
<... read resumed>0x7ffe320eb4e0, 1024) = -1 EIO (Input/output error)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=161677, si_uid=0, si_status=SIGHUP, si_utime=0, si_stime=3} ---
close(3) = 0
ioctl(9, TCGETS, {B38400 opost -isig -icanon -echo ...}) = 0
ioctl(9, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon echo ...}) = 0
ioctl(9, TCGETS, {B38400 opost isig icanon echo ...}) = 0
close(9) = 0
close(6) = 0
close(10) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(161677, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGHUP}], 0, NULL) = 161677
exit_group(0) = ?
+++ exited with 0 +++
---------------------------------------

Approach
- update the package to lxc 5.0.2 which the bug has fixed[1] already.
- manually make a patch and apply it to the current package.

I recommend to update the package to lxc 5.0.2.

[1]: https://github.com/lxc/lxc/commit/011faff362e0e7c1c86121937f284ac8c64aba9f

Leesoo Ahn (lsahn)
summary: - lxc 5.0.0 couldn't catch exitcode if terminated by signal for jammy
+ lxc-attach always returns 0 as success if child process has terminated
+ by signal for jammy
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.