Commit Graph

4148 Commits

Author SHA1 Message Date
Bert Belder
9f3fa71cfa Merge branch 'v0.10' into v1.x
Conflicts:
	src/win/poll.c
	test/test-poll-close-doesnt-corrupt-stack.c
2014-12-10 16:58:01 +01:00
Bert Belder
48d39345bc win: avoid stack corruption when closing a poll handle
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>
2014-12-10 16:44:28 +01:00
Bert Belder
152c35d54d Revert "win: keep a reference to AFD_POLL_INFO in cancel poll"
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>
2014-12-10 16:44:28 +01:00
Marc Schlaich
2e30a19641 win: fix compilation of tests
PR-URL: https://github.com/libuv/libuv/pull/51
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-10 16:44:27 +01:00
Marc Schlaich
2f0b41ec82 win: fix compilation of tests
PR-URL: https://github.com/libuv/libuv/pull/51
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-10 15:21:04 +01:00
Bert Belder
5f2016a425 test: test that closing a poll handle doesn't corrupt the stack
This is a regression test for an issue that was originally reported
in https://github.com/libuv/libuv/pull/36, and fixed in cd89452.

PR-URL: https://github.com/libuv/libuv/pull/48
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 22:03:05 +01:00
Bert Belder
f9aa3b3d60 test: test that closing a poll handle doesn't corrupt the stack
This is a regression test for an issue that was originally reported
in https://github.com/libuv/libuv/pull/36, and fixed in cd89452.

PR-URL: https://github.com/libuv/libuv/pull/48
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 22:01:16 +01:00
Saúl Ibarra Corretgé
413dbd89ec Add SHAs to changelog 2014-12-09 20:19:01 +01:00
Saúl Ibarra Corretgé
d42630dd9b 2014.12.10, Version 1.0.2 (Stable)
Changes since version 1.0.1:

* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)

* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)

* doc: fix spelling (Joey Geralnik)

* unix, windows: fix typos in comments (Joey Geralnik)

* test: canonicalize test runner path (Ben Noordhuis)

* test: fix compilation warnings (Saúl Ibarra Corretgé)

* test: skip tty test if detected width and height are 0 (Saúl Ibarra
  Corretgé)

* doc: update README with IRC channel (Saúl Ibarra Corretgé)

* Revert "unix: use cfmakeraw() for setting raw TTY mode" (Ben
  Noordhuis)

* doc: document how to get result of uv_fs_mkdtemp (Tim Caswell)

* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)

* unix, windows: add uv_loop_configure() function (Ben Noordhuis)

* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)

* test: raise fd limit for OSX select test (Saúl Ibarra Corretgé)

* unix: remove overzealous assert in uv_read_stop (Saúl Ibarra Corretgé)

* unix: reset the reading flag when a stream gets EOF (Saúl Ibarra
  Corretgé)

* unix: stop reading if an error is produced (Saúl Ibarra Corretgé)

* cleanup: remove all dead assignments (Maciej Małecki)

* linux: return early if we have no interfaces (Maciej Małecki)

* cleanup: remove a dead increment (Maciej Małecki)
2014-12-09 20:17:06 +01:00
Saúl Ibarra Corretgé
7d144851b5 Merge branch 'v0.10' into v1.x
Conflicts:
	AUTHORS
	ChangeLog
	src/version.c
	src/win/poll.c
2014-12-09 19:58:38 +01:00
Saúl Ibarra Corretgé
20fe7f9bc7 Now working on v0.10.31 2014-12-09 19:49:50 +01:00
Saúl Ibarra Corretgé
5a63f5e954 2014.12.10, Version 0.10.30 (Stable)
Changes since version 0.10.29:

* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)

* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)

* doc: update project links (Ben Noordhuis)

* windows: fix compilation of tests (Marc Schlaich)

* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)

* unix, windows: add uv_loop_configure() function (Ben Noordhuis)

* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
2014-12-09 19:49:43 +01:00
Maciej Małecki
f87657ee08 cleanup: remove a dead increment
As pointed out by clang-analyzer.

PR-URL: https://github.com/libuv/libuv/pull/13
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 12:53:04 +01:00
Maciej Małecki
f86cd02a94 linux: return early if we have no interfaces
This was pointed out as possible undefined allocation of 0 bytes by
clang-analyzer. `malloc` of 0 bytes can return either `NULL` or a
valid pointer which can't be dereferenced. On systems which return
`NULL`, we would consider it a `malloc` error and return an `ENOMEM` to
the caller.

PR-URL: https://github.com/libuv/libuv/pull/13
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 12:52:59 +01:00
Maciej Małecki
18d58643af cleanup: remove all dead assignments
As pointed out by clang-analyzer.

PR-URL: https://github.com/libuv/libuv/pull/13
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 12:52:51 +01:00
Saúl Ibarra Corretgé
873b02607c unix: stop reading if an error is produced
This aligns the behavior with Windows, where users don't need to
call `uv_read_stop` or `uv_close` if they get an error in the read
callback.

