Commit Graph

5318 Commits

Author SHA1 Message Date
Ben Noordhuis
cc23e204d7
unix: reinstate preadv/pwritev fallback code (#4345)
I removed the fallback code back in October but it prevents Node.js
from upgrading libuv in their v20.x release line because they support
systems older than we do. Bring back a dlsym-based fallback path.

Fixes: https://github.com/libuv/libuv/issues/4332
2024-03-20 18:39:18 +01:00
Ben Noordhuis
e0c5fc8714
win: remove _alloca usage (#4361)
Remove it since it can cause stack overflows. Use heap allocation
instead.

Fixes: https://github.com/libuv/libuv/issues/4348
2024-03-20 12:09:37 +01:00
Ben Noordhuis
91ba13054a
test,ci: fix [AM]San, disable ASLR (#4365)
The kernel that ships with the new Ubuntu 22.04 CI image seems to have a
PIE slide that is bigger than the sanitizer runtimes can handle.

It makes ASan fail with thousands of "AddressSanitizer:DEADLYSIGNAL"
warnings, and MSan error with complaints about memory accesses outside
known ranges. Disabling address space layout randomization fixes both.

This commit also fixes a small bug in the platform_output test where
the cgroups v1 logic did not handle the "unlimited quota" special case
properly. Ubuntu 20.04 still uses cgroups v1.
2024-03-17 15:53:23 +01:00
Farzin Monsef
b0816180e3
linux: fix /proc/self/stat executable name parsing (#4353)
- The filename of the executable may contain both spaces and parentheses
- Use uv__slurp instead of open/read/close
2024-03-14 09:35:25 +01:00
Andy Pan
fa6745b4f2
sunos: sync tcp keep-alive with other unices (#4337) 2024-03-12 11:16:49 +01:00
Saúl Ibarra Corretgé
6912038d72 unix,fs: fix realpath calls that use the system allocator
Make sure we allocate the memory with uv__malloc so it's in turn freed
with uv__free.

Fixes: https://github.com/libuv/libuv/issues/4329
2024-03-08 10:08:48 +01:00
Ben Noordhuis
2c15345016
test: disable env var test under win32+asan (#4342)
The test hits an honest-to-$deity compiler runtime bug, see the
investigation in the linked issue.

Fixes: https://github.com/libuv/libuv/issues/4338
2024-03-07 09:46:57 +01:00
Santiago Gimeno
ff9587991f
win: almost fix race detecting ESRCH in uv_kill (#4341)
It might happen that only using `WaitForSingleObject()` with timeout 0
could return WAIT_TIMEOUT as the process might not have been signaled
yet. To improve things, first use `GetExitCodeProcess()` and check
that `status` is not `STILL_ACTIVE`. Then, to cover for the case that the exit
code was actually `STILL_ACTIVE` use `WaitForSingleObject()`. This could
still be prone to the race condition but only for that case.
2024-03-05 21:20:50 +01:00
Farzin Monsef
625d3d275a
cygwin: implement uv_resident_set_memory (#4333)
According to the documentation for Cygwin, the penultimate field
of /proc/pid/stat corresponds to the RSS, so the method is basically
the same as in the Linux version. The only difference is that getpagesize()
will return wincap.allocation_granularity(), but in this mapping, RSS is
calculated using wincap.page_size(), which can be accessed by sysinfo.mem_unit.
2024-03-02 11:24:57 +01:00
Geddy
a7c44d6748
udp,unix: fix sendmsg use-after-free (#4321)
Issue:
1. uv__io_poll calls uv__udp_io with revents == POLLIN + POLLOUT
2. uv__udp_io calls your recv_cb
3. you close the handle in callback
4. uv__udp_io calls uv__udp_sendmsg
5. uv__udp_sendmsg calls uv__io_feed
6. kaboom!
2024-02-28 17:32:43 -05:00
hiiizxf
e8458b2402
doc: fix tty example segfault (#4322)
Fixes: https://github.com/libuv/libuv/issues/4303
2024-02-28 12:32:24 +01:00
Thomas Walter
6b56200cc8
linux: fix uv_available_parallelism using cgroup (#4278)
uv_available_parallelism does not handle container cpu limit
set by systems like Docker or Kubernetes. This patch fixes
this limitation by comparing the amount of available cpus
returned by syscall with the quota of cpus available defined
in the cgroup.

Fixes: https://github.com/libuv/libuv/issues/4146
2024-02-28 12:23:23 +01:00
Jameson Nash
cc9e96147f
misc: run sample CI when code changes (#4324) 2024-02-23 14:15:03 -05:00
Ben Noordhuis
507f3046d1
linux: create io_uring sqpoll ring lazily (#4315)
It's been reported that creating many event loops introduces measurable
overhead now that libuv creates an sqpoll-enabled ring.

I don't really see any change in CPU time with or without this change
but deferring ring creation until it's actually used seems like a good
idea, and comes with no downsides that I can think of, so let's do it.

Fixes: https://github.com/libuv/libuv/issues/4308
2024-02-14 11:20:44 +01:00
Anthony Alayo
7b9e37c7da
build: add alias for libuv to CMakeLists.txt (#4297)
Fixes: https://github.com/libuv/libuv/issues/4282
2024-02-09 21:08:24 +01:00
Ben Noordhuis
009d7414bc
test: fix -Wpointer-to-int-cast on 32 bits systems (#4309)
The return value from signal(2) is a pointer. Use the right macro.
2024-02-09 19:17:20 +01:00
Santiago Gimeno
08a1e7fd23
Now working on version 1.48.1
Fixes: https://github.com/libuv/libuv/issues/4248
2024-02-07 22:44:52 +01:00
Santiago Gimeno
99e576612d Add SHA to ChangeLog 2024-02-07 21:20:12 +01:00
Santiago Gimeno
e9f29cb984 2024.02.07, Version 1.48.0 (Stable)
Changes since version 1.47.0:

* misc: remove deprecated stalebot file (Jameson Nash)

* build: disable windows asan buildbot (Ben Noordhuis)

* test: don't run tcp_writealot under msan (Ben Noordhuis)

* build,win: remove extraneous -lshell32 (Ben Noordhuis)

* unix: ignore ifaddrs with NULL ifa_addr (Stephen Gallagher)

* unix,win: utility for setting priority for thread (Hao Hu)

* pipe: add back error handling to connect / bind (Jameson Nash)

* test: check if ipv6 link-local traffic is routable (Ben Noordhuis)

* win: remove check for UV_PIPE_NO_TRUNCATE (Jameson Nash)

* linux: disable io_uring on hppa below kernel 6.1.51 (matoro)

* unix,win: fix read past end of pipe name buffer (Ben Noordhuis)

* unix: unbreak macOS < 10.14 (Sergey Fedorov)

* aix: disable ipv6 link local (Abdirahim Musse)

* doc: move cjihrig to emeriti (cjihrig)

* unix: correct pwritev conditional (Bo Anderson)

* test_fs.c: Fix issue on 32-bit systems using btrfs (Stephen Gallagher)

* misc: ignore libuv-release-tool files (Jameson Nash)

* win: honor NoDefaultCurrentDirectoryInExePath env var (Ardi Nugraha)

* idna: fix compilation warning (Saúl Ibarra Corretgé)

* linux: remove HAVE_IFADDRS_H macro (Ben Noordhuis)

* test: skip tcp-write-in-a-row on IBM i (Abdirahim Musse)

* build,win: work around missing uuid.dll on MinGW (Anton Bachin)

* win: stop using deprecated names (Matheus Izvekov)

* unix,win: fix busy loop with zero timeout timers (Matheus Izvekov)

* aix,ibmi: use uv_interface_addresses instead of getifaddrs (Abdirahim
  Musse)

* linux: fix bind/connect for abstract sockets (Santiago Gimeno)

* win: replace c99 comments with c89 comments (Trevor Flynn)

* build: add .cache clangd folder to .gitignore (Juan José Arboleda)

* unix: support full TCP keep-alive on Solaris (Andy Pan)

* freebsd: fix F_KINFO file path handling (David Carlier)

* linux: retry fs op if unsupported by io_uring (Santiago Gimeno)

* freebsd: fix build on non-intel archs (David Carlier)

* unix: optimize uv__tcp_keepalive cpp directives (Andy Pan)

* linux: disable io_uring on ppc64 and ppc64le (Brad King)

* doc: add very basic Security Policy document (Santiago Gimeno)

* build: re-enable msvc-asan job on CI (Jameson Nash)

* win/spawn: optionally run executable paths with no file extension
  (Brad King)

* win: fix ESRCH implementation (Jameson Nash)

* unix,win: reset the timer queue on stop (Santiago Gimeno)

* fix: always zero-terminate idna output (Ben Noordhuis)

* fix: reject zero-length idna inputs (Ben Noordhuis)

* test: empty strings are not valid IDNA (Santiago Gimeno)

* Merge pull request from GHSA-f74f-cvh7-c6q6 (Ben Noordhuis)
2024-02-07 20:20:07 +00:00
Ben Noordhuis
c858a14764
Merge pull request from GHSA-f74f-cvh7-c6q6
* fix: always zero-terminate idna output

* fix: reject zero-length idna inputs

* test: empty strings are not valid IDNA

---------

Co-authored-by: Santiago Gimeno <santiago.gimeno@gmail.com>
2024-02-07 20:53:55 +01:00
Santiago Gimeno
e0327e1d50
test: empty strings are not valid IDNA
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:50:13 +01:00
Ben Noordhuis
3530bcc303
fix: reject zero-length idna inputs
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:50:04 +01:00
Ben Noordhuis
0f2d7e784a
fix: always zero-terminate idna output
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:49:53 +01:00
Santiago Gimeno
bb6fbcf6e7
unix,win: reset the timer queue on stop (#4304)
As there were instances where this didn't happen and could cause memory
corruption issues.

Refs: https://github.com/libuv/libuv/issues/4248
2024-02-07 10:43:29 +01:00
Santiago Gimeno
10f313631c
Revert "unix: restore signal disposition to previous one (#4216)" (#4302)
This reverts commit b9421d7066.

Refs: https://github.com/libuv/libuv/issues/4299
Refs: https://github.com/libuv/libuv/issues/4248
2024-02-06 07:52:21 +01:00
Jameson Nash
129362f356
win: fix ESRCH implementation (#4301)
Per documentation, this was the wrong way to test for ESRCH. This hopefully
fixes it.

Fixes: https://github.com/libuv/libuv/issues/4300
2024-02-05 21:24:07 +01:00
Brad King
3f7191e5c2
win/spawn: optionally run executable paths with no file extension (#4292)
Add a process options flag to enable the optional behavior. Most users
are likely recommended to set this flag by default, but it was deemed
potentially breaking to set it by default in libuv.

Co-authored-by: Kyle Edwards <kyle.edwards@kitware.com>
2024-02-05 11:04:05 -05:00
Jameson Nash
535efdf319
build: re-enable msvc-asan job on CI (#4289) 2024-01-21 10:44:34 -05:00
Santiago Gimeno
f98516ddd5
doc: add very basic Security Policy document (#4290) 2024-01-19 19:09:39 +01:00
Brad King
3b6a1a14ca
linux: disable io_uring on ppc64 and ppc64le (#4285)
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
2024-01-13 12:04:01 +01:00
Andy Pan
a7cbda92b6
unix: optimize uv__tcp_keepalive cpp directives (#4275)
Reduce the amount of code being compiled and trim trailing whitespace in
passing.
2024-01-12 11:54:51 +01:00
David CARLIER
a407b232f0
freebsd: fix build on non-intel archs (#4276)
KINFO_FILE_SIZE is only defined on Intel archs.

Fixes: https://github.com/libuv/libuv/issues/4274
2024-01-09 11:10:35 +01:00
Santiago Gimeno
160cd5629e
linux: retry fs op if unsupported by io_uring (#4268)
Fallback to the threadpool if it returns `EOPNOTSUPP`.

Fixes: https://github.com/nodejs/node/issues/50876
2024-01-08 22:25:44 +01:00
David CARLIER
7d092913b3
freebsd: fix F_KINFO file path handling (#4256)
The new F_KINFO flag does not seem to work with directories nor with
deleted entries.

Fixes: https://github.com/libuv/libuv/issues/4255
2024-01-07 12:58:32 +01:00
Andy Pan
a9381cdb03
unix: support full TCP keep-alive on Solaris (#4272)
Solaris claimed it supported the TCP-Alives mechanism,
but TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT were not
available on Solaris until the latest version 11.4.
Therefore, we need to simulate the TCP-Alives mechanism on
other platforms via TCP_KEEPALIVE_THRESHOLD + TCP_KEEPALIVE_ABORT_THRESHOLD.
2024-01-06 10:46:47 +01:00
Juan José
e72a91e063
build: add .cache clangd folder to .gitignore (#4257)
The clangd index, before creating the `compile_commands.json` file will
create the indexes under a `.cache` folder. This does not need to be
tracked by the repo.

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-01-05 10:38:15 +01:00
Trevor Flynn
64bd28f5ba
win: replace c99 comments with c89 comments (#4270) 2024-01-05 10:34:33 +01:00
Santiago Gimeno
1dd0ab1315
linux: fix bind/connect for abstract sockets (#4266)
The `\0` character has no special significance in abstract sockets, so
the addrlen field in both `bind()` and `connect()` should take that into
account.
2023-12-25 23:35:14 +01:00
Abdirahim Musse
8861a97efa
aix,ibmi: use uv_interface_addresses instead of getifaddrs (#4222)
AIX and IBM i don't have getifaddrs but we do have code in
`uv_interface_addresses` to get the interface addresses.

Refs: https://github.com/libuv/libuv/issues/4117
2023-12-23 00:58:49 +01:00
Matheus Izvekov
51a22f60d6
unix,win: fix busy loop with zero timeout timers (#4250)
Calling `uv_timer_start(h, cb, 0, 0)` from a timer callback resulted in
the timer running immediately because it was inserted at the front of
the timer heap.

If the callback did that every time, libuv would effectively busy-loop
in `uv__run_timers()` and never make forward progress.

Work around that by collecting all expired timers into a queue and only
running their callback afterwards.

Fixes: https://github.com/libuv/libuv/issues/4245
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2023-12-22 12:40:50 +01:00
Matheus Izvekov
8a499e1331
win: stop using deprecated names (#4253) 2023-12-22 12:30:48 +01:00
Anton Bachin
34db4c21b1
build,win: work around missing uuid.dll on MinGW (#4261) 2023-12-20 14:27:13 +01:00
Abdirahim Musse
1479b76310
test: skip tcp-write-in-a-row on IBM i (#4197)
On IBM i this test fails asserting the write queue size.
The test expects the queue size to be greater than 0 but
the queue size is 0 on IBM i.

66160d6973/test/test-tcp-write-in-a-row.c (L75)

The test expects the write to get queued because the size of the data
is larger than the send and receive buffers.

66160d6973/test/test-tcp-write-in-a-row.c (L39-L40)

For some reason the request does not seem to get queued on IBM i.
The root cause of the issue will need further investigation.

Part of #4143
2023-12-12 15:19:02 -05:00
Ben Noordhuis
a7d5255122
linux: remove HAVE_IFADDRS_H macro (#4243)
Introduced long ago for old Linux/libc flavors libuv no longer supports.

We include <ifaddrs.h> unconditionally elsewhere so there is no point in
special-casing it here.

Fixes: https://github.com/libuv/libuv/issues/4242
2023-12-12 15:13:31 -05:00
Saúl Ibarra Corretgé
12bd89bbc3 idna: fix compilation warning
w_target_len is set but unsued in release mode.
2023-12-11 09:42:18 +01:00
Ardi Nugraha
5e302730cd
win: honor NoDefaultCurrentDirectoryInExePath env var (#4238)
Fixes: https://github.com/libuv/libuv/issues/3888
Refs: https://github.com/nodejs/node/issues/46264
2023-11-30 22:54:41 +01:00
Jameson Nash
a5c01d4de3
misc: ignore libuv-release-tool files (#4201) 2023-11-24 11:22:25 +01:00
Stephen Gallagher
de43f42735
test_fs.c: Fix issue on 32-bit systems using btrfs (#4227)
On Fedora's build system, the build environment runs on btrfs. This
revealed a bug in the test on i686 systems, where this comparison was
being performed as a comparison of two signed integers, but the
filesystem type of btrfs happens to use the higher-order bits, resulting
in it appearing as a negative value.

BTRFS_SUPER_MAGIC     0x9123683e

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-11-24 11:18:51 +01:00
Bo Anderson
fc70430b09
unix: correct pwritev conditional (#4233) 2023-11-24 11:17:52 +01:00
Colin Ihrig
7ba94d3909
doc: move cjihrig to emeriti (#4234) 2023-11-19 08:47:23 -05:00