Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CentOS 7 Build by Checking if FSOPEN_CLOEXEC exists #1299

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AC_CHECK_HEADERS([error.h linux/openat2.h stdatomic.h linux/ioprio.h])
AC_CHECK_TYPES([atomic_int], [], [], [[#include <stdatomic.h>]])
AC_CHECK_TYPES([atomic_bool], [], [], [[#include <stdatomic.h>]])

AC_CHECK_FUNCS(copy_file_range fgetxattr statx fgetpwent_r issetugid)
AC_CHECK_FUNCS(copy_file_range fgetxattr statx fgetpwent_r issetugid memfd_create)

AC_ARG_ENABLE(crun,
AS_HELP_STRING([--enable-crun], [Include crun executable in installation (default: yes)]),
Expand Down
12 changes: 12 additions & 0 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@
# define MOVE_MOUNT_T_EMPTY_PATH 0x00000040
#endif

#ifndef FSOPEN_CLOEXEC
# define FSOPEN_CLOEXEC 0x00000001
#endif

#ifndef FSMOUNT_CLOEXEC
# define FSMOUNT_CLOEXEC 0x00000001
#endif

#ifndef FSCONFIG_CMD_CREATE
# define FSCONFIG_CMD_CREATE 6
#endif

struct remount_s
{
struct remount_s *next;
Expand Down
4 changes: 4 additions & 0 deletions src/libcrun/seccomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,13 @@ libcrun_apply_seccomp (int infd, int listener_receiver_fd, const char *receiver_
return crun_make_error (err, 0, "the `SECCOMP_FILTER_FLAG_NEW_LISTENER` flag is not supported");
# endif

# ifdef HAVE_MEMFD_CREATE
memfd = memfd_create ("seccomp-helper-memfd", O_RDWR);
if (UNLIKELY (memfd < 0))
return crun_make_error (err, errno, "memfd_create");
# else
return crun_make_error (err, ENOSYS, "memfd_create non supported");
# endif

ret = ftruncate (memfd, sizeof (atomic_int));
if (UNLIKELY (ret < 0))
Expand Down