PR-URL: https://github.com/libuv/libuv/pull/47
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-09 12:01:01 +01:00
Saúl Ibarra Corretgé
b1bb9053a5 unix: reset the reading flag when a stream gets EOF
PR-URL: https://github.com/libuv/libuv/pull/47
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-09 12:00:52 +01:00
Saúl Ibarra Corretgé
db6ba5b28c unix: remove overzealous assert in uv_read_stop
Also make it a noop if we weren't reading at all.

PR-URL: https://github.com/libuv/libuv/pull/47
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-09 12:00:31 +01:00
Saúl Ibarra Corretgé
5c1c046dba test: raise fd limit for OSX select test
Fixes #42

PR-URL: https://github.com/libuv/libuv/pull/46
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-09 11:48:52 +01:00
schlamar
cd894521dd win: keep a reference to AFD_POLL_INFO in cancel poll 2014-12-09 08:49:59 +01:00
Ben Noordhuis
d3b1ccd6fb doc: document uv_loop_configure()
Move the comments from commit 9da5fd4 from the v0.10 branch into docs/.
2014-12-05 20:20:52 +01:00
Ben Noordhuis
a6f2a4f834 Merge branch 'v0.10' into v1.x
Conflicts:
	AUTHORS
	ChangeLog
	README.md
	config-unix.mk
	include/uv.h
	src/unix/internal.h
	src/unix/kqueue.c
	src/unix/linux-core.c
	src/unix/stream.c
	src/uv-common.c
	src/uv-common.h
	src/version.c
	test/test-osx-select.c
2014-12-05 19:18:36 +01:00
Ben Noordhuis
9da5fd443e unix, windows: add uv_loop_configure() function
The only supported option right now is UV_LOOP_BLOCK_SIGNAL, which only
supports the SIGPROF signal and only on UNIX platforms.  So yes, it is
kind of limited right now.  But everything has to start somewhere.

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>
2014-12-05 17:39:43 +01:00
Ben Noordhuis
2daf9448b1 unix: add flag for blocking SIGPROF during poll
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>
2014-12-05 17:38:31 +01:00
Tim Caswell
dfdcfc0c4d doc: document how to get result of uv_fs_mkdtemp
PR-URL: https://github.com/libuv/libuv/pull/31
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-05 17:20:53 +01:00
Ben Noordhuis
484a3a92a8 Revert "unix: use cfmakeraw() for setting raw TTY mode"
This reverts commit 0f25560c8a.

This change was introduced to make it possible to use the TTY for binary
I/O but unfortunately it breaks libuv users that depend on the OPOST and
ONLCR flags, like node.js.

There is no point in adding those flags after the call to cfmakeraw()
because that would once again make the TTY unsuitable for binary I/O.
Let's revert it for now and revisit it again later.

Fixes libuv/libuv#32, reverts joyent/libuv#1567.

PR-URL: https://github.com/libuv/libuv/pull/33
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-04 21:16:06 +01:00
Saúl Ibarra Corretgé
e7895debea doc: update README with IRC channel
PR-URL: https://github.com/libuv/libuv/pull/26
2014-12-03 12:03:49 +01:00
Saúl Ibarra Corretgé
e157dc9c67 test: skip tty test if detected width and height are 0
This happens in certain build environments such as Jenkins if
some tweaking is not performed in the host system.

PR-URL: https://github.com/libuv/libuv/pull/22
2014-12-02 23:57:06 +01:00
Saúl Ibarra Corretgé
b5442510c5 test: fix compilation warnings
PR-URL: https://github.com/libuv/libuv/pull/23
2014-12-02 23:53:57 +01:00
Ben Noordhuis
ff29322b99 test: canonicalize test runner path
The get_currentexe test requires a canonicalized argv[0] to check
against.  Before this commit, it failed when argv[0] contained symbolic
links.

Fixes libuv/libuv#18.
2014-12-01 16:20:51 +01:00
Joey Geralnik
3aeca36a1b unix, windows: fix typos in comments
Fix various typos and spelling mistakes in comments.
Does not affect any code, just changes comments.

PR-URL: https://github.com/libuv/libuv/pull/17
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-11-29 04:23:19 +01:00
Joey Geralnik
45c7ccce21 doc: fix spelling
Fix various typos and spelling mistakes in the documentation

PR-URL: https://github.com/libuv/libuv/pull/17
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-11-29 04:22:56 +01:00
Bert Belder
6ffe2a9dec Add SHAs to changelog 2014-11-26 21:37:25 +01:00
Bert Belder
0a8e81374e 2014.11.27, Version 1.0.1 (Stable)
Changes since version 1.0.0:

* readme: remove Rust from users (Elijah Andrews)

* doc,build,include: update project links (Ben Noordhuis)

* doc: fix typo: Strcutures -> Structures (Michael Ira Krufky)

* unix: fix processing process handles queue (Saúl Ibarra Corretgé)

* win: replace non-ansi characters in source file (Bert Belder)
2014-11-26 21:31:41 +01:00
Bert Belder
030666385c win: replace non-ansi characters in source file
Closes: joyent/libuv#1581
2014-11-26 21:24:05 +01:00
Saúl Ibarra Corretgé
c0ea37cf30 unix: fix processing process handles queue
Make sure we initialize it after the handle was removed from the pending
queue so that QUEUE_REMOVE doesn't do an invalid write when the process
is closed.

