Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-containers/crun/files/, app-containers/crun/
Date: Wed, 03 Aug 2022 18:21:42
Message-Id: 1659550884.28853d92c3d8bbcaa2cf6988b63892d80ec131ee.sam@gentoo
1 commit: 28853d92c3d8bbcaa2cf6988b63892d80ec131ee
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 3 18:12:24 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 3 18:21:24 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28853d92
7
8 app-containers/crun: fix build w/ glibc 2.36
9
10 Closes: https://bugs.gentoo.org/863437
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 app-containers/crun/crun-1.4.5.ebuild | 13 +++-
14 .../crun/files/crun-1.4.5-glibc-2.36.patch | 79 ++++++++++++++++++++++
15 2 files changed, 91 insertions(+), 1 deletion(-)
16
17 diff --git a/app-containers/crun/crun-1.4.5.ebuild b/app-containers/crun/crun-1.4.5.ebuild
18 index 7beee3b50821..1cc9dd0d9d26 100644
19 --- a/app-containers/crun/crun-1.4.5.ebuild
20 +++ b/app-containers/crun/crun-1.4.5.ebuild
21 @@ -5,7 +5,8 @@ EAPI=8
22
23 PYTHON_COMPAT=( python3_{8..10} )
24
25 -inherit python-any-r1
26 +# Can drop autotools/eautoreconf after next release & glibc patch gone
27 +inherit autotools python-any-r1
28
29 DESCRIPTION="A fast and low-memory footprint OCI Container Runtime fully written in C"
30 HOMEPAGE="https://github.com/containers/crun"
31 @@ -36,6 +37,16 @@ BDEPEND="
32 # required to create linux "containers".
33 RESTRICT="test"
34
35 +PATCHES=(
36 + "${FILESDIR}"/${PN}-1.4.5-glibc-2.36.patch
37 +)
38 +
39 +src_prepare() {
40 + default
41 +
42 + eautoreconf
43 +}
44 +
45 src_configure() {
46 local myeconfargs=(
47 $(use_enable bpf)
48
49 diff --git a/app-containers/crun/files/crun-1.4.5-glibc-2.36.patch b/app-containers/crun/files/crun-1.4.5-glibc-2.36.patch
50 new file mode 100644
51 index 000000000000..12990c9dbe65
52 --- /dev/null
53 +++ b/app-containers/crun/files/crun-1.4.5-glibc-2.36.patch
54 @@ -0,0 +1,79 @@
55 +https://bugs.gentoo.org/863437
56 +https://github.com/containers/crun/commit/3df14584b84414df77b2079c1b8b48d44d0ceb61
57 +
58 +From 3df14584b84414df77b2079c1b8b48d44d0ceb61 Mon Sep 17 00:00:00 2001
59 +From: Giuseppe Scrivano <gscrivan@××××××.com>
60 +Date: Tue, 26 Jul 2022 15:17:16 +0200
61 +Subject: [PATCH] linux: fix build with glibc 2.36
62 +
63 +glibc 2.36 has the new mount API in the <sys/mount.h> file. These
64 +definitions conflict with the definitions in the <linux/mount.h>
65 +file.
66 +
67 +Add a check and include <linux/mount.h> only if it doesn't conflict
68 +with <sys/mount.h>.
69 +
70 +Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2110738
71 +
72 +Signed-off-by: Giuseppe Scrivano <gscrivan@××××××.com>
73 +--- a/configure.ac
74 ++++ b/configure.ac
75 +@@ -174,11 +174,21 @@ LIBS=""
76 + AC_MSG_CHECKING([for new mount API (fsconfig)])
77 + AC_COMPILE_IFELSE(
78 + [AC_LANG_SOURCE([[
79 ++ #include <sys/mount.h>
80 ++ int cmd = FSCONFIG_CMD_CREATE;
81 ++ ]])],
82 ++ [AC_MSG_RESULT(yes)
83 ++ AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in sys/mount.h])],
84 ++ [AC_MSG_RESULT(no)])
85 ++AC_COMPILE_IFELSE(
86 ++ [AC_LANG_SOURCE([[
87 ++ /* also make sure it doesn't conflict with <sys/mount.h> since it is always used. */
88 ++ #include <sys/mount.h>
89 + #include <linux/mount.h>
90 + int cmd = FSCONFIG_CMD_CREATE;
91 + ]])],
92 + [AC_MSG_RESULT(yes)
93 +- AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE], 1, [Define if FSCONFIG_CMD_CREATE is available])],
94 ++ AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in linux/mount.h])],
95 + [AC_MSG_RESULT(no)])
96 +
97 + AC_MSG_CHECKING([for seccomp notify API])
98 +--- a/src/libcrun/linux.c
99 ++++ b/src/libcrun/linux.c
100 +@@ -26,9 +26,13 @@
101 + #include <fcntl.h>
102 + #include <unistd.h>
103 + #include <sys/mount.h>
104 +-#ifdef HAVE_FSCONFIG_CMD_CREATE
105 ++#ifdef HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H
106 + # include <linux/mount.h>
107 + #endif
108 ++#if defined HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H || defined HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H
109 ++# define HAVE_NEW_MOUNT_API
110 ++#endif
111 ++
112 + #include <sys/syscall.h>
113 + #include <sys/prctl.h>
114 + #ifdef HAVE_CAP
115 +@@ -990,7 +994,7 @@ open_mount_target (libcrun_container_t *container, const char *target_rel, libcr
116 + static int
117 + fsopen_mount (runtime_spec_schema_defs_mount *mount)
118 + {
119 +-#ifdef HAVE_FSCONFIG_CMD_CREATE
120 ++#ifdef HAVE_NEW_MOUNT_API
121 + cleanup_close int fsfd = -1;
122 + int ret;
123 +
124 +@@ -1016,7 +1020,7 @@ fsopen_mount (runtime_spec_schema_defs_mount *mount)
125 + static int
126 + fs_move_mount_to (int fd, int dirfd, const char *name)
127 + {
128 +-#ifdef HAVE_FSCONFIG_CMD_CREATE
129 ++#ifdef HAVE_NEW_MOUNT_API
130 + if (name)
131 + return syscall_move_mount (fd, "", dirfd, name, MOVE_MOUNT_F_EMPTY_PATH);
132 +
133 +