[lxc-devel] [lxc/master] handle kernel version <--> header incompatibility
brauner on Github
lxc-bot at linuxcontainers.org
Thu Jan 9 12:28:06 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200109/6fdfd5b8/attachment.bin>
-------------- next part --------------
From 1126d14815697d414a277847d38bc2af92bd4d79 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Jan 2020 12:28:19 +0100
Subject: [PATCH 1/3] mainloop: add missing \n
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/mainloop.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/mainloop.c b/src/lxc/mainloop.c
index 3a31ed7b1b..2ef5a93e6b 100644
--- a/src/lxc/mainloop.c
+++ b/src/lxc/mainloop.c
@@ -65,6 +65,7 @@ int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
struct epoll_event ev;
struct mainloop_handler *handler;
struct lxc_list *item;
+
if (fd < 0)
return -1;
From 38bbeb799e33130932ff3d20f57ab060c184675a Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Jan 2020 12:28:54 +0100
Subject: [PATCH 2/3] tests: timeout after 60 seconds
That should be more than enough to reboot.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/tests/api_reboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tests/api_reboot.c b/src/tests/api_reboot.c
index 730d6a81a5..f6864e8777 100644
--- a/src/tests/api_reboot.c
+++ b/src/tests/api_reboot.c
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
*/
sleep(5);
- if (!c->reboot2(c, -1)) {
+ if (!c->reboot2(c, 60)) {
lxc_error("%s\n", "Failed to reboot container \"reboot\"");
goto on_error_stop;
}
From c718fac1855da04d221bf7055c981efeb6a323bc Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Jan 2020 12:25:30 +0100
Subject: [PATCH 3/3] 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 at ubuntu.com>
---
src/lxc/start.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index f085aa60d0..9ca85911ce 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1091,11 +1091,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
lxc_set_state(name, handler, ABORTING);
- if (handler->pidfd >= 0)
+ if (handler->pidfd >= 0) {
ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0);
- else if (handler->pid > 0)
- ret = kill(handler->pid, SIGKILL);
- if (ret < 0)
+ if (ret)
+ SYSWARN("Failed to send SIGKILL via pidfd %d for process %d", handler->pidfd, handler->pid);
+ }
+
+ if (ret && (errno != ESRCH) && kill(handler->pid, SIGKILL))
SYSERROR("Failed to send SIGKILL to %d", handler->pid);
do {
More information about the lxc-devel
mailing list