Revisit the fix from commit b705b53. The problem with using sigset_t
and _NSIG is that the size of sigset_t and the value of _NSIG depend
on what headers libuv picks up first, <signal.h> or <asm/signal.h>.
With the former, sizeof(sigset_t) = 128; with the latter, it's 8.
Simply sidestep the issue by calculating the signal mask as a 64 bits
integer, without using sigset_t or _NSIG.
This is a partial cherry-pick of commit 751ac48 from the v1.x branch.
Original PR-URL: https://github.com/libuv/libuv/pull/83
PR-URL: https://github.com/libuv/libuv/pull/84
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Changes since version 0.10.30:
* test: test that closing a poll handle doesn't corrupt the stack (Bert
Belder)
* win: fix compilation of tests (Marc Schlaich)
* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert
Belder)
* win: avoid stack corruption when closing a poll handle (Bert Belder)
* gitignore: ignore Visual Studio files (Marc Schlaich)
* win: set fallback message if FormatMessage fails (Marc Schlaich)
* win: fall back to default language in uv_dlerror (Marc Schlaich)
* test: improve compatibility for dlerror test (Marc Schlaich)
* test: check dlerror is "no error" in no error case (Marc Schlaich)
* build: link against -pthread (Logan Rosen)
* win: scandir use 'ls' for formatting long strings (Kenneth Perry)
Please see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773341 for
more information. Libuv uses some of pthread's symbols, but it doesn't
link against it, which causes underlinking issues, especially in Ubuntu
where we use ld --as-needed. The issue also shows up as warnings in
Debian's build logs.
PR-URL: https://github.com/libuv/libuv/pull/73
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Check uv_dlerror() doesn't return "no_error", in order to make the test
less dependent on the exact error message the platform produces when
loading a dynamic library fails.
PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
FormatMessage can fail, e.g. with ERROR_MUI_FILE_NOT_FOUND. In this case
no error message was set and uv_dlerror wrongly returned "no error".
With this patch the fallback error message "error: <errorno>" is
generated when FormatMessage fails.
PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
When the user closes an uv_poll_t handle, there may still be an
outstanding AFD_POLL request. Libuv can't cancel this AFD_POLL request
directly, so it has to submit another which makes the the previous
poll request return.
Libuv completely forgets about the "canceling" AFD_POLL request, but
at some point in time it may complete and store its result somewhere in
memory.
Without this patch the result of the canceling poll request is written
somewhere on the stack, which sometimes causes stack corruption. This
patch ensures that the result is written to some static scratch space
where it can do no harm.
PR-URL: https://github.com/libuv/libuv/pull/49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Marc Schlaich <marc.schlaich@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The offending patch doesn't completely fix the issue, it just trades
stack corruption for heap corruption which is less likely.
In addition there is a much simpler solution for this problem.
This reverts commit cd894521dd.
PR-URL: https://github.com/libuv/libuv/pull/49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Marc Schlaich <marc.schlaich@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Add a per-event loop flag for blocking SIGPROF signals when polling for
events.
The motivation for this addition is to reduce the number of wakeups and
subsequent clock_gettime() system calls when using a sampling profiler.
On Linux, this switches from epoll_wait() to epoll_pwait() when enabled.
Other platforms bracket the poll syscall with pthread_sigmask() calls.
Refs strongloop/strong-agent#3 and strongloop-internal/scrum-cs#37.
PR-URL: https://github.com/libuv/libuv/pull/15
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
linux-syscalls.h assumes that on all Linux platforms the value
of O_NONBLOCK is the same as SOCK_NONBLOCK.
This commit fixes it, as it is at least not true for hppa, and
resolves#1442.
Signed-off-by: Luca Bruno <lucab@debian.org>
sizeof(sigset_t) = 128 whereas the kernel expects 8, the size of a long.
It made the system call fail with EINVAL when a non-NULL sigset was
passed in. Fortunately, it's academic because there is just one call
site and it passes in NULL.
Fixeslibuv/libuv#4.
Changes since version 0.10.28:
* darwin: allocate enough space for select() hack (Fedor Indutny)
* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)
* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
It seems that epoll_wait is implemented in glibc in terms of epoll_pwait and
new architectures (like arm64) do not implement the epoll_wait syscall at all.
So if epoll_wait errors with ENOSYS, just call epoll_pwait.
This is a backport of 861de3d71d for v0.10
branch.
`fd_set`s are way too small for `select()` hack when stream's fd is
bigger than 1023. Make `fd_set`s a part of `uv__stream_select_t`
structure.
fix#1461
Conflicts:
src/unix/stream.c
Changes since version 0.10.27:
* windows: fix handling closed socket while poll handle is closing (Saúl
Ibarra Corretgé)
* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)
* unix: fix bogus structure field name (Saúl Ibarra Corretgé)
* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
According to @aktau, the call to `mach_timebase_info` costs 90% of the
total execution time of `uv_hrtime()`. The result of the call is static
on all existing platforms, so there is no need in invoking it multiple
times.
Signed-off-by: Fedor Indutny <fedor@indutny.com>