summary refs log tree commit diff stats
path: root/results/classifier/gemma3:12b/kernel/1911
blob: 6094f3f82477889e87457a9e9b1ca65bdc4a6c68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
abnormal segfaults inside qemu-system-riscv64
Description of problem:
3 tests of Cockatrice segfaults in qemu-system-riscv64 emulator. This is similar to a regression of qemu-riscv64-static I reported: #1908.
But for qemu-system-riscv64, it doesn't looks like a recent regression because qemu 7.2.1 also fails.
Steps to reproduce:
To save the time on reproducing this bug, [I uploaded the zstd compressed qcow2 image to google drive](https://drive.google.com/file/d/1-2Wtmq4MlGvTLjmQ7P5vAvNlWg8--jjT/view?usp=sharing). It contains the whole environment, cockatrice source code and built tests.

The password of the root user is `archriscv`.

1. Setup Arch Linux riscv environment: https://github.com/CoelacanthusHex/archriscv-scriptlet https://github.com/felixonmars/archriscv-packages/wiki/Setup-Arch-Linux-RISC-V-using-qemu-system
2. Start it(with the commandline above, in the boot menu, choose `2:      Linux linux (fallback initramfs)`) and building cockatrice with tests in it. 
3. Run tests (/root/Cockatrice/build/tests/loading_from_clipboard/loading_from_clipboard_test, /root/Cockatrice/build/tests/carddatabase/filter_string_test, /root/Cockatrice/build/tests/carddatabase/carddatabase_test)
4. The tests segfault, which is unexpected.
Additional information:
The tests segfault at exactly the same instruction as in #1908:

```
┌──────────────────────────────────────────────────────────────────────────────┐
│  > 0x7ffff2cba928  lhu     a2,1248(a2)                                       │
│    0x7ffff2cba92c  and     a0,a0,127                                         │
│    0x7ffff2cba930  sll     a2,a2,0x7                                         │
│    0x7ffff2cba934  add     a0,a0,a2                                          │
│    0x7ffff2cba938  lui     t2,0xf8000                                        │
│    0x7ffff2cba93c  lui     a2,0xf5de2                                        │
│    0x7ffff2cba940  add     a2,a2,-1824                                       │
│    0x7ffff2cba944  sll     t2,t2,0x14                                        │
│    0x7ffff2cba948  xor     a2,a2,t2                                          │
│    0x7ffff2cba94c  sll     t2,a0,0x1                                         │
│    0x7ffff2cba950  add     a2,a2,t2                                          │
│    0x7ffff2cba954  lhu     a2,0(a2)                                          │
│    0x7ffff2cba958  sll     a0,a2,0x3                                         │
└──────────────────────────────────────────────────────────────────────────────┘
multi-thre Thread 0x7ffff2cbe0 In:                     L??   PC: 0x7ffff2cba928
(gdb) bt
#0  0x00007ffff2cba928 in  ()
```

It might suggest that 2d708164e0475064e0e2167bd73e8570e22df1e0 is not the true cause of #1908 and this bug shares the same underlying cause with #1908.

Commit 2d708164e0475064e0e2167bd73e8570e22df1e0 LGTM, although it seems that it is copied from the loongarch one and the author forgot to update [the file header](https://gitlab.com/qemu-project/qemu/-/blob/2d708164e0475064e0e2167bd73e8570e22df1e0/linux-user/riscv/target_mman.h#L1-6).