Bug#1012548: libwebkit2gtk-4.1-0: Offline renderer SIGSEGV on i386

karogyoker karogyoker2+debbug at gmail.com
Fri Jun 17 19:07:10 BST 2022


Package: libwebkit2gtk-4.1-0
Version: 2.36.3-1
Followup-For: Bug #1012548
X-Debbugs-Cc: karogyoker2+debbug at gmail.com
Control: tags -1 patch upstream

I think not many crashes surfaced because not many people are using real 32 bit
CPUs meanwhile visiting websites with Web Audio API.

All 32 bit CPUs are affected except newer models of Pentium 4.

I'm attaching the proposed fix.


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 5.17.0-1-686-pae (SMP w/1 CPU thread; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libwebkit2gtk-4.1-0 depends on:
ii  bubblewrap                      0.6.2-1
ii  gstreamer1.0-plugins-base       1.20.2-2
ii  gstreamer1.0-plugins-good       1.20.2-1
ii  libatk1.0-0                     2.38.0-1
ii  libc6                           2.33-7
ii  libcairo2                       1.16.0-5
ii  libegl1                         1.4.0-1
ii  libenchant-2-2                  2.3.2-1
ii  libfontconfig1                  2.13.1-4.4
ii  libfreetype6                    2.12.1+dfsg-2
ii  libgcc-s1                       12.1.0-2
ii  libgcrypt20                     1.10.1-2
ii  libgdk-pixbuf-2.0-0             2.42.8+dfsg-1
ii  libglib2.0-0                    2.72.1-1
ii  libglx0                         1.4.0-1
ii  libgstreamer-gl1.0-0            1.20.2-2
ii  libgstreamer-plugins-base1.0-0  1.20.2-2
ii  libgstreamer1.0-0               1.20.2-1
ii  libgtk-3-0                      3.24.34-1
ii  libharfbuzz-icu0                2.7.4-1+b1
ii  libharfbuzz0b                   2.7.4-1+b1
ii  libhyphen0                      2.8.8-7
ii  libicu71                        71.1-3
ii  libjavascriptcoregtk-4.1-0      2.36.3-1
ii  libjpeg62-turbo                 1:2.1.2-1
ii  liblcms2-2                      2.12~rc1-2
ii  libmanette-0.2-0                0.2.6-3
ii  libnotify4                      0.7.12-1
ii  libopengl0                      1.4.0-1
ii  libopenjp2-7                    2.4.0-6
ii  libpango-1.0-0                  1.50.7+ds-1
ii  libpng16-16                     1.6.37-5
ii  libseccomp2                     2.5.4-1
ii  libsecret-1-0                   0.20.5-2
ii  libsoup-3.0-0                   3.0.6-1
ii  libsqlite3-0                    3.38.5-1
ii  libstdc++6                      12.1.0-2
ii  libsystemd0                     250.4-1
ii  libtasn1-6                      4.18.0-4
ii  libwayland-client0              1.20.0-1
ii  libwayland-egl1                 1.20.0-1
ii  libwayland-server0              1.20.0-1
ii  libwebp7                        1.2.2-2+b1
ii  libwebpdemux2                   1.2.2-2+b1
ii  libwoff1                        1.0.2-1+b1
ii  libwpe-1.0-1                    1.12.0-1
ii  libwpebackend-fdo-1.0-1         1.12.0-1
ii  libx11-6                        2:1.7.5-1
ii  libxcomposite1                  1:0.4.5-1
ii  libxdamage1                     1:1.1.5-2
ii  libxml2                         2.9.14+dfsg-1
ii  libxslt1.1                      1.1.34-4
ii  xdg-dbus-proxy                  0.1.4-1
ii  zlib1g                          1:1.2.11.dfsg-4

Versions of packages libwebkit2gtk-4.1-0 recommends:
ii  gstreamer1.0-gl           1.20.2-2
ii  gstreamer1.0-libav        1.20.2-1
ii  gstreamer1.0-plugins-bad  1.20.2-1
ii  libgl1-mesa-dri           22.0.5-1
ii  xdg-desktop-portal-gtk    1.14.0-1

Versions of packages libwebkit2gtk-4.1-0 suggests:
ii  gstreamer1.0-alsa  1.20.2-2

-- no debconf information
-------------- next part --------------
diff --git a/Source/WebCore/platform/audio/DenormalDisabler.h b/Source/WebCore/platform/audio/DenormalDisabler.h
index e0b3efd80f78..3ea2098099bb 100644
--- a/Source/WebCore/platform/audio/DenormalDisabler.h
+++ b/Source/WebCore/platform/audio/DenormalDisabler.h
@@ -26,6 +26,7 @@
 #define DenormalDisabler_h
 
 #include <wtf/MathExtras.h>
+#include <cinttypes>
 
 namespace WebCore {
 
@@ -36,7 +37,7 @@ namespace WebCore {
 #define HAVE_DENORMAL
 #endif
 
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+#if defined(__GNUC__) && defined(__SSE__)
 #define HAVE_DENORMAL
 #endif
 
@@ -56,7 +57,7 @@ public:
         _controlfp_s(&unused, _DN_FLUSH, _MCW_DN);
 #else
         m_savedCSR = getCSR();
-        setCSR(m_savedCSR | 0x8040);
+        setCSR(m_savedCSR | (isDAZSupported() ? 0x8040 : 0x8000));
 #endif
     }
 
@@ -83,7 +84,32 @@ public:
 #endif
     }
 private:
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+#if defined(__GNUC__) && defined(__SSE__)
+    static inline bool isDAZSupported()
+    {
+#if defined(__x86_64__)
+        return true;
+#else
+        static bool s_isInited = false;
+        static bool s_isSupported = false;
+        if (s_isInited)
+            return s_isSupported;
+
+        struct fxsaveResult {
+            uint8_t before[28];
+            uint32_t CSRMask;
+            uint8_t after[480];
+        } __attribute__ ((aligned (16)));
+
+        fxsaveResult registerData;
+        memset(&registerData, 0, sizeof(fxsaveResult));
+        asm volatile("fxsave %0" : "=m" (registerData));
+        s_isSupported = registerData.CSRMask & 0x0040;
+        s_isInited = true;
+        return s_isSupported;
+#endif
+    }
+
     inline int getCSR()
     {
         int result;


More information about the Pkg-webkit-maintainers mailing list