castlabs / electron-releases

castLabs Electron for Content Security
https://castlabs.com/resources/downstream/
MIT License
222 stars 41 forks source link

SIGTRAP on Manjaro Linux #165

Open jkampich1411 opened 1 year ago

jkampich1411 commented 1 year ago

The electron binary exits with SIGTRAP when starting on Manjaro Linux.

The dependency I added for electron is: https://github.com/castlabs/electron-releases#v25.4.0+wvcus

This is everything that logs:

$ ./node_modules/electron/dist/electron .
Trace/breakpoint trap (core dumped)
khwaaj commented 1 year ago

It is hard to tell the reason without some more details, can you run in a debugger or examine the core dump to see where the crash happens?

For reference: https://unix.stackexchange.com/questions/89933/how-to-view-core-files-for-debugging-purposes-in-linux/89934#89934

jkampich1411 commented 1 year ago

I'll do that once I'm back at my laptop.

Shiyukine commented 1 year ago

Hello, I have this bug too.

After futher investigation, I noticed that your electron will not work when launching it on an other Electron app (like Visual Studio Code) on the lastest Ubuntu (22.04.3 LTS), because, when I do npm start in a new gnome-shell, it works. I have not tested with other distributions. I have tested with :

On v26.0.0 and more, I have a new error with SIGTRAP :

npm start

> test@1.0.0 start
> electron .

[16187:0831/171334.248148:FATAL:zygote_host_impl_linux.cc(215)] Check failed: . : Invalid argument (22)
/home/ubuntu/test/node_modules/electron/dist/electron exited with signal SIGTRAP

When I use gdb, I have this :

npm start

> test@1.0.0 start
> gdb --args node node_modules/.bin/electron .

GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
[...]
Type "apropos word" to search for commands related to "word"...
Reading symbols from node...
(gdb) run
Starting program: /usr/bin/node node_modules/.bin/electron .
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7a3f640 (LWP 16766)]
[New Thread 0x7ffff723a640 (LWP 16768)]
[New Thread 0x7ffff6a39640 (LWP 16769)]
[New Thread 0x7ffff6238640 (LWP 16770)]
[New Thread 0x7ffff5a37640 (LWP 16771)]
[New Thread 0x7ffff520e640 (LWP 16773)]
[Detaching after fork from child process 16774]
[16774:0831/172214.643926:FATAL:zygote_host_impl_linux.cc(215)] Check failed: . : Invalid argument (22)
/home/ubuntu/test/node_modules/electron/dist/electron exited with signal SIGTRAP
[Thread 0x7ffff5a37640 (LWP 16771) exited]
[Thread 0x7ffff6238640 (LWP 16770) exited]
[Thread 0x7ffff6a39640 (LWP 16769) exited]
[Thread 0x7ffff723a640 (LWP 16768) exited]
[Thread 0x7ffff7a3f640 (LWP 16766) exited]
[Thread 0x7ffff520e640 (LWP 16773) exited]
[Inferior 1 (process 16762) exited with code 01]

When I launch ./node_modules/electron/dist/electron in the VSCode's terminal, I have 3 core dump.

[6488:0901/005508.030732:FATAL:zygote_host_impl_linux.cc(215)] Check failed: . : Invalid argument (22)
Trace/breakpoint trap (core dumped)

Here are these core dump, but they showing anything to help...

shiyukine@shiyukine-linux:/var/lib/apport/coredump$ gdb /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron core._home_shiyukine_Desktop_Workspaces_Electron_test_node_modules_electron_dist_electron.1000.a669b18f-627a-43b8-8fe3-e21692c47b62.6491.209879
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
[...]
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron...
(No debugging symbols found in /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron)
[New LWP 6491]
[New LWP 6493]
Core was generated by `/home/shiyukine/Desktop/Workspaces/Electron/test/node_modules/electron/dist/ele'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x000055d0fb2dddcb in ?? ()
[Current thread is 1 (LWP 6491)]
(gdb) quit

shiyukine@shiyukine-linux:/var/lib/apport/coredump$ gdb /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron core._home_shiyukine_Desktop_Workspaces_Electron_test_node_modules_electron_dist_electron.1000.a669b18f-627a-43b8-8fe3-e21692c47b62.6488.209873
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
[...]
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron...
(No debugging symbols found in /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron)
[New LWP 6488]
[New LWP 6489]
Core was generated by `/home/shiyu'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x000055bdd9af5fc6 in ?? ()
[Current thread is 1 (LWP 6488)]
(gdb) quit

shiyukine@shiyukine-linux:/var/lib/apport/coredump$ gdb /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron core._home_shiyukine_Desktop_Workspaces_Electron_test_node_modules_electron_dist_electron.1000.a669b18f-627a-43b8-8fe3-e21692c47b62.6492.209880
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
[...]
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron...
(No debugging symbols found in /home/shiyukine/Desktop/Workspaces/Electron/AyMusic-Electron/node_modules/electron/dist/electron)
[New LWP 1]
[New LWP 2]
Core was generated by `/home/shiyukine/Desktop/Workspaces/Electron/test/node_modules/electron/dist/ele'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x0000565244344dcb in ?? ()
[Current thread is 1 (LWP 1)]
(gdb) quit

I did the same test with Electron not modified, I can launch electron in VSCode.

I can launch your Electron in VSCode only if I put theses args : --no-sandbox --disable-gpu-sandbox, but I have a white screen because the GPU is disabled. If I remove one of these arg, app will not work.

How to repro the bug:

Note: sorry for my bad English.

jkampich1411 commented 1 year ago

Oh, sorry, I very much forgot that I opened this issue.

This happens when I use gdb:

(gdb) run
Starting program: /home/[redacted]/our-spotify/node_modules/electron/dist/electron .
[Thread debugging using libthread_db enabled]                                                                                                                                              
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff17ff6c0 (LWP 50588)]                                                                                                                                                    
[Detaching after fork from child process 50589]
[Detaching after fork from child process 50590]
[Detaching after fork from child process 50591]

Thread 1 "electron" received signal SIGTRAP, Trace/breakpoint trap.
0x000055555a32f0a0 in ?? ()
(gdb)

I can confirm that it runs for me as well with --no-sandbox --disable-gpu-sandbox and in a Terminal that is not VSCode.

khwaaj commented 1 year ago

This seems to be some kind of problem related to the zygote process (a process that launches other processes), at least that is what the failing check above is about. Can you try with the arguments --no-sandbox --no-zygote?

jkampich1411 commented 1 year ago

It works with --no-zygote

Shiyukine commented 1 year ago

I can confirm that it works with --no-sandbox --no-zygote.