Repository: node
Issue: Fatal error on setting memory permissions (`Fatal error... Check failed: 12 == (*__errno_location ())`)
Labels: v8 engine

### Version

v23.0.0

### Platform

```text
Linux ... 6.6.13-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jan 20 18:03:28 UTC 2024 x86_64 GNU/Linux
```


### Subsystem

_No response_

### What steps will reproduce the bug?

By repeatedly running Node, as simply installing dependencies of a project through the command `node $(which npm) install` in a while loop (see the script used for testing [here](https://gitlab.cern.ch/gdeblasi/node-v23-v8fatal/-/blob/wip-default-runners/.gitlab-ci.yml?ref_type=heads#L11)).

For instance:

```
RETRIES=100
COUNT=0
NPM=$(which npm)

while [ $COUNT -lt $RETRIES ]; do
  node $NPM install
  COUNT=$((COUNT + 1))
done
```

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

Very often on specific platforms such as the one shown above.

### What is the expected behavior? Why is that the expected behavior?

Node should not fail and crash.

### What do you see instead?

At same point Node crashes giving the following error, extracted from [here](https://gitlab.cern.ch/gdeblasi/node-v23-v8fatal/-/jobs/45065031#L572):

```
# Fatal error in , line 0
# Check failed: 12 == (*__errno_location ()).
#
#
#
#FailureMessage Object: 0x7ffc54684900
----- Native stack trace -----
1: 0x107e621  [node]
 2: 0x2aba423 V8_Fatal(char const*, ...) [node]
 3: 0x2ac5066 v8::base::OS::SetPermissions(void*, unsigned long, v8::base::OS::MemoryPermission) [node]
 4: 0x14c1bfc v8::internal::CodeRange::InitReservation(v8::PageAllocator*, unsigned long) [node]
 5: 0x155982f v8::internal::Heap::SetUp(v8::internal::LocalHeap*) [node]
 6: 0x149ac92 v8::internal::Isolate::Init(v8::internal::SnapshotData*, v8::internal::SnapshotData*, v8::internal::SnapshotData*, bool) [node]
 7: 0x19ee994 v8::internal::Snapshot::Initialize(v8::internal::Isolate*) [node]
 8: 0x1315af6 v8::Isolate::Initialize(v8::Isolate*, v8::Isolate::CreateParams const&) [node]
 9: 0xed9a18 node::NewIsolate(v8::Isolate::CreateParams*, uv_loop_s*, node::MultiIsolatePlatform*, node::SnapshotData const*, node::IsolateSettings const&) [node]
10: 0x1043a6d node::NodeMainInstance::NodeMainInstance(node::SnapshotData const*, uv_loop_s*, node::MultiIsolatePlatform*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) [node]
11: 0xf95806 node::Start(int, char**) [node]
12: 0x7feb3293a24a  [/lib/x86_64-linux-gnu/libc.so.6]
13: 0x7feb3293a305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
14: 0xecff4e _start [node]
/scripts-195672-45065031/step_script: line 172:   884 Trace/breakpoint trap   (core dumped) node $NPM install
```

### Additional information

Similar issue https://github.com/nodejs/help/issues/4465.

The output of `strace` can be found [here](https://gitlab.cern.ch/gdeblasi/node-v23-v8fatal/-/jobs/45065894/artifacts/raw/public/strace.log).