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

Bun Segfault on old x86_64 CPUs #11626

Closed
Teddy-Kun opened this issue Jun 5, 2024 · 1 comment
Closed

Bun Segfault on old x86_64 CPUs #11626

Teddy-Kun opened this issue Jun 5, 2024 · 1 comment
Labels
bug Something isn't working needs triage

Comments

@Teddy-Kun
Copy link

What version of Bun is running?

1.1.12+43f0913c3

What platform is your computer?

Linux 6.1.0-17-cloud-amd64 x86_64 unknown

What steps can reproduce the bug?

Run Bun on an old x86 CPU (we used x86_64v1) or use the qemu64 CPU.

Execute bun run example.ts with the following file

import { readFileSync } from 'node:fs';

try {
        const buffer = readFileSync('./index.ts');
        console.log("read");
        const f = buffer.toString('utf8');
        console.log(String(f));
} catch (err) {
        console.error(err);
}

What is the expected behavior?

At least one of the following:

  • Warn when running on an unsupported x86_64 version
  • Refuse to install from on an unsupported x86_64 version
  • Refuse to run on an unsupported x86_64 version

What do you see instead?

Memory Leak + Segmetation Fault

Additional information

This was discovered when using Coder to spin up a VM in Proxmox. Without configuring anything the CPUs type was set to qemu64, which had fewer available instructions, than the host CPU. After setting the type to host bun worked as expected. To me it seemed that qemu64 is equivalent to x86_64v1. The host CPU supports x86_64v3.

I assume Bun is being compiled for either x86_64v2 or v3 and thus an illegal instruction caused a segmentation fault. If that is how your binaries are build I would suggest checking for the CPUs instructionset and at least showing a warning when executing bun, but my recommendation would be refusing to install it from the script and instructing to compiling it from source instead.

Note: This was also reproduced in the latest canary version.

@Teddy-Kun Teddy-Kun added bug Something isn't working needs triage labels Jun 5, 2024
@Jarred-Sumner
Copy link
Collaborator

Duplicate of #3312

@Jarred-Sumner Jarred-Sumner marked this as a duplicate of #3312 Jun 6, 2024
@Jarred-Sumner Jarred-Sumner closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants