f36094bfb4
- Add backport for <https://github.com/lxc/lxd/pull/8908> which fixes a Leap-specific kernel backport bug (close_range(2) was backported but not the flags that it supported in the first version). boo#1186786 + boo1186786-0001-forkexec-handle-broken-close_range-backport-in-openS.patch OBS-URL: https://build.opensuse.org/request/show/902315 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=97
34 lines
1.3 KiB
Diff
34 lines
1.3 KiB
Diff
From a0c04ef1b99c94edb50084825365c2bab8dadb7c Mon Sep 17 00:00:00 2001
|
|
From: Christian Brauner <christian.brauner@ubuntu.com>
|
|
Date: Thu, 17 Jun 2021 12:45:25 +0200
|
|
Subject: [PATCH] forkexec: handle broken close_range() backport in openSUSE
|
|
Leap 15.3
|
|
|
|
Fixes: https://discuss.linuxcontainers.org/t/lxc-exec-results-in-error-failed-to-retrieve-pid-of-executing-child-process
|
|
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
|
|
---
|
|
lxd/main_forkexec.go | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lxd/main_forkexec.go b/lxd/main_forkexec.go
|
|
index 7cc5e8d7130c..574f25eeb988 100644
|
|
--- a/lxd/main_forkexec.go
|
|
+++ b/lxd/main_forkexec.go
|
|
@@ -292,7 +292,12 @@ __attribute__ ((noinline)) static int __forkexec(void)
|
|
|
|
ret = close_range(EXEC_PIPE_FD + 1, UINT_MAX, CLOSE_RANGE_UNSHARE);
|
|
if (ret) {
|
|
- if (errno == ENOSYS)
|
|
+ // Fallback to close_inherited() when the syscall is not
|
|
+ // available or when CLOSE_RANGE_UNSHARE isn't supported.
|
|
+ // On a regular kernel CLOSE_RANGE_UNSHARE should always be
|
|
+ // available but openSUSE Leap 15.3 seems to have a partial
|
|
+ // backport without CLOSE_RANGE_UNSHARE support.
|
|
+ if (errno == ENOSYS || errno == EINVAL)
|
|
ret = close_inherited(fds_to_ignore, ARRAY_SIZE(fds_to_ignore));
|
|
}
|
|
if (ret)
|
|
--
|
|
2.32.0
|
|
|