summaryrefslogtreecommitdiff
path: root/net-misc/gnome-remote-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/gnome-remote-desktop')
-rw-r--r--net-misc/gnome-remote-desktop/Manifest4
-rw-r--r--net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-copy-pixels.patch71
-rw-r--r--net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-drop-vnc-frames.patch80
-rw-r--r--net-misc/gnome-remote-desktop/gnome-remote-desktop-0.1.9.ebuild54
4 files changed, 209 insertions, 0 deletions
diff --git a/net-misc/gnome-remote-desktop/Manifest b/net-misc/gnome-remote-desktop/Manifest
index 37f0200c106f..d32013c2f972 100644
--- a/net-misc/gnome-remote-desktop/Manifest
+++ b/net-misc/gnome-remote-desktop/Manifest
@@ -1,5 +1,9 @@
+AUX gnome-remote-desktop-0.1.9-copy-pixels.patch 2770 BLAKE2B 6415c88173a375282a816a5d2b2c7e947dd53d4cd3b2bd4d49bf2365e6f4854f562dd0dff99cd3fc8eb0a3fa7b962cf9d38fc3e72218cf37dc1d350195147a67 SHA512 feb4c600b9225a8ffe82faa221c78aa199fb1e49cfad0b7031deff0188165e6244af64e233349786f9da414efd296074aed8749eeb0f15e1d9a43aeb564be88d
+AUX gnome-remote-desktop-0.1.9-drop-vnc-frames.patch 2637 BLAKE2B bf16767583e80fb0af8a0702e412f73c1cd9b1868446268a9e584db520fb22305d89f62bc165964116d39972d6946970da7c135120a18ad21e90a82cdc39b13e SHA512 e5634f7445d8933a010c1302363191873f55612e8ab272ed6b86b9a8043ce738e08ce3f23c98d32dacd2cc8c948340685843690f5d680d0eee410cb83d504ec3
DIST gnome-remote-desktop-0.1.7.tar.xz 25636 BLAKE2B 00e389bc8887c3d43f9221a45c6c7154e4140fab560c5c568fe92f06794b736efcf2265c763d0d9d57d5343dd2f71b7a3a2c45b0466cdae608f0a609af53175d SHA512 dd20e5e6fd724ff03d8a32319c7145f1fef4331439e52921b812f087e6b83185bf318bb2fb9758fe083ec3cfea30448b601da4ed1aba85fa892ef7fbb794b9ed
DIST gnome-remote-desktop-0.1.8.tar.bz2 28565 BLAKE2B 8c14200eb17503eb92c7a7db51d487f17bca7616848aa8f555d2c31a5b758b500d6bbcb78a4a75cebbe0220281079848517c58813783497b463b0a771f07229b SHA512 1e433a95c303ce82782c27412c4f4456f0ecf33eb1e63b61b11f1cde68b6113a765a0f7d7871f73af8a253f1d7b3d3d4dafd36c3e5e9fa6d6c97279747f584ab
+DIST gnome-remote-desktop-0.1.9.tar.xz 38040 BLAKE2B aac99424d9c11614f1fd3c9ce1ebe913212489b4c8f3cc22fe5d44b00483cba9cebae8974d221d81a1cbe3e53e85a24f2c5053714fb8b753ada1c034d031752c SHA512 6ac2962c824634cd5322785b6d251e899ea38668010b18b1b50124497895d9c00752904abf01490e27b74e1661aeae39d83fbbd77b841329b1e0fd381c3ea440
EBUILD gnome-remote-desktop-0.1.7.ebuild 957 BLAKE2B ec9d93ae7954028f8a9ae96ea530418845e4a8ad8b9c8357bd70ae47ce092d18cb35ee7af6dcf3ac45bf90e3c70540b8780fd2219e71257baa59650ef1c8bf57 SHA512 04bd0aab7298411081b13fe1ee96cc3b27543472776cacee50a65d94e90acbbbe5198478ad023062a6733f2fc00437dec1bc17c3512fdcfd3559ce8a8df3f27c
EBUILD gnome-remote-desktop-0.1.8.ebuild 917 BLAKE2B 36c0cf9e37dc9442fd00876254e93ea27ea5866df69ef4c67238945c2b556de6157e1b33f306c3c21f5b436428f324b0a44554520baa98cb9f239d8a3b34c9ec SHA512 97d1c72cdc13ecf6dcdacfa2fec232449e075b3ef5d0b0d9f9e4102955194df3cfc2cd621532efd1f6c0a7de851180031945f7201b1971ddec3f15c1321733f6
+EBUILD gnome-remote-desktop-0.1.9.ebuild 936 BLAKE2B ffa02d3616f1656654687a0d1f7bf1548dd0acff02ab4592367a757433c69aed4a109c94222b8c772da055fd8b25f3053350c37443e4bec532f28d835e0dcd1b SHA512 297bfd0e93505a60880acf28cac5d53f91bb44f2905d815e602233f09ffba30b81bd3350bd86945d5be942a474a2b4b1c56093bccfffc3838ce573b05100e132
MISC metadata.xml 253 BLAKE2B a1efbd3751efaa83ee173f557ec1c8a4497a90b60896cf5a7a07da40b4f94a7a299ca0385477e82b2f5e5dbdf9afa482ccbe21f35ef44214e9c451d764b65529 SHA512 8d59f413993268ca783f7407b676900bb2d964754bf705d4175e2bafbe058a52af74f3928e4bd84d292518f8cf13fab7051486ab7cdc61d02fae6e0188d44442
diff --git a/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-copy-pixels.patch b/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-copy-pixels.patch
new file mode 100644
index 000000000000..44cecbf6ad60
--- /dev/null
+++ b/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-copy-pixels.patch
@@ -0,0 +1,71 @@
+From 4d358762948dccdcac6d01f4dd7b8635e53de979 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
+Date: Mon, 12 Oct 2020 17:34:30 +0200
+Subject: [PATCH] vnc: Copy pixels using the right destination stride
+
+We're copying the pixels in a separate thread managed by PipeWire, and
+in this thread, accessing the VNC framebuffer dimension and stride is
+racy. Instead of fetching the dimension directly, pass the expected
+width and get the stride it will eventually have.
+
+Already before this patch, when the copied pixel end up on the main
+thread and the dimension still doesn't match up, the frame will be
+dropped.
+---
+ src/grd-session-vnc.c | 5 +++--
+ src/grd-session-vnc.h | 3 ++-
+ src/grd-vnc-pipewire-stream.c | 5 +++--
+ 3 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
+index a06d34d..ba3e5ce 100644
+--- a/src/grd-session-vnc.c
++++ b/src/grd-session-vnc.c
+@@ -519,9 +519,10 @@ check_rfb_password (rfbClientPtr rfb_client,
+ }
+
+ int
+-grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc)
++grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
++ int width)
+ {
+- return session_vnc->rfb_screen->paddedWidthInBytes;
++ return width * BGRX_BYTES_PER_PIXEL;
+ }
+
+ static void
+diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
+index 07678c8..ee1f986 100644
+--- a/src/grd-session-vnc.h
++++ b/src/grd-session-vnc.h
+@@ -55,7 +55,8 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
+ int x,
+ int y);
+
+-int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
++int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
++ int width);
+
+ gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
+
+diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
+index 96dd7c9..82ceb9b 100644
+--- a/src/grd-vnc-pipewire-stream.c
++++ b/src/grd-vnc-pipewire-stream.c
+@@ -326,10 +326,11 @@ process_buffer (GrdVncPipeWireStream *stream,
+ int height;
+ int y;
+
+- src_stride = buffer->datas[0].chunk->stride;
+- dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
+ height = stream->spa_format.size.height;
+ width = stream->spa_format.size.width;
++ src_stride = buffer->datas[0].chunk->stride;
++ dst_stride = grd_session_vnc_get_stride_for_width (stream->session,
++ width);
+
+ frame->data = g_malloc (height * dst_stride);
+ for (y = 0; y < height; y++)
+--
+GitLab
+
diff --git a/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-drop-vnc-frames.patch b/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-drop-vnc-frames.patch
new file mode 100644
index 000000000000..56ea75ff466d
--- /dev/null
+++ b/net-misc/gnome-remote-desktop/files/gnome-remote-desktop-0.1.9-drop-vnc-frames.patch
@@ -0,0 +1,80 @@
+From ab97841629f5f3f4fab9993b6255b6ae04828b9c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
+Date: Wed, 9 Sep 2020 10:14:20 +0200
+Subject: [PATCH] vnc: Drop frames if client is gone
+
+Frames from PipeWire are posted asynchronously from a I/O thread to the
+main thread where they are turned into VNC frame updates and cursor
+movements. On the other hand, sessions are closed asynchronously when
+the VNC client disappears. If a frame ended up on the main thread after
+a client disappeared but before the session and stream was closed, we'd
+try to turn the new frames into VNC updates without a client being
+available, causing use after free.
+
+Fix this by dropping frames that happens during this time frame.
+
+Closes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/43
+---
+ src/grd-session-vnc.c | 7 +++++++
+ src/grd-session-vnc.h | 2 ++
+ src/grd-vnc-pipewire-stream.c | 8 ++++++++
+ 3 files changed, 17 insertions(+)
+
+diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
+index 813838a..a06d34d 100644
+--- a/src/grd-session-vnc.c
++++ b/src/grd-session-vnc.c
+@@ -209,6 +209,12 @@ maybe_queue_close_session_idle (GrdSessionVnc *session_vnc)
+ g_idle_add (close_session_idle, session_vnc);
+ }
+
++gboolean
++grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc)
++{
++ return !session_vnc->rfb_client;
++}
++
+ static void
+ handle_client_gone (rfbClientPtr rfb_client)
+ {
+@@ -218,6 +224,7 @@ handle_client_gone (rfbClientPtr rfb_client)
+
+ grd_session_vnc_detach_source (session_vnc);
+ maybe_queue_close_session_idle (session_vnc);
++ session_vnc->rfb_client = NULL;
+ }
+
+ static void
+diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
+index 579a12a..07678c8 100644
+--- a/src/grd-session-vnc.h
++++ b/src/grd-session-vnc.h
+@@ -57,4 +57,6 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
+
+ int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
+
++gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
++
+ #endif /* GRD_SESSION_VNC_H */
+diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
+index 78793c4..96dd7c9 100644
+--- a/src/grd-vnc-pipewire-stream.c
++++ b/src/grd-vnc-pipewire-stream.c
+@@ -234,6 +234,14 @@ do_render (struct spa_loop *loop,
+ if (!frame)
+ return 0;
+
++ if (grd_session_vnc_is_client_gone (stream->session))
++ {
++ g_free (frame->data);
++ g_clear_pointer (&frame->rfb_cursor, rfbFreeCursor);
++ g_free (frame);
++ return 0;
++ }
++
+ if (frame->rfb_cursor)
+ grd_session_vnc_set_cursor (stream->session, frame->rfb_cursor);
+
+--
+GitLab
+
diff --git a/net-misc/gnome-remote-desktop/gnome-remote-desktop-0.1.9.ebuild b/net-misc/gnome-remote-desktop/gnome-remote-desktop-0.1.9.ebuild
new file mode 100644
index 000000000000..622bb9d2a09c
--- /dev/null
+++ b/net-misc/gnome-remote-desktop/gnome-remote-desktop-0.1.9.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit gnome.org gnome2-utils meson systemd xdg
+
+DESCRIPTION="Remote desktop daemon for GNOME using pipewire"
+HOMEPAGE="https://gitlab.gnome.org/jadahl/gnome-remote-desktop"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE=""
+
+DEPEND="
+ dev-libs/glib:2
+ media-video/pipewire:0/0.3
+ sys-apps/systemd
+ net-libs/libvncserver
+ app-crypt/libsecret
+ x11-libs/libnotify
+"
+RDEPEND="${DEPEND}
+ x11-wm/mutter[screencast]
+"
+BDEPEND="
+ dev-util/gdbus-codegen
+ dev-util/glib-utils
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-drop-vnc-frames.patch"
+ "${FILESDIR}/${P}-copy-pixels.patch"
+)
+
+src_configure() {
+ local emesonargs=(
+ -Dsystemd_user_unit_dir="$(systemd_get_userunitdir)"
+ )
+ meson_src_configure
+}
+
+pkg_postinst() {
+ xdg_pkg_postinst
+ gnome2_schemas_update
+}
+
+pkg_postrm() {
+ xdg_pkg_postrm
+ gnome2_schemas_update
+}