Bug 224134

Summary: Webkit constantly crashes on RISC-V 64
Product: WebKit Reporter: Miroslav <lakotamm>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: berto, bugs-noreply, clopez, pierceandjelkovic, smoley
Priority: P2 Keywords: DoNotImportToRadar
Version: Other   
Hardware: Unspecified   
OS: Linux   

Description Miroslav 2021-04-02 15:27:23 PDT
I am testing Epiphany on emulated riscv64 and I am experiencing pretty much constant crashes when browsing. The crash often occurs when the website is already displayed and almost done loading. It is repeatedly consistent on a website, however it is not consistent across different websites.

OS: Debian GNU/Linux bullseye/sid riscv64 
Host: riscv-virtio,qemu
Kernel: 5.10.0-5-riscv64
CPU: (8)
Memory: 175MiB / 3941MiB

Tested Epiphany versions:
- 3.38.2-1 (Debian unstable)
- 40.0-2 (Debian experimental branch)
- 40.0 (Compiled from source, Master, commit f094cd170fa4f23ec6a8c756cfbc2b2ca042cd55)

Tested WebKitGTK versions:
webkit2gtk-driver 2.32.0-1 and 2.30.6-1
libwebkit2gtk-4.0-dev 2.32.0-1 and 2.30.6-1
libwebkit2gtk-4.0-37 2.32.0-1 and 2.30.6-1

Behavior is the same in all tested versions.

Crash logs:

Both websites were visited 3 times in a row.

