Package: nodejs
Version: 18.12.1+dfsg-2+0.riscv64.1
Severity: grave
Justification: renders package unusable
X-Debbugs-Cc: davidventura27+deb...@gmail.com

Dear Maintainer,

   * What led up to the situation?

Trying to execute nodejs in any condition under riscv64.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

I ran `nodejs --help`, but the problem is not limited to the `--help` flag.

   * What was the outcome of this action?

A segmentation fault:
```
root@debian:~/checkout# node --help                                             
                                                                                
                                                                                
                                                                    [159/1912]
Segmentation fault (core dumped)                                                
                                                                                
                                                                                
                                                                              
```


   * What outcome did you expect instead?

Nodejs would execute.

   * Extra notes:

I am testing riscv64 inside qemu:

```
qemu-system-riscv64 -machine virt -cpu sifive-u54 -smp 4 -m 2G -device 
virtio-blk-device,drive=hd -drive file=overlay.qcow2,if=none,id=hd -bios 
/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf -kernel 
/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -object 
rng-random,filename=/dev/urandom,id=rng -device virtio-rng-device,rng=rng 
-append root=LABEL=rootfs console=ttyS0,115200 -netdev 
type=tap,id=net,ifname=tap0,vhost=on -device virtio-net-pci,netdev=net 
-nographic
```

Nodejs version (from unreleased/main)

```
root@debian:~/checkout# apt-cache policy nodejs                                 
                                                                                
                                                                                
                                                                              
nodejs:                                                                         
                                                                                
                                                                                
                                                                              
  Installed: 18.12.1+dfsg-2+0.riscv64.1                                         
                                                                                
                                                                                
                                                                              
  Candidate: 18.12.1+dfsg-2+0.riscv64.1
  Version table:
 *** 18.12.1+dfsg-2+0.riscv64.1 500
        500 http://deb.debian.org/debian-ports unreleased/main riscv64 Packages 
        100 /var/lib/dpkg/status
```

Configured cpuinfo:
```
root@debian:~/checkout# cat /proc/cpuinfo 
processor       : 0
hart            : 0
isa             : rv64imafdc
mmu             : sv57

processor       : 1
hart            : 1
isa             : rv64imafdc
mmu             : sv57

processor       : 2
hart            : 2
isa             : rv64imafdc
mmu             : sv57

processor       : 3
hart            : 3
isa             : rv64imafdc
mmu             : sv57
```

Captured backtrace with gdb:

```
root@debian:~/checkout# gdb node -c /tmp/core-node.17623.debian.1670493754      
                                                                               
GNU gdb (Debian 12.1-4) 12.1                                                    
                                                                               
Reading symbols from node...                                                    
                                                                               
(No debugging symbols found in node)                              
[New LWP 17623]                                                                 
                                                                               
[New LWP 17624]                                                                 
                                                                               
[New LWP 17625]                                        
[New LWP 17627]                                                                 
                                                                               
[New LWP 17626]                     
[New LWP 17628]                                                  
[Thread debugging using libthread_db enabled]                                   
                                                                               
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".
Core was generated by `node --help'.                                        
Program terminated with signal SIGSEGV, Segmentation fault.                  
#0  0x00ffffff99fcdab2 in 
v8::internal::Code::RelocateFromDesc(v8::internal::ByteArray, 
v8::internal::Heap*, v8::internal::CodeDesc const&) () from 
/lib/riscv64-linux-gnu/libnode.so.108
[Current thread is 1 (Thread 0xffffff98acaec0 (LWP 17623))]                     
                                                                               
(gdb) bt                                                                        
                                                                               
#0  0x00ffffff99fcdab2 in 
v8::internal::Code::RelocateFromDesc(v8::internal::ByteArray, 
v8::internal::Heap*, v8::internal::CodeDesc const&) () from 
/lib/riscv64-linux-gnu/libnode.so.108
#1  0x00ffffff99e9d980 in 
v8::internal::Factory::CodeBuilder::BuildInternal(bool) () from 
/lib/riscv64-linux-gnu/libnode.so.108
#2  0x00ffffff99d6538e in 
v8::internal::baseline::BaselineCompiler::Build(v8::internal::LocalIsolate*) () 
from /lib/riscv64-linux-gnu/libnode.so.108
#3  0x00ffffff99d74296 in 
v8::internal::GenerateBaselineCode(v8::internal::Isolate*, 
v8::internal::Handle<v8::internal::SharedFunctionInfo>) () from 
/lib/riscv64-linux-gnu/libnode.so.108
#4  0x00ffffff99db66f6 in 
v8::internal::Compiler::CompileSharedWithBaseline(v8::internal::Isolate*, 
v8::internal::Handle<v8::internal::SharedFunctionInfo>, 
v8::internal::Compiler::ClearExceptionFlag, v8::internal::IsCompiledScope*) () 
from /lib/riscv64-linux-gnu/libnode.so.108
#5  0x00ffffff99db6b7a in 
v8::internal::Compiler::CompileBaseline(v8::internal::Isolate*, 
v8::internal::Handle<v8::internal::JSFunction>, 
v8::internal::Compiler::ClearExceptionFlag, v8::internal::IsCompiledScope*) () 
from /lib/riscv64-linux-gnu/libnode.so.108
#6  0x00ffffff99d63a5a in 
v8::internal::baseline::BaselineBatchCompiler::CompileBatch(v8::internal::Handle<v8::internal::JSFunction>)
 () from /lib/riscv64-linux-gnu/libnode.so.108
#7  0x00ffffff99e5b1b2 in 
v8::internal::TieringManager::OnInterruptTick(v8::internal::Handle<v8::internal::JSFunction>)
 () from /lib/riscv64-linux-gnu/libnode.so.108
#8  0x00ffffff9a1b7a70 in 
v8::internal::Runtime_BytecodeBudgetInterruptWithStackCheck(int, unsigned 
long*, v8::internal::Isolate*) () from /lib/riscv64-linux-gnu/libnode.so.108
#9  0x00ffffff99bf68dc in ?? () from /lib/riscv64-linux-gnu/libnode.so.108
(gdb)                                                                           
                                                                                
                                                                                
                                                                              

```

This is _likely_ unrelated, but I faced a "similar" (stack-related issues) bug 
with golang, patch:

https://go-review.googlesource.com/c/go/+/409055/6/src/runtime/lfstack_64bit.go#40

bug report:

https://github.com/golang/go/issues/54104

Thanks,
David


-- System Information:
Debian Release: bookworm/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: riscv64

Kernel: Linux 6.0.0-5-riscv64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=C.UTF-8 (charmap=locale: Cannot set 
LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nodejs depends on:
ii  libc6       2.36-6
ii  libnode108  18.12.1+dfsg-2+0.riscv64.1

Versions of packages nodejs recommends:
ii  ca-certificates  20211016
ii  nodejs-doc       18.12.1+dfsg-2+0.riscv64.1

Versions of packages nodejs suggests:
pn  npm  <none>

-- debconf information excluded

Reply via email to