Skip to content

Commit

Permalink
src: remove uv__node_patch_is_using_io_uring
Browse files Browse the repository at this point in the history
As now the `SQPOLL` ring used in the libuv io_uring implementation is
disabled by default.
Also modify `UvMightBeUsingIoUring()` to just handle the case where
`Node.js` is dynamically linked to a `libuv` version which has the
`SQPOLL` ring enabled.

PR-URL: #55114
Refs: https://github.com/libuv/libuv/releases/tag/v1.49.0
Refs: https://github.com/libuv/libuv/releases/tag/v1.49.1
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
santigimeno authored and nodejs-github-bot committed Oct 14, 2024
1 parent d6175b3 commit f97865f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 66 deletions.
28 changes: 5 additions & 23 deletions src/node_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,31 +228,13 @@ static gid_t gid_by_name(Isolate* isolate, Local<Value> value) {
}
}

#ifdef __linux__
extern "C" {
int uv__node_patch_is_using_io_uring(void);

int uv__node_patch_is_using_io_uring(void) __attribute__((weak));

typedef int (*is_using_io_uring_fn)(void);
}
#endif // __linux__

static bool UvMightBeUsingIoUring() {
#ifdef __linux__
// Support for io_uring is only included in libuv 1.45.0 and later, and only
// on Linux (and Android, but there it is always disabled). The patch that we
// apply to libuv to work around the io_uring security issue adds a function
// that tells us whether io_uring is being used. If that function is not
// present, we assume that we are dynamically linking against an unpatched
// version.
static std::atomic<is_using_io_uring_fn> check =
uv__node_patch_is_using_io_uring;
if (check == nullptr) {
check = reinterpret_cast<is_using_io_uring_fn>(
dlsym(RTLD_DEFAULT, "uv__node_patch_is_using_io_uring"));
}
return uv_version() >= 0x012d00u && (check == nullptr || (*check)());
// Support for io_uring is only included in libuv 1.45.0 and later. Starting
// with 1.49.0 is disabled by default. Check the version in case Node.js is
// dynamically to an io_uring-enabled version of libuv.
unsigned int version = uv_version();
return version >= 0x012d00u && version < 0x013100u;
#else
return false;
#endif
Expand Down
43 changes: 0 additions & 43 deletions test/parallel/test-process-setuid-io-uring.js

This file was deleted.

0 comments on commit f97865f

Please sign in to comment.