Commit Graph

5684 Commits

Author SHA1 Message Date
skooch
38af05eba9
Merge 2681bf09c5 into 44125af62a 2026-03-31 09:18:44 +03:00
Stefan Stojanovic
44125af62a
win: fix watch loop logic (#5013)
Refs: https://github.com/nodejs/node/issues/61398
2026-03-30 22:09:25 -04:00
Jameson Nash
84816e064a
misc: revise security vulnerability reporting instructions
The project has been getting a flood of private vulnerability reports, most of which are invalid, and a few of which should have just been normal bugs. This has essentially been a DoS attack on maintainer time, since we're unable to change them into normal bugs after assessment. We now have a libuv-security@googlegroups.com list instead to help redirect those seeking CVE fame. The hope is to redirect most people to actually use the issue list as it has always been intended to be used.
2026-03-29 15:14:04 +02:00
Saúl Ibarra Corretgé
901e28384b
test: use correct type for uv_fileno arguments (#4673)
Fixes a -Wincompatible-pointer-types error on Windows, since uv_os_fd_t
is not int but HANDLE.
2026-03-25 20:29:59 -04:00
Jameson Nash
40d45efebf
unix: use posix_spawn instead of fork (#3520)
Remove the conditionals so that posix_spawn will be used whenever
possible, and not only on Apple.

Tests specifically if posix_spawn works before using it: it is broken
on QEMU with glibc, for example, since fork/clone is broken there.
2026-03-25 20:21:11 -04:00
Jameson Nash
d19855c702
win: use WSA_FLAG_NO_HANDLE_INHERIT in all WSASocketW (#5097)
Like #4810, but for all socket calls.
2026-03-25 20:17:11 -04:00
Jameson Nash
046aebe79b
win,pipe: skip IOCP for pipe handles (#5071)
Copy the optimization from tcp/udp stack: when read/writes don't require
IOCP to complete, put them directly right into the pending queue, so
they can be processed without a full loop through IOCP each time to
drain them asynchronously.
2026-03-24 10:45:00 -04:00
Jameson Nash
fa0ac9ec0c
io: make libuv 64-bit safe (#5076)
Because libuv truncates the result of every call to INT32_MAX, it needs
to internally limit operations to INT32_MAX to be safe to use libuv.
This isn't an API change, since these operations weren't guaranteed to
work, and in fact usually failed in bizare ways already. This is very
long in coming, since we've had a lot of compiler warnings about this
and several PRs to fix this open for a decade, but the main consumers
that usually fix things didn't care (nodejs is 32-bit and julia patched
this downstream more than a decade ago, though it did run into this
again recently by mistake with sendfile).

Replaces #1501
Fixes #3360
2026-03-24 10:32:27 -04:00
BarryLhm
e3a27e0728
android: fix termux build (#5093)
Fixes: https://github.com/libuv/libuv/issues/5092
2026-03-24 09:59:50 +01:00
Ben Noordhuis
8877568581
unix: enforce recvmmsg buffer size requirements (#5095)
The documentation already stated that the receive buffer should be
a multiple of 64 KiB when the UV_UDP_RECVMMSG is used, but make that
more prominent in the documentation and enforce it in the code.

Refs: https://github.com/libuv/libuv/security/advisories/GHSA-r846-fxvr-f3rx
2026-03-23 21:25:33 +01:00
Jameson Nash
9f0101dcb8
linux: close streams without an extra read (#3250) 2026-03-21 15:10:05 -04:00
Ben Noordhuis
14f6c4cc1f
test: fix -Wunused-function warning (#5090)
The function is only used on BSDs. Introduced in commit 919b92d9 ("unix:
support long path names in pipe.c") from a few days ago.
2026-03-21 13:18:43 +01:00
Ben Noordhuis
1f56978a28
unix: check return value of fcntl call (#5089)
The fcntl cannot fail at this point but let's check the return code
anyway, just in case.

Fixes: https://github.com/libuv/libuv/issues/5080
2026-03-21 13:18:13 +01:00
Jameson Nash
58418d5310
process: better validation for process->pid usage (#3539)
Previously, the user might unknowingly close a uv_process_t before
doing waitpid on the zombie, leaving it forever undead. Track the state
of the child, so that the application wrapper can avoid this by calling
uv_process_kill and checking for UV_ESRCH error.
2026-03-19 15:28:02 -04:00
Ben Noordhuis
1899789be8
doc: remove random reference to libev (#5075)
The document doesn't reference libev anywhere else so it's rather
incongruous to mention it here.

Also add a comma to make the sentence flow better.
2026-03-18 22:53:00 +01:00
Jameson Nash
ea4667b68e
docs: fix broken and redirected links (#5074)
- Replace dead developer.ibm.com AIX article with current IBM Docs URL
- Update IBM Knowledge Centre z/OS URL to new ibm.com/docs location
- Update docs.microsoft.com links to learn.microsoft.com
- Update curl.haxx.se links to curl.se
- Update c-ares.haxx.se to c-ares.org
- Update tools.ietf.org RFC link to datatracker.ietf.org
- Update www.tldp.org links to tldp.org (drop www)
- Update www.nodejs.org and www.rust-lang.org (drop www)
- Upgrade http://docs.libuv.org links to https
- Replace dead kkaefer.com link with GitHub Pages + YouTube video

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:07:44 -04:00
Benjamin Gilbert
fa38eb43df
win: fix some compiler warnings (#5070)
* win: initialize INIT_ONCE field with dedicated initializer
Fixes: abc9767034 ("win: simplify uv_once implementation")
* win: indendation fixes
* win: squash some compiler warnings
2026-03-17 00:19:14 -04:00
Edy Silva
919b92d944
unix: support long path names in pipe.c (#5047)
Continues: #4676
Fixes: #2826
2026-03-16 23:14:47 -04:00
PRANAV KUMAR
048acb509c
doc: fix threading bugs in progress example (#4956)
Fixed race conditions and memory safety issues in the progress example
by using C11 atomic operations for proper thread synchronization.

Changes:
- Changed percentage from double to _Atomic double
- Use atomic_store_explicit() with memory_order_release when writing
- Use atomic_load_explicit() with memory_order_acquire when reading
- Removed unsafe pointer passing via async.data

This ensures proper memory synchronization between the worker thread
and async callback, preventing data races and dangling pointer issues.

Fixes #4386
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-16 22:36:18 -04:00
HArsil
a1f10d9289
docs: add copybutton sphinx extension (#4958) 2026-03-16 22:34:59 -04:00
Juan José
6f096c9d03
darwin: replace EV_OOBAND handling with EVFILT_EXCEPT + NOTE_OOB (#4906)
Fixes: https://github.com/libuv/libuv/issues/3947
Re-lands: https://github.com/libuv/libuv/pull/4597

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2026-03-16 22:23:06 -04:00
Stacey Marshall
f600f7180a
doc: Add textual images into libuv man page (#4709)
Replaces `[image]` tags in libuv manual page with a textual
representation of the graphical image.

In addition added alternative-text for graphical deliverables.

Fixes: https://github.com/libuv/libuv/issues/4708
2026-03-16 21:53:03 -04:00
Juan José
f4363aeb44
test: remove unused headers and use newer ASSERT macros (#4760) 2026-03-16 21:51:03 -04:00
Juan José
fe89c7df39
inet: prefer sizeof with parenthesis (#4789)
This is not precisely a strict rule, but this syntax is reinforced in many
large C projects like the Linux kernel and cURL.

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2026-03-16 21:49:26 -04:00
Gabriel Baraldi
b84a067e0f
unix,tty: don't drain when setting the TTY mode (#4945)
This avoids a blocking syscall (essentially a write)–and thus potential
deadlock–in the asynchronous IO path.
2026-03-16 21:48:50 -04:00
Jameson Nash
651f2fc161
test,win: fix race in test runner (#5066)
Port 143da93e to Windows: replace the 250 ms settle delay with a pipe-
based synchronization mechanism. The parent creates a pipe, passes the
write-end handle to the helper via UV_TEST_RUNNER_FD, then blocks on
ReadFile() until the helper calls notify_parent_process() and closes its
copy of the handle.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 13:04:26 -04:00
cui
40c800e5fc
unix,stream: verify uv_try_write2 handle (#5035)
Looks like this was simply missed in #3183 because it was a bit outside
the review context window.
2026-03-15 10:13:52 -04:00
Jameson Nash
10902ab616
unix: improve handling of uv_async_send mistakes (#5058)
When the user calls uv_async_send concurrently with uv_loop_close, we
try to prevent that data race from actually accessing undefined behavior
by setting the pending flag atomically with the busy flag. This was
proposed in the original PR, but we didn't have motivation to go with
this implementation until a user pointed out that it improves behavior
of the race window in more cases.
2026-03-15 10:00:48 -04:00
Oren
88d6d362f6
udp: validate nbufs in send functions 2026-03-14 12:05:35 +01:00
locus-x64
ec0ab5d77d
win: fix off-by-one in utf-16 to wtf-8 conversion (#5050)
Reserve one byte for the NUL terminator when passing the buffer size
to uv_utf16_to_wtf8() in the TTY line-read path. Without this, when
all input characters encode to exactly 3 UTF-8 bytes (e.g. CJK) and
the buffer size is divisible by 3, the NUL terminator is written one
byte past the allocated buffer.

The other two call sites in src/win/util.c already subtract 1 before
calling uv_utf16_to_wtf8(). This aligns tty.c with that convention.

Fixes commit f3889085 ("win,tty: convert line-read UTF-16 to WTF-8")
from October 2023.

Refs: https://github.com/libuv/libuv/security/advisories/GHSA-4prr-4742-3ccf
2026-03-13 11:59:12 +01:00
skooch
2681bf09c5 unix: squelch futimens() EPERM on CIFS/SMB shares in copyfile
futimens() on CIFS/SMB shares may fail with EPERM because these
filesystems do not support setting arbitrary timestamps. Since
preserving timestamps during copyfile is best-effort, detect the
CIFS/SMB condition using uv__is_cifs_or_smb() and squelch the error,
matching the existing handling for fchmod() in the same function.

Without this fix, uv_fs_copyfile() fails with EPERM when copying
files to CIFS/SMB mounts on Linux (e.g. Alpine containers with
mounted cifs shares).

Fixes: https://github.com/nodejs/node/issues/56248
Refs: https://github.com/libuv/libuv/pull/4396
2026-03-12 13:57:31 +01:00
Ben Noordhuis
d2a45ce364
win: fix const correctness warning (#5057)
And fix it by calling uv_free_cpu_info so we don't repeat repeat
ourselves.
2026-03-11 22:43:35 +01:00
Ben Noordhuis
52891c8255
doc: name function crosslinks consistently (#5056)
The documentation overwhelmingly uses :c:func:`foo`. Rewrite the few
places that write it as c:func:`foo()` without the parentheses.
2026-03-11 22:43:22 +01:00
Ben Noordhuis
d357575b2b
doc: clarify handle close behavior of uv_spawn (#5055)
Contrary to how most handle init functions work, callers of uv_spawn
must always call uv_close, even if it returned an error.
2026-03-11 22:43:01 +01:00
apocelipes
6cdf71da80
win: fix const correctness compiler error (#5049) 2026-03-11 21:14:59 +01:00
Ben Noordhuis
a43e543dbf
unix: fix pedantic compiler warnings (#5052)
Fixes: https://github.com/libuv/libuv/issues/5051
2026-03-11 19:46:54 +01:00
Santiago Gimeno
a19ceeb13a
Now working on version 1.52.2 2026-03-06 21:33:24 +01:00
Santiago Gimeno
a36131ddfb Add SHA to ChangeLog 2026-03-06 21:29:20 +01:00
Santiago Gimeno
1cfa32ff59 2026.03.06, Version 1.52.1 (Stable)
Changes since version 1.52.0:

* misc: add simple clang-tidy setup (Jameson Nash)

* unix: check RLIMIT_AS and RLIMIT_DATA in uv_get_constrained_memory
  (Jameson Nash)

* win: add fs-fd-hash-inl.h to tarball (tobil4sk)

* unix,win: support NULL loop for sync uv_getaddrinfo (Saúl Ibarra
  Corretgé)

* Fix const-correctness warning in linux.c (Quaylyn Rimer)

* build(deps): bump actions/upload-artifact from 6 to 7
  (dependabot[bot])

* build(deps): bump actions/download-artifact from 7 to 8
  (dependabot[bot])

* unix: fix compilation warnings with GCC 15 (Saúl Ibarra Corretgé)

* test: remove conditionals from `uv_thread_self` usage (Yasser
  Nascimento)

* unix: fix discard const (Rudi Heitbaum)

* unix: do not cast to char variables that are const char (Rudi
  Heitbaum)

* linux: fix crash if poll callback closes handle before `POLLERR` (Juan
  José Arboleda)
2026-03-06 21:29:19 +01:00
Juan José
b030b02a3e
linux: fix crash if poll callback closes handle before POLLERR (#5039)
Previously, `uv__udp_io` would proceed to call `uv__udp_recvmsg` for
the `POLLERR` event even if the handle was just closed by the `POLLIN`
callback.

This commit adds a guard to verify the handle is still active before
processing the error queue. It also adds a regression test that
mimics this recursive closure behavior.

Fixes: https://github.com/libuv/libuv/issues/5030

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2026-03-06 15:00:09 -05:00
Rudi Heitbaum
e62ccbf770 unix: do not cast to char variables that are const char
Fix the casting of const char varaibles with const char returns from
functions, when the data being returned is not being modified.  Includes
the part revert of "unix: fix compilation warnings with GCC 15"

This reverts commit 50ed2fd7bd.
2026-03-06 18:06:19 +01:00
Rudi Heitbaum
5243d19134 unix: fix discard const
Do not cast const char to char unnecessarily. Refactor function to use
char s only when slash is in the path.

Fixes:

[6/73] Building C object CMakeFiles/uv.dir/src/inet.c.o
../src/inet.c: In function 'uv_inet_pton':
../src/inet.c:157:7: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  157 |     p = strchr(src, '%');
      |       ^

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-03-06 18:06:19 +01:00
Yasser Nascimento
568470a2ef test: remove conditionals from uv_thread_self usage
The Windows limitation was fixed in: https://github.com/libuv/libuv/pull/3357.
2026-03-06 09:44:50 +01:00
Saúl Ibarra Corretgé
50ed2fd7bd unix: fix compilation warnings with GCC 15
~~~
libuv/src/unix/internal.h: In function ‘uv__basename_r’:
libuv/src/unix/internal.h:480:12: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  480 |   return s + 1;

libuv/src/unix/linux.c: In function ‘uv__cgroup1_find_cpu_controller’:
libuv/src/unix/linux.c:2377:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2377 |   char* cgroup_cpu = strstr(cgroup, ":cpu,");
      |                      ^~~~~~

libuv/src/unix/linux.c: In function ‘uv_cpu_info’:
libuv/src/unix/linux.c:1903:20: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1903 |       .model     = p + c->model * sizeof(*model),
      |                    ^
~~~
2026-03-02 15:56:50 +01:00
dependabot[bot]
f44e6be04d build(deps): bump actions/download-artifact from 7 to 8
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 12:04:18 +01:00
dependabot[bot]
651e05e43c build(deps): bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 12:04:01 +01:00
Quaylyn Rimer
12d0dd48e3
Fix const-correctness warning in linux.c (#4843)
Fix #4814 by adding const annotation when assigning string literal
"unknown" to `char*` pointer.

This eliminates compiler warnings when building with strict
const-correctness flags like `-Wwrite-strings`.
2026-02-20 20:20:14 -05:00
Saúl Ibarra Corretgé
edfc95dbd7 unix,win: support NULL loop for sync uv_getaddrinfo
Brings symmetry with the uv_fs_xxx APIs.
2026-02-19 13:18:14 +01:00
tobil4sk
7e381d0da2
win: add fs-fd-hash-inl.h to tarball (#5031) 2026-02-16 23:07:13 +01:00
Jameson Nash
1eacb1386f
unix: check RLIMIT_AS and RLIMIT_DATA in uv_get_constrained_memory (#4899)
Add uv__get_rlimit_max_memory() helper that checks RLIMIT_AS and
RLIMIT_DATA resource limits across all Unix platforms. This helper
returns the minimum of these rlimits if set.

Update all Unix platform implementations of uv_get_constrained_memory()
to use this helper, ensuring consistent handling of resource limits:
- Linux: combine cgroup limits with rlimits
- z/OS: combine RLIMIT_MEMLIMIT with rlimits
- Other Unix platforms: use rlimits (previously returned 0)

This provides a more accurate view of available memory when processes
have rlimit constraints in addition to platform-specific limits.

Related: https://github.com/JuliaLang/julia/pull/51656
Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-13 20:54:29 -05:00