Bug 119190 - "Illegal instruction" crash on AMD Geode CPU
Summary: "Illegal instruction" crash on AMD Geode CPU
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-28 00:21 PDT by Gauvain Pocentek
Modified: 2015-12-14 05:25 PST (History)
13 users (show)

See Also:


Attachments
backtrace (3.03 KB, text/plain)
2013-07-28 00:21 PDT, Gauvain Pocentek
no flags Details
/proc/cpuinfo (508 bytes, application/octet-stream)
2013-07-28 00:22 PDT, Gauvain Pocentek
no flags Details
Disable the JIT on x86 if there's no SSE2 (1.17 KB, patch)
2015-12-09 02:36 PST, Alberto Garcia
ossy: review-
Details | Formatted Diff | Diff
backtrace (3.90 KB, text/x-log)
2015-12-09 05:29 PST, Csaba Osztrogonác
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gauvain Pocentek 2013-07-28 00:21:57 PDT
Created attachment 207605 [details]
backtrace

Running a simple QWebView (qtwebkit) on a geode CPU results in a crash.

This is with qtwebkit 2.3.2, built with --no-force-sse2.

Let me know if you need more information.
Comment 1 Gauvain Pocentek 2013-07-28 00:22:24 PDT
Created attachment 207606 [details]
/proc/cpuinfo
Comment 2 Gauvain Pocentek 2013-07-28 00:43:46 PDT
Forgot to say (not sure if this is relevant): the build is not done on the same machine (too slow and not enough RAM). It's done on an Intel Core2.
Comment 3 (bitlord) 2013-12-10 15:22:31 PST
I'm not sure, but this downstream bug is maybe related to this one (tested on old Athlon XP (which doesn't support SSE2) I can crash webkitgtk or qtwebkit browser by opening a web page.


https://bugzilla.redhat.com/show_bug.cgi?id=984689
Comment 4 Allan Sandfeld Jensen 2015-05-19 03:34:02 PDT
QtWebKit 2.3 is a bit of a special case in that an effort was made to make sure it ran on machines without SSE2. I don't have any easy way of testing anymore though.
Comment 5 Alberto Garcia 2015-12-09 02:36:43 PST
Created attachment 266982 [details]
Disable the JIT on x86 if there's no SSE2

Are non-SSE2 x86 CPUs even supported nowadays? I'm planning to disable the JIT completely in Debian if there's no SSE2, because otherwise the browser is basically useless in those machines.
Comment 6 Csaba Osztrogonác 2015-12-09 02:54:20 PST
Comment on attachment 266982 [details]
Disable the JIT on x86 if there's no SSE2

View in context: https://bugs.webkit.org/attachment.cgi?id=266982&action=review

> Source/JavaScriptCore/runtime/VM.cpp:140
> +#if CPU(X86)
> +    if (!MacroAssembler::supportsFloatingPoint())
> +        return false;
> +#endif

I don't think if we should disable JIT here with disabling assembler if !supportsFloatingPoint().
( Additionally supportsFloatingPoint() == isSSE2Present() on X86, it would be better to use isSSE2Present(). )

Of course it can be a good workaround to disable JIT until somebody trace down which
SSE2 instruction is emitted and where. The proper fix would be to make JIT not to
emit SSE2 instructions if !isSSE2Present(). 

There are many ASSERT(isSSE2Present()) assertions in MacroAssermblerX86(Common).h files.
I think one of them should hit in debug mode.
Comment 7 Alberto Garcia 2015-12-09 03:27:59 PST
(In reply to comment #6)
> > Source/JavaScriptCore/runtime/VM.cpp:140
> > +#if CPU(X86)
> > +    if (!MacroAssembler::supportsFloatingPoint())
> > +        return false;
> > +#endif
>
> I don't think if we should disable JIT here with disabling assembler if
> !supportsFloatingPoint().
> ( Additionally supportsFloatingPoint() == isSSE2Present() on X86, it would
> be better to use isSSE2Present(). )

isSSE2Present() is private

> Of course it can be a good workaround to disable JIT until somebody
> trace down which SSE2 instruction is emitted and where. The proper
> fix would be to make JIT not to emit SSE2 instructions if
> !isSSE2Present().

> There are many ASSERT(isSSE2Present()) assertions in
> MacroAssermblerX86(Common).h files.  I think one of them should hit
> in debug mode.

Yeah, my question is whether upstream is still interested in this or
not.

I'll try debugging those assertions as you suggest, but if I don't
find an easy fix I think I'll use this workaround downstream, at least
for the time being.
Comment 8 Csaba Osztrogonác 2015-12-09 05:29:28 PST
Created attachment 266994 [details]
backtrace

I modified isSSE2Present() to return always false and I got 
the following backtrace on r189998 during running sunspider.

Unfortunately I can't build newer JSC on x86, 
because my GCC is too old on this x86 machine.

I hope it will help debugging.
Comment 9 Michael Catanzaro 2015-12-09 05:30:01 PST
Well many of our downstreams support computers without SSE2, so I'd say push the workaround upstream, then we can drop it if we find a proper fix in the future. I don't want to have to carry the same downstream patch in both Debian and Fedora.
Comment 10 Csaba Osztrogonác 2015-12-09 05:37:53 PST
(In reply to comment #9)
> Well many of our downstreams support computers without SSE2, so I'd say push
> the workaround upstream, then we can drop it if we find a proper fix in the
> future. I don't want to have to carry the same downstream patch in both
> Debian and Fedora.

I'm not against adding a workaround, but I think the proposed one
is not the proper way to disable JIT and it is very confusing.

( Unfortunately I don't have any time for this bug 
this year and can't help in fixing/workarounding. )
Comment 11 Csaba Osztrogonác 2015-12-14 04:25:09 PST
Comment on attachment 266982 [details]
Disable the JIT on x86 if there's no SSE2

Let's do it in Options.cpp similar to Apple's and WinCairo's Windows port:
https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/Options.cpp#L277
- #if OS(WINDOWS) && CPU(X86)
+ #if CPU(X86) && ( OS(WINDOWS) || OS(LINUX) )

And it would be great to add a FIXME with referencing a new bug report which is responsible for fixing JIT on non-SSE2 X86.
Comment 12 Alberto Garcia 2015-12-14 05:25:30 PST
(In reply to comment #11)
> Comment on attachment 266982 [details]
> Disable the JIT on x86 if there's no SSE2
> 
> Let's do it in Options.cpp similar to Apple's and WinCairo's Windows port:
> https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/Options.
> cpp#L277
> - #if OS(WINDOWS) && CPU(X86)
> + #if CPU(X86) && ( OS(WINDOWS) || OS(LINUX) )
> 
> And it would be great to add a FIXME with referencing a new bug report which
> is responsible for fixing JIT on non-SSE2 X86.

That sounds good. I will test it first because I want to make sure that this is indeed happening with the current master.

Thanks!