Commit Graph

5491 Commits

Author SHA1 Message Date
Jeffrey H. Johnson
eb5af8e3c0
aix,ibmi: fix compilation errors in fs_copyfile (#4404)
On IBM AIX (and PASE for IBM i), use st_timespec_t
when _XOPEN_SOURCE>=700 and _ALL_SOURCE is defined.

Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
2024-05-30 22:31:15 +02:00
Andy Pan
1ee1063402
test: fix the flaky test-tcp-reuseport
Start connecting to the peers after all threads
to poll for accepting connections.

Ref: #4407
2024-05-30 09:53:44 +02:00
Juan José Arboleda
541329d51f doc: add entries for extended getpw
This patch adds documentation for the introduced `uv_os_get_passwd2`,
`uv_os_get_group`, `uv_os_free_group` methods in
https://github.com/libuv/libuv/pull/3523

Fixes: https://github.com/libuv/libuv/issues/4007
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-05-28 17:04:30 +02:00
Andy Pan
d2d92b74a8
unix: support SO_REUSEPORT with load balancing for TCP 2024-05-21 13:36:49 +02:00
Andy Pan
c8d4a87f49
bsd: support pipe2() on *BSD (#4412)
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 10:07:38 +02:00
Andy Pan
ab3ecf6565 unix: use the presence of SOCK_* instead of OS macros for socketpair
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 09:41:03 +02:00
Andy Pan
287987b37c test: remove the obsolete HAVE_KQUEUE macro
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 09:40:07 +02:00
Andy Pan
10ccd08471
dragonfly: disable SO_REUSEPORT for UDP socket bindings (#4410)
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-20 12:36:41 +02:00
Juan José
bf61390769
linux,darwin: make uv_fs_copyfile behaves like cp -r (#4396)
This commit changes the timestamps in the file, the ownership and the
group.

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

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-05-08 11:30:30 +02:00
josedelinux
520eb622f0
doc: fix some typos 2024-04-26 13:57:26 +02:00
Saúl Ibarra Corretgé
497f3168d1 win: remove no longer needed define
Windows 7 is no longer supported.
2024-04-22 20:39:20 +02:00
Saúl Ibarra Corretgé
8083ab26e0 mailmap: update saghul's main email address 2024-04-15 16:12:10 +02:00
Saúl Ibarra Corretgé
c0a61c3bb3 darwin: simplify uv_hrtime
mach_continuous_time is available since macOS 10.12, but our minimum
version is 11, so no need for a workaround.

Also, prefer that to `clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW)` which
the documentation suggests
(https://developer.apple.com/documentation/driverkit/3438077-mach_continuous_time)
since the latter calls mach_timebase_info every time, unnecessarify: 49dcc07a40/Libc/gen/clock_gettime.c (L107)
2024-04-15 16:12:10 +02:00
Brad King
f50ae53c42
unix: de-duplicate conditions for using kqueue (#4378)
Our platform-specific headers provide a dedicated indicator.
2024-04-14 11:13:21 +02:00
Ben Noordhuis
17219b8f39
test: use newer ASSERT_MEM_EQ macro (#4346)
Should hopefully make it easier to debug CI flakiness because
currently the test sometimes fails without a clear indication why.

Refs: https://github.com/libuv/libuv/issues/4106
2024-03-31 17:27:04 +02:00
Ben Noordhuis
46c0e1769b
win: robustify uv_os_getenv() error checking (#4339)
Make it less likely for the thread-local error value to get
clobbered between performing the operation and checking the result.

Refs: https://github.com/libuv/libuv/issues/4338
2024-03-31 17:25:13 +02:00
Ben Noordhuis
4fce06ec96
unix: fix fd leaks in SCM_RIGHTS error path (#4358)
The file descriptor leak in the inner path was pointed out by @theanarkh
and I subsequently spotted another one in the outer loop. Rewrite the
function to process all control messages.

Refs: https://github.com/libuv/libuv/pull/4357
2024-03-25 12:45:40 +01:00
Ben Noordhuis
77e4cd5b18
linux: don't use sendmmsg() for single datagrams (#4366)
Benchmarking shows that sendmsg() is persistently around 1% faster for
single datagrams, and that kind of stands to reason because there is
less setup overhead, and the kernel has to copy in less data.

Fixes: https://github.com/libuv/libuv/issues/4320
2024-03-25 12:45:23 +01:00
Ben Noordhuis
d05ed869bb
doc: correct udp socket options documentation (#4371)
uv_udp_init() creates the UDP socket lazily but to set socket options
there must be, well, a socket to set the options on. Document how and
when that requirement is met.

Fixes: https://github.com/libuv/libuv/issues/4370
2024-03-25 12:44:52 +01:00
Saúl Ibarra Corretgé
abc9767034
win: simplify uv_once implementation
* win: simplify uv_once implementation

InitOnceExecuteOnce is available in Windows >= Vista.

Ref: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initonceexecuteonce
2024-03-25 11:57:52 +01:00
Saúl Ibarra Corretgé
6adeeacee7
unix,win: error on zero delay tcp keepalive
Closes: https://github.com/libuv/libuv/pull/4350
Closes: https://github.com/libuv/libuv/issues/3487
2024-03-22 22:11:23 +01:00
tgolang
f55628eed0
doc: fix typos in ChangeLog (#4355)
Signed-off-by: tgolang <seekseat@aliyun.com>
2024-03-22 20:10:41 +01:00
Ben Noordhuis
3ecce91410
linux: don't delay EPOLL_CTL_DEL operations (#4328)
Perform EPOLL_CTL_DEL immediately instead of going through
io_uring's submit queue, otherwise the file descriptor may
be closed by the time the kernel starts the operation.

Fixes: https://github.com/libuv/libuv/issues/4323
2024-03-21 09:23:08 +01:00
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