Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jul 19, 2012
  1. @bnoordhuis

    unix: fix format string vulnerability in freebsd.c

    bnoordhuis authored
    uv_set_process_title() was susceptible to a format string vulnerability:
    
      $ node -e 'process.title = Array(42).join("%s")'
      Segmentation fault: 11 (core dumped)
    
    The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
    but valgrind complains loudly about reads from and writes to uninitialized
    memory in libc. It's not a libuv bug because the test case below triggers the
    same warnings:
    
      #include <sys/types.h>
      #include <unistd.h>
    
      int main(void)
      {
        setproctitle("%s", "test");
        return 0;
      }
    
    That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
    
    This commit reapplies commit a9f6f06, which got reverted in 69a6afe. The revert
    turned out to be unnecessary.
  2. @bnoordhuis

    unix: fix uv_pipe_connect() with existing fd

    bnoordhuis authored
    Don't create a new socket descriptor if one has been previously assigned with
    uv_pipe_open().
  3. @bnoordhuis

    unix: fix errno reporting in uv_pipe_connect()

    bnoordhuis authored
    Remember the errno when the socket() syscall fails.
Commits on Jul 18, 2012
  1. @bnoordhuis

    unix: undo changes to uv_set_process_title()

    bnoordhuis authored
    It's making node.js crash when run as root. Backtrace:
    
      (gdb) bt
      #0  0x00007fff856e3ff9 in __findenv ()
      #1  0x00007fff856e404c in getenv ()
      #2  0x000000010004c850 in loop_init (loop=0x10045a792, flags=8) at ev.c:1707
      #3  0x000000010004cb3b in ev_backend [inlined] () at /Users/tjfontaine/Development/node/deps/uv/src/unix/ev/ev.c:2090
      #4  0x000000010004cb3b in ev_default_loop (flags=1606417108) at ev.c:2092
      #5  0x000000010004e5c6 in uv__loop_init (loop=0x10066e330, default_loop=1) at loop.c:52
      #6  0x0000000100044367 in uv_default_loop () at core.c:196
      #7  0x0000000100004625 in node::Init (argc=1606417456, argv=0x100b0f490) at node.cc:2761
      #8  0x000000010000797d in node::Start (argc=1606417600, argv=0x0) at node.cc:2888
      #9  0x0000000100000ca4 in start ()
    
    This reverts commits:
    
      b49d6f7 unix: fix uv_set_process_title()
      a9f6f06 unix: fix format string vulnerability in freebsd.c
      a87abc7 unix: avoid buffer overflow in proctitle.c
      dc97d44 unix: move uv_set_process_title() to proctitle.c
Commits on Jul 17, 2012
  1. @bnoordhuis

    unix: fix uv_set_process_title()

    bnoordhuis authored
    Use strncpy() to set the process title, it pads the remainder with nul bytes.
    Avoids garbage output on systems where `ps aux` prints the entire proctitle
    buffer, not just the characters up to the first '\0'.
    
    Fixes joyent/node#3726.
Commits on Jul 13, 2012
  1. @bnoordhuis

    unix: fix format string vulnerability in freebsd.c

    bnoordhuis authored
    uv_set_process_title() was susceptible to a format string vulnerability:
    
      $ node -e 'process.title = Array(42).join("%s")'
      Segmentation fault: 11 (core dumped)
    
    The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
    but valgrind complains loudly about reads from and writes to uninitialized
    memory in libc. It's not a libuv bug because the test case below triggers the
    same warnings:
    
      #include <stdio.h>
      #include <stdlib.h>
      #include <sys/types.h>
      #include <unistd.h>
    
      int main(void)
      {
        setproctitle("%s", "test");
        return 0;
      }
    
    That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
  2. @bnoordhuis

    unix: avoid buffer overflow in proctitle.c

    bnoordhuis authored
    Get/set process title with uv_strlcpy(), not strncpy(). The latter won't
    zero-terminate the result if the destination buffer is too small.
  3. @indutny @bnoordhuis

    unix: move uv_set_process_title() to proctitle.c

    indutny authored bnoordhuis committed
    Use hijacking argv array to change process' title. It seems to be working fine
    on almost every platform (at least it should not break anything as it's used in
    nginx in a similar way).
Commits on Jul 10, 2012
  1. @indutny @bnoordhuis

    unix: thread: use mach semaphores on osx

    indutny authored bnoordhuis committed