Tested webpage: [https://www.gnome.org/](https://www.gnome.org/)
The content was displayed before crash.

miroslav@debian:~/epiphany/build$ epiphany
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3fa14eb138: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3fa14eef70, 0x3fa14f2ba0, 0x3fa14b9118, undef:i64
  0x3fa14f2ba0: i64 = sub Constant:i64<0>, 0x3fa14eadf8
    0x3fa14bb128: i64 = Constant<0>
    0x3fa14eadf8: i64 = and 0x3fa14eb068, Constant:i64<1>
      0x3fa14eb068: i64 = srl 0x3fa14ed5d0, Constant:i64<7>
        0x3fa14ed5d0: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3fa0095b68, FrameIndex:i64<-2>, undef:i64
          0x3fa14b8c38: i64 = FrameIndex<-2>
          0x3fa14b8b68: i64 = undef
        0x3fa14eb000: i64 = Constant<7>
      0x3fa14bb1f8: i64 = Constant<1>
  0x3fa14b9118: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3fa14b92b8: i64 = FrameIndex<6>
    0x3fa151b5e0: i64 = Constant<28>
  0x3fa14b8b68: i64 = undef
In function: fs_variant_partial

(epiphany:10582): epiphany-WARNING **: 21:36:50.038: Web process crashed
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3f8d4ea948: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3f8d4ee780, 0x3f8d4f23b0, 0x3f8d4b8928, undef:i64
  0x3f8d4f23b0: i64 = sub Constant:i64<0>, 0x3f8d4ea608
    0x3f8d4ba938: i64 = Constant<0>
    0x3f8d4ea608: i64 = and 0x3f8d4ea878, Constant:i64<1>
      0x3f8d4ea878: i64 = srl 0x3f8d4ecde0, Constant:i64<7>
        0x3f8d4ecde0: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3f8c051a68, FrameIndex:i64<-2>, undef:i64
          0x3f8d4b8448: i64 = FrameIndex<-2>
          0x3f8d4b8378: i64 = undef
        0x3f8d4ea810: i64 = Constant<7>
      0x3f8d4baa08: i64 = Constant<1>
  0x3f8d4b8928: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3f8d4b8ac8: i64 = FrameIndex<6>
    0x3f8d51adf0: i64 = Constant<28>
  0x3f8d4b8378: i64 = undef
In function: fs_variant_partial

(epiphany:10582): epiphany-WARNING **: 21:37:47.169: Web process crashed
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3f954edce8: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3f954f1b20, 0x3f954f5750, 0x3f954bccd8, undef:i64
  0x3f954f5750: i64 = sub Constant:i64<0>, 0x3f954ed9a8
    0x3f954bece8: i64 = Constant<0>
    0x3f954ed9a8: i64 = and 0x3f954edc18, Constant:i64<1>
      0x3f954edc18: i64 = srl 0x3f954f0180, Constant:i64<7>
        0x3f954f0180: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3f940544f8, FrameIndex:i64<-2>, undef:i64
          0x3f954bc7f8: i64 = FrameIndex<-2>
          0x3f954bc728: i64 = undef
        0x3f954edbb0: i64 = Constant<7>
      0x3f954bedb8: i64 = Constant<1>
  0x3f954bccd8: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3f954bce78: i64 = FrameIndex<6>
    0x3f9551e190: i64 = Constant<28>
  0x3f954bc728: i64 = undef
In function: fs_variant_partial

(epiphany:10582): epiphany-WARNING **: 21:38:15.356: Web process crashed


Tested webpage: [https://www.google.com/?gws_rd=ssl](https://www.google.com/?gws_rd=ssl)
The content was NOT displayed before crash.

miroslav@debian:~/epiphany$ epiphany
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3f8d1741d8: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3f8d178010, 0x3f8d17bc40, 0x3f8d1421b8, undef:i64
  0x3f8d17bc40: i64 = sub Constant:i64<0>, 0x3f8d173e98
    0x3f8d1441c8: i64 = Constant<0>
    0x3f8d173e98: i64 = and 0x3f8d174108, Constant:i64<1>
      0x3f8d174108: i64 = srl 0x3f8d176670, Constant:i64<7>
        0x3f8d176670: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3f8c094c58, FrameIndex:i64<-2>, undef:i64
          0x3f8d141cd8: i64 = FrameIndex<-2>
          0x3f8d141c08: i64 = undef
        0x3f8d1740a0: i64 = Constant<7>
      0x3f8d144298: i64 = Constant<1>
  0x3f8d1421b8: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3f8d142358: i64 = FrameIndex<6>
    0x3f8d1a4680: i64 = Constant<28>
  0x3f8d141c08: i64 = undef
In function: fs_variant_partial

(epiphany:12033): epiphany-WARNING **: 22:02:07.812: Web process crashed
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3fad173908: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3fad177740, 0x3fad17b370, 0x3fad1418e8, undef:i64
  0x3fad17b370: i64 = sub Constant:i64<0>, 0x3fad1735c8
    0x3fad1438f8: i64 = Constant<0>
    0x3fad1735c8: i64 = and 0x3fad173838, Constant:i64<1>
      0x3fad173838: i64 = srl 0x3fad175da0, Constant:i64<7>
        0x3fad175da0: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3fac051438, FrameIndex:i64<-2>, undef:i64
          0x3fad141408: i64 = FrameIndex<-2>
          0x3fad141338: i64 = undef
        0x3fad1737d0: i64 = Constant<7>
      0x3fad1439c8: i64 = Constant<1>
  0x3fad1418e8: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3fad141a88: i64 = FrameIndex<6>
    0x3fad1a3db0: i64 = Constant<28>
  0x3fad141338: i64 = undef
In function: fs_variant_partial

(epiphany:12033): epiphany-WARNING **: 22:03:51.988: Web process crashed
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3fc11789e8: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3fc117c820, 0x3fc1180450, 0x3fc11469c8, undef:i64
  0x3fc1180450: i64 = sub Constant:i64<0>, 0x3fc11786a8
    0x3fc11489d8: i64 = Constant<0>
    0x3fc11786a8: i64 = and 0x3fc1178918, Constant:i64<1>
      0x3fc1178918: i64 = srl 0x3fc117ae80, Constant:i64<7>
        0x3fc117ae80: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3fc0054838, FrameIndex:i64<-2>, undef:i64
          0x3fc11464e8: i64 = FrameIndex<-2>
          0x3fc1146418: i64 = undef
        0x3fc11788b0: i64 = Constant<7>
      0x3fc1148aa8: i64 = Constant<1>
  0x3fc11469c8: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3fc1146b68: i64 = FrameIndex<6>
    0x3fc11a8e90: i64 = Constant<28>
  0x3fc1146418: i64 = undef
In function: fs_variant_partial

(epiphany:12033): epiphany-WARNING **: 22:04:14.434: Web process crashed
miroslav@debian:~/epiphany$ epiphany
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3f91176b38: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3f9117a970, 0x3f9117e5a0, 0x3f91144b18, undef:i64
  0x3f9117e5a0: i64 = sub Constant:i64<0>, 0x3f911767f8
    0x3f91146b28: i64 = Constant<0>
    0x3f911767f8: i64 = and 0x3f91176a68, Constant:i64<1>
      0x3f91176a68: i64 = srl 0x3f91178fd0, Constant:i64<7>
        0x3f91178fd0: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3f90054978, FrameIndex:i64<-2>, undef:i64
          0x3f91144638: i64 = FrameIndex<-2>
          0x3f91144568: i64 = undef
        0x3f91176a00: i64 = Constant<7>
      0x3f91146bf8: i64 = Constant<1>
  0x3f91144b18: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3f91144cb8: i64 = FrameIndex<6>
    0x3f911a6fe0: i64 = Constant<28>
  0x3f91144568: i64 = undef
In function: fs_variant_partial

(epiphany:12256): epiphany-WARNING **: 22:13:32.178: Web process crashed
Comment 1 Carlos Alberto Lopez Perez 2021-04-08 11:45:52 PDT
It seems your build of WebKit has been built with the JSC JIT enabled, and AFAIK JSC still doesn't support JIT for RISC-V

Can you try to export this environment variable JavaScriptCoreUseJIT=0 before executing epiphany to see if that fixes the issue?
Comment 2 Alberto Garcia 2021-04-08 14:46:29 PDT
(In reply to Carlos Alberto Lopez Perez from comment #1)
> It seems your build of WebKit has been built with the JSC JIT
> enabled, and AFAIK JSC still doesn't support JIT for RISC-V

I don't even know how one would make a RISC-V build with the JIT
enabled... that only happens if the CPU is x86_64, arm or mips.

I also don't see that error ("This target JIT ...") in the WebKit
source code, that looks like a message from LLVM.
Comment 3 Miroslav 2021-04-08 16:10:03 PDT
Thank you guys for your effort!
I ran "export JavaScriptCoreUseJIT=0" in a terminal and everything is the same, no improvement.

However, I made some progress and it really seems like Javascript is a part of the issue.

Midori browser by default uses the same version of Webkit as Epiphany and in my case it reports exactly the same errors. However, in the settings menu there is a setting (enabled by default) to "Enable scripts". When I disable it, the above mentioned errors on the above mentioned websites disappear. If I understand correctly, this setting enables/disables Javascript. 

https://elementaryos.stackexchange.com/questions/4297/how-to-enable-javascript-in-midori

So with Javascript disabled, most basic pages (which were crashing previously) load fine. However some many pages still crash:

https://www.reddit.com/

'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3f7d88d948: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3f7d891780, 0x3f7d8953b0, 0x3f7d85b928, undef:i64
  0x3f7d8953b0: i64 = sub Constant:i64<0>, 0x3f7d88d608
    0x3f7d85d938: i64 = Constant<0>
    0x3f7d88d608: i64 = and 0x3f7d88d878, Constant:i64<1>
      0x3f7d88d878: i64 = srl 0x3f7d88fde0, Constant:i64<7>
        0x3f7d88fde0: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3f7c051338, FrameIndex:i64<-2>, undef:i64
          0x3f7d85b448: i64 = FrameIndex<-2>
          0x3f7d85b378: i64 = undef
        0x3f7d88d810: i64 = Constant<7>
      0x3f7d85da08: i64 = Constant<1>
  0x3f7d85b928: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3f7d85bac8: i64 = FrameIndex<6>
    0x3f7d8bddf0: i64 = Constant<28>
  0x3f7d85b378: i64 = undef
In function: fs_variant_partial


https://www.youtube.com/

'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3fa1425088: ch = store<(store 4 into %ir.mask_ptr1 + 12, align 16), trunc to i32> 0x3fa1428ec0, 0x3fa142caf0, 0x3fa13f3068, undef:i64
  0x3fa142caf0: i64 = sub Constant:i64<0>, 0x3fa1424d48
    0x3fa13f5078: i64 = Constant<0>
    0x3fa1424d48: i64 = and 0x3fa1424fb8, Constant:i64<1>
      0x3fa1424fb8: i64 = srl 0x3fa1427520, Constant:i64<7>
        0x3fa1427520: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3fa0054838, FrameIndex:i64<-2>, undef:i64
          0x3fa13f2b88: i64 = FrameIndex<-2>
          0x3fa13f2ab8: i64 = undef
        0x3fa1424f50: i64 = Constant<7>
      0x3fa13f5148: i64 = Constant<1>
  0x3fa13f3068: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3fa13f3208: i64 = FrameIndex<6>
    0x3fa1455530: i64 = Constant<28>
  0x3fa13f2ab8: i64 = undef
In function: fs_variant_partial
Comment 4 Carlos Alberto Lopez Perez 2021-04-08 19:21:20 PDT
For debugging you may find the MiniBrowser useful. On Debian systems is usually installed at /usr/lib/*/webkit2gtk-4.0/MiniBrowser

With it you can fine-tune lot of webkitgtk options easily. Try to pass "--help-all" to it to see everything you can enable/disable