From 89ee633515960c58b52cd7bb8099ea9a10033459 Mon Sep 17 00:00:00 2001 From: zhangxingrong Date: Wed, 31 Jul 2024 18:51:40 +0800 Subject: [PATCH] add some upstream patchs --- ...io_uring-on-hppa-below-kernel-6.1.51.patch | 33 +++++++++++++++++++ ...isable-io_uring-on-ppc64-and-ppc64le.patch | 28 ++++++++++++++++ libuv.spec | 9 ++++- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 backport-disable-io_uring-on-hppa-below-kernel-6.1.51.patch create mode 100644 backport-disable-io_uring-on-ppc64-and-ppc64le.patch diff --git a/backport-disable-io_uring-on-hppa-below-kernel-6.1.51.patch b/backport-disable-io_uring-on-hppa-below-kernel-6.1.51.patch new file mode 100644 index 0000000..b4d7f92 --- /dev/null +++ b/backport-disable-io_uring-on-hppa-below-kernel-6.1.51.patch @@ -0,0 +1,33 @@ +From 04ccefeb2af36f6da69443d7743575d24c3185d1 Mon Sep 17 00:00:00 2001 +From: matoro +Date: Wed, 15 Nov 2023 16:38:43 -0500 +Subject: [PATCH] linux: disable io_uring on hppa below kernel 6.1.51 + +First kernel with support is 6.1, was only fully functional from .51 +onwards: https://lore.kernel.org/all/cb912694-b1fe-dbb0-4d8c-d608f3526905@gmx.de/ +--- + src/unix/linux.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/unix/linux.c b/src/unix/linux.c +index 8eeb352e623..91409bb5781 100644 +--- a/src/unix/linux.c ++++ b/src/unix/linux.c +@@ -487,8 +487,16 @@ static int uv__use_io_uring(void) { + use = atomic_load_explicit(&use_io_uring, memory_order_relaxed); + + if (use == 0) { ++ use = uv__kernel_version() >= ++#if defined(__hppa__) ++ /* io_uring first supported on parisc in 6.1, functional in .51 */ ++ /* https://lore.kernel.org/all/cb912694-b1fe-dbb0-4d8c-d608f3526905@gmx.de/ */ ++ /* 6.1.51 */ 0x060133 ++#else + /* Older kernels have a bug where the sqpoll thread uses 100% CPU. */ +- use = uv__kernel_version() >= /* 5.10.186 */ 0x050ABA ? 1 : -1; ++ /* 5.10.186 */ 0x050ABA ++#endif ++ ? 1 : -1; + + /* But users can still enable it if they so desire. */ + val = getenv("UV_USE_IO_URING"); diff --git a/backport-disable-io_uring-on-ppc64-and-ppc64le.patch b/backport-disable-io_uring-on-ppc64-and-ppc64le.patch new file mode 100644 index 0000000..e7d46bb --- /dev/null +++ b/backport-disable-io_uring-on-ppc64-and-ppc64le.patch @@ -0,0 +1,28 @@ +From 08f4fb449048e22be034b26fa41fb0723189f2b8 Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Fri, 12 Jan 2024 15:02:22 -0500 +Subject: [PATCH] linux: disable io_uring on ppc64 and ppc64le + +Since `io_uring` support was added, libuv's signal handler randomly +segfaults on ppc64 when interrupting `epoll_pwait`. Disable it +pending further investigation. + +Issue: https://github.com/libuv/libuv/issues/4283 +--- + src/unix/linux.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/unix/linux.c b/src/unix/linux.c +index 3c1313e7efc..4164e90dbb0 100644 +--- a/src/unix/linux.c ++++ b/src/unix/linux.c +@@ -463,6 +463,9 @@ static int uv__use_io_uring(void) { + #elif defined(__arm__) && __SIZEOF_POINTER__ == 4 + /* See https://github.com/libuv/libuv/issues/4158. */ + return 0; /* All 32 bits kernels appear buggy. */ ++#elif defined(__powerpc64__) || defined(__ppc64__) ++ /* See https://github.com/libuv/libuv/issues/4283. */ ++ return 0; /* Random SIGSEGV in signal handler. */ + #else + /* Ternary: unknown=0, yes=1, no=-1 */ + static _Atomic int use_io_uring; diff --git a/libuv.spec b/libuv.spec index a786aea..1c2d956 100644 --- a/libuv.spec +++ b/libuv.spec @@ -1,7 +1,7 @@ Name: libuv Epoch: 1 Version: 1.47.0 -Release: 2 +Release: 3 Summary: A multi-platform support library with a focus on asynchronous I/O # from README.md @@ -27,6 +27,9 @@ Patch6000: backport-0001-CVE-2024-24806.patch Patch6001: backport-0002-CVE-2024-24806.patch Patch6002: backport-0003-CVE-2024-24806.patch +Patch6003: backport-disable-io_uring-on-ppc64-and-ppc64le.patch +Patch6004: backport-disable-io_uring-on-hppa-below-kernel-6.1.51.patch + BuildRequires: autoconf automake libtool gcc make %description @@ -81,6 +84,10 @@ make check %doc ChangeLog %changelog +* Wed Jul 31 2024 zhangxingrong - 1:1.47.0-3 +- linux: disable io_uring on ppc64 and ppc64le +- linux: disable io_uring on hppa below kernel 6.1.51 + * Sun Feb 18 2024 shixuantong - 1:1.47.0-2 - fix CVE-2024-24806 -- Gitee