Hi,

trying to start screen capture in firefox currently leads to a pledge(2)
violation, cause it calls shmget(2). You can test this by going to
https://meet.jit.si, creating a room and trying to screen share.
The patch below avoids this, by not trying to setup XShm for the screen
capture. Firefox will fall back to a slower non-shm method, which is
good enough to share a terminal session and is better than killing
the browser I think :).
A proper fix would probabaly require a lot restructuring, since
the size of the shared memory depends on the selected window/screen.

Kind regards,

Thomas

diff --git www/mozilla-firefox/Makefile www/mozilla-firefox/Makefile
index 84df38c0416..a5ce171d435 100644
--- www/mozilla-firefox/Makefile
+++ www/mozilla-firefox/Makefile
@@ -1,5 +1,6 @@
 # $OpenBSD: Makefile,v 1.456 2021/03/23 13:25:36 landry Exp $

+REVISION =     0
 COMMENT =      Firefox web browser
 ONLY_FOR_ARCHS =       amd64 i386 aarch64

diff --git
www/mozilla-firefox/patches/patch-third_party_libwebrtc_webrtc_modules_desktop_capture_linux_x_server_pixel_buffer_cc
www/mozilla-firefox/patches/patch-third_party_libwebrtc_webrtc_modules_desktop_capture_linux_x_server_pixel_buffer_cc
new file mode 100644 index 00000000000..f9f56971462 --- /dev/null
+++
www/mozilla-firefox/patches/patch-third_party_libwebrtc_webrtc_modules_desktop_capture_linux_x_server_pixel_buffer_cc
@@ -0,0 +1,15 @@ +$OpenBSD$
+Avoid pledge violation. Will fall back to slower XImage method, so
that screen +capture works.
+
+Index:
third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc
+---
third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc.orig
++++
third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc
+@@ -181,7 +181,6 @@ bool XServerPixelBuffer::Init(Display* display,
Window
+   }
+
+   window_ = window;
+-  InitShm(attributes);
+
+   return true;
+ }

Reply via email to