Commits on Jul 4, 2012
  1. @bnoordhuis
Commits on Jul 3, 2012
  1. @bnoordhuis

    test: allow 80 ms intervals in hrtime test

    bnoordhuis authored
    The hrtimer functionality on my FreeBSD 9 system is fairly coarse, it's usually
    just over the 60 ms that we tested for before this commit.
  2. @bnoordhuis

    unix: rename linux/core.c to linux/linux-core.c

    bnoordhuis authored
    This is a back-port of commit e132075 from the master branch.
    
    Newer versions of gyp do not support files with the same basenames (example:
    core.c and linux/core.c).
    
    The nominal reason is consistency across build systems. Apparently, msbuild
    doesn't support it either.
    
    Somewhere, someplace, baby Jesus cries sad little tears...
    
    Fixes #464.
Commits on Jul 1, 2012
  1. @bnoordhuis
  2. @bnoordhuis
Commits on Jun 30, 2012
  1. @bnoordhuis

    unix: fix busy loop on unexpected tcp message

    bnoordhuis authored
    Don't start reading immediately after connecting. If the server sends a message
    and the client hasn't called uv_read_start() yet, the event loop will busy loop
    because the pending message keeps waking it up.
  2. @bnoordhuis

    test: add 'unexpected read' tcp test

    bnoordhuis authored
    Regression test that verifies that the event loop doesn't busy loop when
    the server sends a message and the client isn't reading.
Commits on Jun 29, 2012
  1. @bnoordhuis

    unix: fix EINPROGRESS busy loop

    bnoordhuis authored
    Don't make the event loop spin when connect() returns EINPROGRESS.
    
    Test case:
    
      #include "uv.h"
    
      static void connect_cb(uv_connect_t* req, int status) {
        // ...
      }
    
      int main() {
        uv_tcp_t handle;
        uv_connect_t req;
        struct sockaddr_in addr;
        addr = uv_ip4_addr("8.8.8.8", 1234); // unreachable
        uv_tcp_init(uv_default_loop(), &handle);
        uv_tcp_connect(&req, (uv_stream_t*)&handle, addr, connect_cb);
        uv_run(uv_default_loop()); // busy loops until connection times out
        return 0;
      }
    
    After EINPROGRESS, there are zero active handles and one active request. That
    in turn makes uv__poll_timeout() believe that it should merely poll, not block,
    in epoll() / kqueue() / port_getn().
    
    Sidestep that by artificially starting the handle on connect() and stopping it
    again once the TCP handshake completes / is rejected / times out.
    
    It's a slightly hacky approach because I don't want to change the ABI of the
    stable branch. I'll address it properly in the master branch.
  2. @bnoordhuis

    unix: deduplicate socket creation code in tcp.c

    bnoordhuis authored
    Incidentally fixes a rather obscure bug where uv_tcp_connect() reconnected
    and leaked a file descriptor when the handle was already busy connecting,
    handle->fd was zero (unlikely) and uv_tcp_connect() got called again.
  3. @bnoordhuis
  4. @piscisaureus

    test: fix test-gethostbyname to not use a DNS server on localhost

    piscisaureus authored
    Because, you know, not everybody has one.
  5. @bnoordhuis
  6. @bnoordhuis

    linux: don't use accept4() syscall after ENOSYS

    bnoordhuis authored
    Repeatedly calling the syscall when it's not supported has a small but
    measurable performance impact.
    
    Besides, it's a silly thing to do.
  7. @bnoordhuis

    linux: fix accept4() ENOSYS detection on i386

    bnoordhuis authored
    accept4() piggybacks on the socketcall() on i386. socketcall() has the flaw
    that it returns EINVAL instead of ENOSYS when the operation is not supported.
    
    The problem is that accept4() also returns EINVAL when its flag argument is
    invalid.
    
    Try to discern between the two failure cases to the best of our abilities.
Commits on Jun 28, 2012
  1. @piscisaureus

    windows: don't inhibit reparse behavior when non-symlink is encountered

    piscisaureus authored
    This fixes the issue that a mount point would be treated as a
    symlink, but readlink would subsequently return an NT namespaced
    path that is unusable for many purposes.
    
    This also pre-emptively fixes the problems that would arise when
    an user has a reparse point whose tag is neither
    IO_REPARSE_TAG_MOUNT_POINT nor IO_REPARSE_TAG_SYMLINK.
    
    Finally uv_lstat() will now return the correct length in st_size.
    Previously the length was computed incorrectly for relative
    symlinks, and those that had non-ascii characters in their target.
