Title: clock_time_get rejects valid WASI pointer arguments >= 0x80000000(2G) · Issue #62671 · nodejs/node · GitHub
Open Graph Title: clock_time_get rejects valid WASI pointer arguments >= 0x80000000(2G) · Issue #62671 · nodejs/node
X Title: clock_time_get rejects valid WASI pointer arguments >= 0x80000000(2G) · Issue #62671 · nodejs/node
Description: Version v24.14.1 Platform Darwin XQ4PWYXX93 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64 Subsystem wasi What steps will reproduce the bug? Run this with node repro.m...
Open Graph Description: Version v24.14.1 Platform Darwin XQ4PWYXX93 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64 Subsystem wasi What steps will repro...
X Description: Version v24.14.1 Platform Darwin XQ4PWYXX93 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64 Subsystem wasi What steps will repro...
Opengraph URL: https://github.com/nodejs/node/issues/62671
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"clock_time_get rejects valid WASI pointer arguments >= 0x80000000(2G)","articleBody":"\n**Version**\n\n`v24.14.1`\n\n**Platform**\n\n```text\nDarwin XQ4PWYXX93 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64\n```\n\n**Subsystem**\n\n`wasi`\n\n**What steps will reproduce the bug?**\n\nRun this with `node repro.mjs`(or run `node reproduce.mjs` in \nhttps://github.com/hardfist/node-wasi-2gb-bug and this is the cause of Rspack CI failure https://github.com/web-infra-dev/rspack/actions/runs/24226483089/job/70729993137?pr=13655#step:13:104\n\n```js\nimport { WASI } from 'node:wasi';\n\nconst wasm = Buffer.from(\n 'AGFzbQEAAAABDwNgA39+fwF/YAABf2AAAAIpARZ3YXNpX3NuYXBzaG90X3ByZXZpZXcxDmNsb2NrX3RpbWVfZ2V0AAADBQQBAQECBQUBAIGAAgdHBQZtZW1vcnkCAA50ZXN0X2Nsb2NrX2xvdwABDnRlc3RfY2xvY2tfbWlkAAIPdGVzdF9jbG9ja19oaWdoAAMGX3N0YXJ0AAQKMwQMAEEAQsCEPUEAEAALEABBAELAhD1B8P///wcQAAsQAEEAQsCEPUGAgICAeBAACwIACw==',\n 'base64',\n);\n\nconst wasi = new WASI({ version: 'preview1' });\nconst module = await WebAssembly.compile(wasm);\nconst instance = await WebAssembly.instantiate(module, {\n wasi_snapshot_preview1: wasi.wasiImport,\n});\n\ntry {\n wasi.start(instance);\n} catch {}\n\nfor (const [label, fn] of [\n ['0x00000000', () => instance.exports.test_clock_low()],\n ['0x7FFFFFF0', () => instance.exports.test_clock_mid()],\n ['0x80000000', () => instance.exports.test_clock_high()],\n]) {\n const errno = fn();\n console.log(`${label}: errno=${errno}`);\n}\n```\n\nThis embeds a tiny WASM module that:\n\n- imports `wasi_snapshot_preview1.clock_time_get`\n- allocates `32769` pages of memory (`2GB + 64KB`)\n- calls `clock_time_get` with result pointers `0x00000000`, `0x7FFFFFF0`, and `0x80000000`\n\n**How often does it reproduce? Is there a required condition?**\n\nIt reproduces every time for me on `v24.14.1` when the WASI function receives an `i32` argument with the high bit set, such as pointer `0x80000000`, and the module has enough linear memory for that offset. The repro needs about 2GB of free RAM because the module allocates `32769` pages.\n\n**What is the expected behavior? Why is that the expected behavior?**\n\nAll three calls should succeed:\n\n```text\n0x00000000: errno=0\n0x7FFFFFF0: errno=0\n0x80000000: errno=0\n```\n\n`0x80000000` is a valid in-bounds offset for a `32769`-page memory, and WASI pointer parameters are 32-bit offsets. Node should accept the full 32-bit bit-pattern range for these arguments and then rely on the existing memory bounds checks to reject only truly out-of-bounds accesses.\n\n**What do you see instead?**\n\nThe third call returns `EINVAL` (`28`) even though the pointer is within bounds:\n\n```text\n0x00000000: errno=0\n0x7FFFFFF0: errno=0\n0x80000000: errno=28\n```\n\n**Additional information**\n\nI traced this to the WASI slow callback path in [`src/node_wasi.cc`](https://github.com/nodejs/node/blob/main/src/node_wasi.cc).\n\n`CheckType\u003cuint32_t>()` currently does:\n\n```cpp\ntemplate \u003c>\nbool CheckType\u003cuint32_t>(Local\u003cValue> value) {\n return value->IsUint32();\n}\n```\n\nBut when Wasm passes `i32.const 0x80000000`, V8 appears to surface that value to the JS-facing slow callback as the Number `-2147483648`. That fails `IsUint32()`, so `SlowCallback()` returns `UVWASI_EINVAL` before the syscall implementation runs.\n\n`ConvertType\u003cuint32_t>()` in the same file already does:\n\n```cpp\ntemplate \u003c>\nuint32_t ConvertType(Local\u003cValue> value) {\n return value.As\u003cUint32>()->Value();\n}\n```\n\nSo this looks like a validation mismatch rather than a conversion or bounds-checking issue. If I am reading the code correctly, `CheckType\u003cuint32_t>()` probably needs to accept the signed JS representation that Wasm `i32` values can take when the high bit is set, or otherwise validate these parameters in a way that is not sensitive to JS signedness.\n","author":{"url":"https://github.com/hardfist","@type":"Person","name":"hardfist"},"datePublished":"2026-04-10T14:08:58Z","url":"https://github.com/nodejs/node/issues/62671"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0ab7af8d-08c4-8b6a-c1e5-f3cf4273c407 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C40C:C397B:141BA5:19CF07:6B0339AE |
| html-safe-nonce | 3f1ec4eba67462cb63be335dc56ccd7f9c5f68d3da80af7c5c2059eb8fc436bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDBDOkMzOTdCOjE0MUJBNToxOUNGMDc6NkIwMzM5QUUiLCJ2aXNpdG9yX2lkIjoiMjIxOTMzODEwMDQ3MDEzNTIxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cb80c928a4abf1716dbf17c1f369d1b085ed07b5c3ebdfa14066395a8b82b361 |
| hovercard-subject-tag | issue:4239691887 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62671/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e1e43590a0f867618b7dd77a8abec17d97bc6bdb640fbb9595f6ef135afc7390/nodejs/node/issues/62671 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e1e43590a0f867618b7dd77a8abec17d97bc6bdb640fbb9595f6ef135afc7390/nodejs/node/issues/62671 |
| og:image:alt | Version v24.14.1 Platform Darwin XQ4PWYXX93 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64 Subsystem wasi What steps will repro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hardfist |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width