Valgrind output:

==4362== Invalid write of size 8
==4362==    at 0x407DB8: uv__process_close (process.c:515)
==4362==    by 0x404F94: uv_close (core.c:138)
==4362==    by 0x4037C5: main (invalid_write.c:33)
==4362==  Address 0xffeffc820 is not stack'd, malloc'd or (recently) free'd
==4362==
==4362== Invalid write of size 8
==4362==    at 0x407DC3: uv__process_close (process.c:515)
==4362==    by 0x404F94: uv_close (core.c:138)
==4362==    by 0x4037C5: main (invalid_write.c:33)
==4362==  Address 0xffeffc828 is not stack'd, malloc'd or (recently) free'd

Refs: joyent/libuv/issues/1584
2014-11-26 11:07:24 +01:00
Michael Ira Krufky
06b78e1ead doc: fix typo: Strcutures -> Structures
Signed-off-by: Michael Ira Krufky <m.krufky@samsung.com>
2014-11-26 08:42:08 +01:00
schlamar
0bcac64512 windows: fix compilation of tests 2014-11-26 08:32:59 +01:00
Ben Noordhuis
fa35193bb1 doc: update project links
This is like commit 7ce1113 from the v1.x branch but for the v0.10
branch.  The project home has moved, update the links in the README.
2014-11-25 17:20:34 +01:00
Helge Deller
5672bbd68a linux: handle O_NONBLOCK != SOCK_NONBLOCK case
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>
2014-11-25 17:16:22 +01:00
Ben Noordhuis
7ce1113885 doc,build,include: update project links
The project home has moved from https://github.com/joyent/libuv to
https://github.com/libuv/libuv.  Update the links inside the repo.
2014-11-25 15:39:12 +01:00
Ben Noordhuis
b705b53edd linux: fix sigmask size arg in epoll_pwait() call
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.

Fixes libuv/libuv#4.
2014-11-25 02:00:51 +01:00
Elijah Andrews
156069130f readme: remove Rust from users
Closes #1572
2014-11-20 19:40:35 +01:00
Saúl Ibarra Corretgé
feb2a9e694 2014.11.21, Version 1.0.0 (Stable)
Changes since version 1.0.0-rc2:

* doc: fix git/svn url for gyp repo in README (Emmanuel Odeke)

* windows: fix fs_read with nbufs > 1 and offset (Unknown W. Brackets)

* win: add missing IP_ADAPTER_UNICAST_ADDRESS_LH definition for MinGW
  (huxingyi)

* doc: mention homebrew in README (Mikhail Mukovnikov)

* doc: add learnuv workshop to README (Thorsten Lorenz)

* doc: fix parameter name in uv_fs_access (Saúl Ibarra Corretgé)

* unix: use cfmakeraw() for setting raw TTY mode (Yuri D'Elia)

* win: fix uv_thread_self() (Alexis Campailla)

* build: add x32 support to gyp build (Ben Noordhuis)

* build: remove dtrace probes (Ben Noordhuis)

* doc: fix link in misc.rst (Manos Nikolaidis)

* mailmap: remove duplicated entries (Saúl Ibarra Corretgé)

* gyp: fix comment regarding version info location (Saúl Ibarra
  Corretgé)
2014-11-20 19:34:12 +01:00
Saúl Ibarra Corretgé
a07e077968 gyp: fix comment regarding version info location 2014-11-20 19:26:04 +01:00
Saúl Ibarra Corretgé
fe0b3ed199 mailmap: remove duplicated entries 2014-11-20 19:19:52 +01:00
Manos Nikolaidis
0fc24f6f74 doc: fix link in misc.rst 2014-11-18 08:24:48 +01:00
Ben Noordhuis
cb5140023b build: remove dtrace probes
The existing probes, all two of them, cause a great deal of pain for
people trying to build libuv on Linux because of SystemTap's dtrace(1)
utilitity not understanding the -xnolibs flag.

We could hack around that but it's easier to just remove the probes:
they are largely useless and unused while still needing a lot of
supporting infrastructure.  This commit removes 200 lines of code
and configuration.

Refs joyent/libuv#1478.
2014-11-10 20:12:50 -03:00
Ben Noordhuis
f914721c24 build: add x32 support to gyp build
This commit adds x32 support to the gyp build.  Configure with:

    $ ./gyp_uv.py -Dtarget_arch=x32
2014-11-10 20:12:22 -03:00
Alexis Campailla
6591d000d1 win: fix uv_thread_self()
59658a8de7 changed uv_thread_self()
to return uv_thread_t, but uv_thread_t is a thread's HANDLE while
uv_thread_self() returns the current thread's id.
This means that uv_thread_equal() is also broken, as we are
potentially comparing HANDLES to ids.

Changed uv_thread_self() to return the current thread's creation handle.
Fixed small doc issue.
2014-11-10 20:03:01 -03:00