You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On linux, the assumption that file descriptors 0 - 2 belong to stdio
is not correct. They do by default, but they can be closed by the shell at
program launch.
For example, it is possible for someone to use 2>&- on the program command
line, which closes STDERR when running.
This can trigger an abort in libuv due to the assertion fd > STDERR_FILENO in
uv__close.
The issue occurs because closing STDERR will make file descriptor 2 the
next lowest available file descriptor, which will be consumed by epoll_create1()
in the call trace
… stdio (libuv#4558)
File descriptors 0 to 2 are used by stdio by default, but are not guaranteed
to be in use by stdio, in which case one or more of them may get used by libuv.
For example, STDERR can be closed by passing 2>&- on the program command line
in the shell. In which case, the file descriptor 2 would be used by libuv
libuv should handle this case without aborting
On linux, the assumption that file descriptors 0 - 2 belong to stdio
is not correct. They do by default, but they can be closed by the shell at
program launch.
For example, it is possible for someone to use 2>&- on the program command
line, which closes STDERR when running.
This can trigger an abort in libuv due to the assertion fd > STDERR_FILENO in
uv__close.
This can be readily reproduced using the helloworld/main.c example at
#https://docs.libuv.org/en/v1.x/guide/basics.html
The issue occurs because closing STDERR will make file descriptor 2 the
next lowest available file descriptor, which will be consumed by epoll_create1()
in the call trace
uv_loop_init
-> uv__platform_loop_init
-> epoll_create1
Since 2 i now the next lowest unused file descriptor, epoll_create1 will
return 2.
Then,
uv_loop_close
-> uv__close
will fail the assert in uv__close when this file descriptor is passed
There may be other paths for which this can occur, but this appears
to likely be the most common.
The text was updated successfully, but these errors were encountered: