Commit 48c92d47 authored by Emmanuele Bassi's avatar Emmanuele Bassi

Try patching Mutter to use getrandom()'s syscall

parent 54acc1ba
Pipeline #90622 passed with stage
in 21 seconds
......@@ -1144,6 +1144,7 @@
{"src": "gnome:mutter.git",
"name": "mutter",
"patches": ["mutter-getrandom.patch"],
"config-opts": [
"-Dremote_desktop=false",
"-Degl_device=false",
......
From 72231d65c1a7552e1e9b8529fa956dc6282eb9d6 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Tue, 25 Jun 2019 00:29:51 +0100
Subject: [PATCH] Add syscall fallback for getrandom()
When using linux/random.h, we need to use the syscall() interface.
---
meson.build | 4 ++--
src/wayland/meta-xwayland.c | 12 +++++++++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index d01b42c19..46231f03d 100644
--- a/meson.build
+++ b/meson.build
@@ -368,8 +368,8 @@ if have_wayland
# For Xwayland authority file generation.
if cc.has_header_symbol('sys/random.h', 'getrandom')
cdata.set('HAVE_SYS_RANDOM', 1)
- elif cc.has_header_symbol('linux/random.h', 'getrandom')
- cdata.set('HAVE_LINUX_RANDOM', 1)
+ elif cc.has_header_symbol('sys/syscall.h', 'SYS_getrandom')
+ cdata.set('HAVE_GETRANDOM_SYSCALL', 1)
else
error('Required function getrandom not found')
endif
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 88a4b4c11..68c2fbef6 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -33,8 +33,10 @@
#include <sys/un.h>
#if defined(HAVE_SYS_RANDOM)
#include <sys/random.h>
-#elif defined(HAVE_LINUX_RANDOM)
+#elif defined(HAVE_GETRANDOM_SYSCALL)
#include <linux/random.h>
+#include <sys/syscall.h>
+#include <errno.h>
#endif
#include <unistd.h>
#include <X11/Xauth.h>
@@ -445,6 +447,14 @@ choose_xdisplay (MetaXWaylandManager *manager)
return TRUE;
}
+#ifdef HAVE_GETRANDOM_SYSCALL
+static ssize_t
+getrandom (void *buf, size_t buflen, unsigned int flags)
+{
+ return syscall (SYS_getrandom, buf, buflen, 0);
+}
+#endif
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FILE, fclose)
static gboolean
--
2.21.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment