Bug 188135 - [audio] Hard dependency on SSE instruction set
Summary: [audio] Hard dependency on SSE instruction set
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: PC All
: P5 Blocker
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-27 21:21 PDT by karogyoker2+webkit
Modified: 2018-08-15 17:52 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description karogyoker2+webkit 2018-07-27 21:21:52 PDT
In DenormalDisabler.h stmxcsr and ldmxcsr are used but these instructions are only available in CPUs with SSE.
Therefore this #if must be changed:
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
to this:
#if defined(__GNUC__) && defined(__SSE__)

This #if must be changed at both occurrences in the file.
Here:
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define HAVE_DENORMAL
#endif

and here:
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
    inline int getCSR()
Comment 1 karogyoker2+webkit 2018-08-15 10:22:51 PDT
Debian packages are built for 686 processors[1]. So, in theory WebKit should run on a Pentium Pro.

If the above code will eventually executed for somebody on a Pentium Pro or Pentium 2, it will crash due to SIGILL because these instructions are only available since Pentium 3.

But the fix is not that trivial. We cannot change (defined(__i386__) || defined(__x86_64__)) to __SSE__ because in that case Pentium 3, Pentium 4, Athlon and Athlon XP users would have degraded performance[2] because the package is built for Pentium Pro.

So we have 3 choices:
- Make it work on Pentium Pro with the disadvantage that it will be slower on newer CPUs
- Do some run time check if the CPU supports SSE and cache the result so it only gets this once by CPUID
- Leave it as it is until it is really causing some issues for somebody, probably this will never happen anyways. This bug would only trigger if somebody is using WebKit on a Pentium Pro or on a Pentium 2 and visits a website which is using the Web Audio API.

[1]: https://lists.debian.org/debian-devel/2015/09/msg00589.html
[2]: https://github.com/WebKit/webkit/blob/08b8a0b13504a2095cdfe0f8172c756f9776052c/Source/WebCore/platform/audio/DenormalDisabler.h#L32
Comment 2 karogyoker2+webkit 2018-08-15 10:47:18 PDT
I'm closing this for now. I don't know which is harder today, find a Pentium 2 or a website which is using Web Audio API for fair use cases (when it is not used to fingerprint the browser to track the user's web browsing activity).