Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in GetInterfaceAddresses #4272

Closed

Conversation

martinbark
Copy link
Contributor

If uv_interface_addresses() returns UV_ENOSYS then interfaces and count are
uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[]. Fix
the issue by returning from GetInterfaceAddresses on the UV_ENOSYS error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

I have submitted a pull request to libuv to fix uClibc-ng support, see libuv/libuv#653.

Also, see https://bugs.busybox.net/show_bug.cgi?id=8296 for further details on
the origins of this bug.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 14, 2015

LGTM

@mscdex mscdex added the os Issues and PRs related to the os subsystem. label Dec 14, 2015
@mscdex
Copy link
Contributor

mscdex commented Dec 14, 2015

LGTM

@cjihrig
Copy link
Contributor

cjihrig commented Dec 14, 2015

@saghul
Copy link
Member

saghul commented Dec 14, 2015

LGTM.

@jasnell
Copy link
Member

jasnell commented Dec 14, 2015

LGTM.

One small nit tho: can you please update the commit log message to fit the style guidelines described here: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit

If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
@martinbark martinbark force-pushed the fix-GetInterfaceAddresses-crash branch from 26abefb to 98e8f50 Compare December 14, 2015 21:38
@martinbark
Copy link
Contributor Author

Sorry about that, I just updated the commit message, hope that's OK now.

BTW, forgot to say this issue is in all versions of node after 0.12.0

@trevnorris
Copy link
Contributor

Any hold up here?

@cjihrig
Copy link
Contributor

cjihrig commented Dec 30, 2015

rvagg pushed a commit that referenced this pull request Jan 4, 2016
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
PR-URL: #4272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
@rvagg
Copy link
Member

rvagg commented Jan 4, 2016

Only CI error wasn't fatal to tests and is purely Jenkins related. Change LGTM. Landed @ 028194b.

Thanks for hunting this one down and submitting a fix @martinbark. I believe this is your first commit to core, welcome on board, I hope you find other ways to contribute!

@rvagg rvagg closed this Jan 4, 2016
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Jan 6, 2016
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
PR-URL: nodejs#4272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
MylesBorins pushed a commit that referenced this pull request Jan 13, 2016
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
PR-URL: #4272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
PR-URL: #4272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
@MylesBorins MylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count
are uninitialised. This can cause a segmentation fault inside
GetInterfaceAddresses when it tries to use the invalid interfaces[].
Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS
error.

This issue was observed when using uCLibc-ng version 1.0.9 because
uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly
undefines HAVE_IFADDRS_H.

Signed-off-by: Martin Bark <martin@barkynet.com>
PR-URL: nodejs#4272
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os Issues and PRs related to the os subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants