Repository: vscode
Issue: Node unconditionally uses AVX512 instructions  (illegal instruction starting Extension Host agent)
Labels: bug,upstream,extension-host,upstream-issue-linked,electron-29-update

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 
Seeing this both on release and on insiders: 

Release: 

Version: 1.90.0 (Universal)
Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573

Inisders: 

Version: 1.91.0-insider (Universal)
Commit: 6facfe23b300eb448c35d07291cad7ad98625302

- OS Version: Host is macOS, Remote system is Ubuntu 24

Steps to Reproduce:

1. Use Remote Extension to open window on Ubuntu 24, on a AMD machine with AVX-512 disabled as a boot parameter

Result: Extension host crashes immediately:

```
[10:51:37.003] [server] [10:51:36] Extension host agent started.
[10:51:37.032] [server] [10:51:37] [<unknown>][d99d6c11][ManagementConnection] New connection established.
[10:51:37.039] [server] [10:51:37] [<unknown>][0be45ac4][ExtensionHostConnection] New connection established.
[10:51:37.081] [server] [10:51:37] [<unknown>][0be45ac4][ExtensionHostConnection] <3493> Launched Extension Host Process.
[10:51:37.874] [server] Illegal instruction (core dumped)
```

The node backtrace here is: 

```
(gdb) bt 
#0  0x0000000001f9f093 in base64_stream_encode_avx512 ()
#1  0x0000000001f92614 in base64_encode ()
#2  0x0000000000dc2965 in node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*) [clone .part.0] ()
#3  0x0000000000c778bf in void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)2>(v8::FunctionCallbackInfo<v8::Value> const&) ()
#4  0x0000000000f328df in v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) ()
#5  0x0000000000f3314d in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) ()
#6  0x0000000000f33615 in v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) ()
#7  0x000000000193cdf6 in Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit ()
#8  0x00000000018aed1c in Builtins_InterpreterEntryTrampoline ()
#9  0x00000e00281804e9 in ?? ()
#10 0x00003d3db84f8191 in ?? ()
#11 0x0000000700000000 in ?? ()
#12 0x00000e00281805b9 in ?? ()
#13 0x00003e25859eefa9 in ?? ()
#14 0x0000000000000000 in ?? ()
```

This machine is AMD Ryzen Threadripper PRO 7975WX, but for compatibility with https://pernos.co/, I've explicitly disabled AVX-512 by adding `clearcpuid=304` to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub`

As you can see, AVX512 isn't listed in the /proc/cpuinfo: 

```
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi umip pku ospke rdpid overflow_recov succor smca fsrm flush_l1d debug_swap
bugs		: sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass srso
```

This bug is similar to https://github.com/microsoft/vscode/issues/180843