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

deps: V8: workaround for darwin arm64 code page decommit failures #37276

Closed
wants to merge 2 commits into from

Conversation

matinzd
Copy link
Contributor

@matinzd matinzd commented Feb 8, 2021

Original commit from v8 repo:

[mac][wasm] Work around MacOS 11.2 code page decommit failures

MacOS 11.2 refuses to set "no access" permissions on memory that
we previously used for JIT-compiled code. It is still unclear
whether this is WAI on the part of the kernel. In the meantime,
as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
of mprotect(..., NONE) when discarding code pages. This is inspired
by what Chromium's gin platform does.

Fixed: v8:11389
Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72559}

Fixes #37061
Ref: https://bugs.chromium.org/p/v8/issues/detail?id=11389#c18

For test:

./node crash.js
{"exports":[],"reexports":[]}

[mac][wasm] Work around MacOS 11.2 code page decommit failures

MacOS 11.2 refuses to set "no access" permissions on memory that
we previously used for JIT-compiled code. It is still unclear
whether this is WAI on the part of the kernel. In the meantime,
as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
of mprotect(..., NONE) when discarding code pages. This is inspired
by what Chromium's gin platform does.

Fixed: v8:11389
Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72559}


Related issue
nodejs#37061
@nodejs-github-bot nodejs-github-bot added the v8 engine Issues and PRs related to the V8 dependency. label Feb 8, 2021
@nodejs-github-bot

This comment has been minimized.

@aduh95
Copy link
Contributor

aduh95 commented Feb 8, 2021

Thanks for sending this. Pinging @nodejs/v8 for reviews.

@nodejs-github-bot
Copy link
Collaborator

@AshCripps
Copy link
Member

Take this with a pinch of salt as the job isnt fully ready yet but running this PR on our DTKs - https://ci.nodejs.org/job/node-test-commit-osx-arm/nodes=osx11/32/console

@AshCripps
Copy link
Member

Take this with a pinch of salt as the job isnt fully ready yet but running this PR on our DTKs - https://ci.nodejs.org/job/node-test-commit-osx-arm/nodes=osx11/32/console

The failure is tracked here - #36656

@matinzd
Copy link
Contributor Author

matinzd commented Feb 8, 2021

Take this with a pinch of salt as the job isnt fully ready yet but running this PR on our DTKs - https://ci.nodejs.org/job/node-test-commit-osx-arm/nodes=osx11/32/console

The failure is tracked here - #36656

The referenced issue still exists.

✗ ./node --prof  
[1]    55990 segmentation fault  ./node --prof

@matinzd matinzd changed the title deps: V8: Workaround for MacOS 11.2 code page decommit failures deps: V8: workaround for MacOS 11.2 code page decommit failures, fixes prof segmentation fault Feb 8, 2021
@matinzd matinzd changed the title deps: V8: workaround for MacOS 11.2 code page decommit failures, fixes prof segmentation fault deps: V8: workaround for darwin arm64 code page decommit failures, fixes prof segmentation fault Feb 8, 2021
@AshCripps
Copy link
Member

@matinzd can you remove 24d561a that hasn't landed in V8 yet so blocks this PR from landing. Also can you refer to the Maintaining V8 guide and bump the v8_embedder_string in common.gypi please.

@matinzd matinzd changed the title deps: V8: workaround for darwin arm64 code page decommit failures, fixes prof segmentation fault deps: V8: workaround for darwin arm64 code page decommit failures Feb 9, 2021
@matinzd
Copy link
Contributor Author

matinzd commented Feb 9, 2021

@matinzd can you remove 24d561a that hasn't landed in V8 yet so blocks this PR from landing. Also can you refer to the Maintaining V8 guide and bump the v8_embedder_string in common.gypi please.

Done

@targos
Copy link
Member

targos commented Feb 11, 2021

Thanks for the PR! I'll land it as soon as someone else approves it.

targos pushed a commit that referenced this pull request Feb 11, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: #37061
PR-URL: #37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
@targos
Copy link
Member

targos commented Feb 11, 2021

Landed in 6ea9af9

@targos targos closed this Feb 11, 2021
targos pushed a commit to targos/node that referenced this pull request Feb 11, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit to targos/node that referenced this pull request Feb 11, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit to targos/node that referenced this pull request Feb 12, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit to targos/node that referenced this pull request Feb 12, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
@matinzd matinzd deleted the patch-1 branch February 12, 2021 22:08
danielleadams pushed a commit that referenced this pull request Feb 16, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: #37061
PR-URL: #37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
This was referenced Feb 16, 2021
targos pushed a commit to targos/node that referenced this pull request Feb 23, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit to targos/node that referenced this pull request Feb 24, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit that referenced this pull request Feb 24, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: #37061
PR-URL: #37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
a60814billy pushed a commit to a60814billy/node that referenced this pull request Apr 2, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
a60814billy pushed a commit to a60814billy/node that referenced this pull request Apr 2, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: v8/v8@0c8b6e4
Fixes: nodejs#37061
PR-URL: nodejs#37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
targos pushed a commit that referenced this pull request Apr 11, 2021
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Backport-PR-URL: #38051
Co-authored-by: BoHong Li <a60814billy@gmail.com>

Refs: v8/v8@0c8b6e4
Fixes: #37061
PR-URL: #37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
@targos targos removed their assignment Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS 11.2: Fatal error Check failed: allocator->SetPermissions
5 participants