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

fs.realpath.native causes SIGABRT on darwin when the realpath is really long #34900

Closed
ashi009 opened this issue Aug 24, 2020 · 5 comments
Closed
Labels
libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.

Comments

@ashi009
Copy link

ashi009 commented Aug 24, 2020

  • Version: v12.12.0 and v14.8.0
  • Platform: Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64
  • Subsystem: fs

What steps will reproduce the bug?

$ LONG_PATH='/tmp/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/path/254B'
$ SHORT_LINK='/tmp/short'
$ mkdir -p "${LONG_PATH}"
$ ln -s "${LONG_PATH}" "${SHORT_LINK}"
$ node -e "fs.realpathSync.native('${SHORT_LINK}/file-not-exist')"
node(60274,0x10eabedc0) malloc: Incorrect checksum for freed object 0x104805aa0: probably modified after being freed.
Corrupt value: 0x7473697865
node(60274,0x10eabedc0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6

How often does it reproduce? Is there a required condition?

Almost every time.

What is the expected behavior?

return ENOENT.

What do you see instead?

Crash with SIGABRT

Additional information

The bug is confirmed by the libuv and the patch is underway: libuv/libuv#2965

@bnoordhuis
Copy link
Member

After the patch, the buffer overrun threshold should be 1025 on darwin

To clarify: there's no buffer overrun anymore after libuv/libuv#2965 lands because paths are never > 1024 on that platform.

The problem was that libuv was using the wrong constant, one that was considerably smaller.

@ashi009
Copy link
Author

ashi009 commented Aug 24, 2020

After the patch, the buffer overrun threshold should be 1025 on darwin

To clarify: there's no buffer overrun anymore after libuv/libuv#2965 lands because paths are never > 1024 on that platform.

The problem was that libuv was using the wrong constant, one that was considerably smaller.

Correct, I'll scratch the last bit.

@silverwind silverwind added macos Issues and PRs related to the macOS platform / OSX. libuv Issues and PRs related to the libuv dependency or the uv binding. labels Aug 25, 2020
@bnoordhuis
Copy link
Member

This was fixed by the libuv upgrade in #34915 and is scheduled for release today, see #34852.

I don't know exactly when it'll be back-ported to v12.x and v10.x, that's up to the @nodejs/releasers.

@richardlau
Copy link
Member

The libuv update from #34915 went out in Node.js 12.19.0 (#35401).

@richardlau
Copy link
Member

At this late stage it's very unlikely libuv will be updated again in Node.js 10.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

No branches or pull requests

5 participants