RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/gnome-remote-desktop#c026821a7a9a0572ad111258d5cc879d8e7d6a13
This commit is contained in:
Petr Šabata 2020-10-15 01:56:37 +02:00
parent 0d7de630a9
commit d44c6620ba
7 changed files with 1869 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/gnome-remote-desktop-0.1.*.tar.xz

View File

@ -0,0 +1,71 @@
From 81172effba7c70d3b2932c67be79a2924eae9d73 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 69fb33d..f4835aa 100644
--- a/src/grd-session-vnc.c
+++ b/src/grd-session-vnc.c
@@ -535,9 +535,10 @@ grd_session_vnc_get_fd (GrdSessionVnc *session_vnc)
}
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;
}
rfbClientPtr
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
index 0d01ad3..ccd046c 100644
--- a/src/grd-session-vnc.h
+++ b/src/grd-session-vnc.h
@@ -60,7 +60,8 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
int grd_session_vnc_get_fd (GrdSessionVnc *session_vnc);
-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++)
--
2.28.0

View File

@ -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);
--
2.26.2

View File

@ -0,0 +1,73 @@
From 78c5bcb181fe2b0b9fc17eea696feac8b504df54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 7 May 2020 15:48:22 +0200
Subject: [PATCH] vnc/pipewire-stream: Handle stride mismatch
The VNC server framebuffer assumes a particular stride; but there is no
guarantee that we'll get the same from PipeWire. Handle this gracefully
by coping row by row instead of the whole buffer.
---
src/grd-vnc-pipewire-stream.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
index 88c07be..261292a 100644
--- a/src/grd-vnc-pipewire-stream.c
+++ b/src/grd-vnc-pipewire-stream.c
@@ -187,8 +187,6 @@ on_stream_param_changed (void *user_data,
struct spa_pod_builder pod_builder;
int width;
int height;
- int stride;
- int size;
const struct spa_pod *params[3];
if (!format || id != SPA_PARAM_Format)
@@ -203,14 +201,9 @@ on_stream_param_changed (void *user_data,
grd_session_vnc_queue_resize_framebuffer (stream->session, width, height);
- stride = grd_session_vnc_get_framebuffer_stride (stream->session);
- size = stride * height;
-
params[0] = spa_pod_builder_add_object (
&pod_builder,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
- SPA_PARAM_BUFFERS_size, SPA_POD_Int (size),
- SPA_PARAM_BUFFERS_stride, SPA_POD_Int (stride),
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int (8, 1, 8),
0);
@@ -319,6 +312,10 @@ process_buffer (GrdVncPipeWireStream *stream,
size_t size;
uint8_t *map;
void *src_data;
+ int src_stride;
+ int dst_stride;
+ int height;
+ int y;
struct spa_meta_cursor *spa_meta_cursor;
g_autofree GrdVncFrame *frame = NULL;
@@ -359,7 +356,17 @@ process_buffer (GrdVncPipeWireStream *stream,
return NULL;
}
- frame->data = g_memdup (src_data, buffer->datas[0].maxsize);
+ src_stride = buffer->datas[0].chunk->stride;
+ dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
+ height = stream->spa_format.size.height;
+
+ frame->data = g_malloc (height * dst_stride);
+ for (y = 0; y < height; y++)
+ {
+ memcpy (((uint8_t *) frame->data) + y * dst_stride,
+ ((uint8_t *) src_data) + y * src_stride,
+ stream->spa_format.size.width * 4);
+ }
if (map)
{
--
2.26.2

152
gnome-remote-desktop.spec Normal file
View File

@ -0,0 +1,152 @@
%global systemd_unit gnome-remote-desktop.service
Name: gnome-remote-desktop
Version: 0.1.9
Release: 2%{?dist}
Summary: GNOME Remote Desktop screen share service
License: GPLv2+
URL: https://gitlab.gnome.org/jadahl/gnome-remote-desktop
Source0: https://download.gnome.org/sources/gnome-remote-desktop/0.1/gnome-remote-desktop-0.1.9.tar.xz
# Avoid race condition on disconnect
Patch0: 0001-vnc-Drop-frames-if-client-is-gone.patch
# Adds encryption support (requires patched LibVNCServer)
Patch1: gnutls-anontls.patch
# Copy using the right destination stride
Patch2: 0001-vnc-Copy-pixels-using-the-right-destination-stride.patch
BuildRequires: git
BuildRequires: gcc
BuildRequires: meson >= 0.36.0
BuildRequires: pkgconfig
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(glib-2.0) >= 2.32
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.32
BuildRequires: pkgconfig(libpipewire-0.3) >= 0.3.0
BuildRequires: pkgconfig(libvncserver) >= 0.9.11-7
BuildRequires: pkgconfig(freerdp2)
BuildRequires: pkgconfig(libsecret-1)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(gnutls)
%{?systemd_requires}
BuildRequires: systemd
Requires: pipewire >= 0.3.0
%description
GNOME Remote Desktop is a remote desktop and screen sharing service for the
GNOME desktop environment.
%prep
%autosetup -S git
%build
%meson
%meson_build
%install
%meson_install
%post
%systemd_user_post %{systemd_unit}
%preun
%systemd_user_preun %{systemd_unit}
%postun
%systemd_user_postun_with_restart %{systemd_unit}
%files
%license COPYING
%doc README
%{_libexecdir}/gnome-remote-desktop-daemon
%{_userunitdir}/gnome-remote-desktop.service
%{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.enums.xml
%changelog
* Mon Sep 14 2020 Jonas Ådahl <jadahl@redhat.com> - 0.1.9-2
- Copy using the right destination stride
* Mon Sep 14 2020 Jonas Ådahl <jadahl@redhat.com> - 0.1.9-1
- Update to 0.1.9
- Backport race condition crash fix
- Rebase anon-tls patches
* Thu Aug 27 2020 Ray Strode <rstrode@redhat.com> - 0.1.8-3
- Fix crash
Related: #1844993
* Mon Jun 1 2020 Felipe Borges <feborges@redhat.com> - 0.1.8-2
- Fix black screen issue in remote connections on Wayland
* Wed Mar 11 2020 Jonas Ådahl <jadahl@redhat.com> - 0.1.8-1
- Update to 0.1.8
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-5
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 4 2019 Jonas Ådahl <jadahl@redhat.com> - 0.1.7-1
- Update to 0.1.7
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Oct 2 2018 Jonas Ådahl <jadahl@redhat.com> - 0.1.6-2
- Don't crash when PipeWire disconnects (rhbz#1632781)
* Tue Aug 7 2018 Jonas Ådahl <jadahl@redhat.com> - 0.1.6
- Update to 0.1.6
- Apply ANON-TLS patch
- Depend on pipewire 0.2.2
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed May 30 2018 Jonas Ådahl <jadahl@redhat.com> - 0.1.4-1
- Update to new version
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.2-5
- Escape macros in %%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Aug 29 2017 Jonas Ådahl <jadahl@redhat.com> - 0.1.2-3
- Use %%autosetup
- Install licence file
* Tue Aug 22 2017 Jonas Ådahl <jadahl@redhat.com> - 0.1.2-2
- Remove gschema compilation step as that had been deprecated
* Mon Aug 21 2017 Jonas Ådahl <jadahl@redhat.com> - 0.1.2-1
- Update to 0.1.2
- Changed tabs to spaces
- Added systemd user macros
- Install to correct systemd user unit directory
- Compile gsettings schemas after install and uninstall
* Mon Aug 21 2017 Jonas Ådahl <jadahl@redhat.com> - 0.1.1-1
- First packaged version

1491
gnutls-anontls.patch Normal file

File diff suppressed because it is too large Load Diff

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (gnome-remote-desktop-0.1.9.tar.xz) = 6ac2962c824634cd5322785b6d251e899ea38668010b18b1b50124497895d9c00752904abf01490e27b74e1661aeae39d83fbbd77b841329b1e0fd381c3ea440