Fix up patch to actually apply

This commit is contained in:
Richard Hughes 2023-07-19 15:47:15 +01:00
parent 744bd63762
commit bdde047c9f

View File

@ -2,7 +2,7 @@ diff --git a/glib/gspawn.c b/glib/gspawn.c
index 67be6a6af..aaefd5b0d 100644 index 67be6a6af..aaefd5b0d 100644
--- a/glib/gspawn.c --- a/glib/gspawn.c
+++ b/glib/gspawn.c +++ b/glib/gspawn.c
@@ -1533,9 +1533,18 @@ safe_fdwalk_set_cloexec (int lowfd) @@ -1598,9 +1598,18 @@ safe_fdwalk_set_cloexec (int lowfd)
* *
* Handle ENOSYS in case its supported in libc but not the kernel; if so, * Handle ENOSYS in case its supported in libc but not the kernel; if so,
* fall back to safe_fdwalk(). Handle EINVAL in case `CLOSE_RANGE_CLOEXEC` * fall back to safe_fdwalk(). Handle EINVAL in case `CLOSE_RANGE_CLOEXEC`
@ -17,13 +17,13 @@ index 67be6a6af..aaefd5b0d 100644
+ * - https://salsa.debian.org/debian/libseccomp/-/blob/debian/bullseye/debian/patches/syscalls_add_close_range_syscall.patch + * - https://salsa.debian.org/debian/libseccomp/-/blob/debian/bullseye/debian/patches/syscalls_add_close_range_syscall.patch
+ * - https://github.com/opencontainers/runc/issues/2151 + * - https://github.com/opencontainers/runc/issues/2151
+ */ + */
int ret = close_range (lowfd, G_MAXUINT, CLOSE_RANGE_CLOEXEC); ret = close_range (lowfd, G_MAXUINT, CLOSE_RANGE_CLOEXEC);
- if (ret == 0 || !(errno == ENOSYS || errno == EINVAL)) - if (ret == 0 || !(errno == ENOSYS || errno == EINVAL))
+ if (ret == 0 || !(errno == ENOSYS || errno == EINVAL || errno == EPERM)) + if (ret == 0 || !(errno == ENOSYS || errno == EINVAL || errno == EPERM))
return ret; return ret;
#endif /* HAVE_CLOSE_RANGE */ #endif /* HAVE_CLOSE_RANGE */
return safe_fdwalk (set_cloexec, GINT_TO_POINTER (lowfd));
@@ -1586,9 +1595,15 @@ safe_closefrom (int lowfd) @@ -1624,9 +1633,15 @@ safe_closefrom (int lowfd)
* situations: https://bugs.python.org/issue38061 * situations: https://bugs.python.org/issue38061
* *
* Handle ENOSYS in case its supported in libc but not the kernel; if so, * Handle ENOSYS in case its supported in libc but not the kernel; if so,
@ -35,9 +35,9 @@ index 67be6a6af..aaefd5b0d 100644
+ * to it under a default security policy which returns EPERM rather than (the + * to it under a default security policy which returns EPERM rather than (the
+ * correct) ENOSYS. + * correct) ENOSYS.
+ */ + */
int ret = close_range (lowfd, G_MAXUINT, 0); ret = close_range (lowfd, G_MAXUINT, 0);
- if (ret == 0 || errno != ENOSYS) - if (ret == 0 || errno != ENOSYS)
+ if (ret == 0 || !(errno == ENOSYS || errno == EPERM)) + if (ret == 0 || errno != ENOSYS || errno == EPERM)
return ret; return ret;
#endif /* HAVE_CLOSE_RANGE */ #endif /* HAVE_CLOSE_RANGE */
return safe_fdwalk (close_func, GINT_TO_POINTER (lowfd));