Commits on Jun 27, 2012
  1. @bnoordhuis

    unix: assume that dlopen() clobbers dlerror()

    bnoordhuis authored
    Or rather, don't assume that dlopen() does *not* clobber dlerror().
    
    Joe Ferner reports that loading libjava on OS X sets dlerror() even when
    dlopen() succeeds, which makes uv_dlopen() raise an error when it shouldn't.
    
    I haven't been able to reproduce it but it's possible that libjava clobbers
    dlerror() by trying (and failing) to load other libraries.
    
    At any rate, Joe confirmed that this patch addresses the issue.
    
    Fixes #462.
Commits on Jun 26, 2012
  1. @bnoordhuis

    unix: don't create connect req when connect() fails

    bnoordhuis authored
    Fixes a lifecycle issue where the req got created, added to the list of active
    reqs but wasn't properly activated because uv__connect() returned early.
  2. @roman-neuhauser @bnoordhuis

    unix: map ENODEV to UV_ENODEV

    roman-neuhauser authored bnoordhuis committed
    produces better error message from test-dgram-multicast-multi-process
    when run w/o network.
    
    before:
    
    === release test-dgram-multicast-multi-process ===
    Path: simple/test-dgram-multicast-multi-process
    dgram.js:287
        throw new errnoException(errno, 'addMembership');
              ^
    Error: addMembership Unknown system errno 19
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    [PARENT] Worker 9223 died. 1 dead of 3
    
    dgram.js:287
        throw new errnoException(errno, 'addMembership');
              ^
    Error: addMembership Unknown system errno 19
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    
    [PARENT] sent 'First message to send' to 224.0.0.114:12346
    dgram.js:287
    [PARENT] sent 'Second message to send' to 224.0.0.114:12346
        throw new errnoException(errno, 'addMembership');
    [PARENT] sent 'Third message to send' to 224.0.0.114:12346
              ^
    [PARENT] sendSocket closed
    [PARENT] Worker 9224 died. 2 dead of 3
    Error: addMembership Unknown system errno 19
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    [PARENT] Worker 9225 died. 3 dead of 3
    [PARENT] All workers have died.
    [PARENT] Fail
    Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js
    
    after:
    
    === release test-dgram-multicast-multi-process ===
    Path: simple/test-dgram-multicast-multi-process
    dgram.js:287
        throw new errnoException(errno, 'addMembership');
              ^
    Error: addMembership ENODEV
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    [PARENT] Worker 13141 died. 1 dead of 3
    
    dgram.js:287
        throw new errnoException(errno, 'addMembership');
              ^
    [PARENT] sent 'First message to send' to 224.0.0.114:12346
    [PARENT] sent 'Second message to send' to 224.0.0.114:12346
    [PARENT] sent 'Third message to send' to 224.0.0.114:12346
    [PARENT] sent 'Fourth message to send' to 224.0.0.114:12346
    [PARENT] sendSocket closed
    
    dgram.js:287
        throw new errnoException(errno, 'addMembership');
              ^
    Error: addMembership ENODEV
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    [PARENT] Worker 13142 died. 2 dead of 3
    Error: addMembership ENODEV
        at new errnoException (dgram.js:356:11)
        at Socket.addMembership (dgram.js:287:11)
        at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.runMain (module.js:487:10)
        at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    [PARENT] Worker 13143 died. 3 dead of 3
    [PARENT] All workers have died.
    [PARENT] Fail
    Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js
Commits on Jun 25, 2012
  1. @bnoordhuis
  2. @saghul @piscisaureus

    win: map ERROR_PRIVILEGE_NOT_HELD to UV_EPERM

    saghul authored piscisaureus committed
Commits on Jun 22, 2012
  1. @piscisaureus
  2. @piscisaureus
  3. @piscisaureus

    windows: whitespace fixes

    piscisaureus authored
  4. @bnoordhuis

    Update libuv version macro.

    bnoordhuis authored
Commits on Jun 21, 2012
  1. @piscisaureus
  2. @piscisaureus

    Make the stat benchmark run shorter

    piscisaureus authored
    Man, Windows is so slow...
Something went wrong with that request. Please try again.