Skip to content

Commit

Permalink
Add Xwayland wrapper similar to the one for Xorg
Browse files Browse the repository at this point in the history
Add a wrapper that sets LD_PRELOAD=.../shmoverride.so. Since suid
binaries are not involved with Xwayland, it can be a simple shell
script.

Place the wrapper as Xwayland in /usr/libexec/qubes/wrappers. Processes
that are supposed to use it need to have /usr/libexec/qubes/wrappers
prepended to PATH.

QubesOS/qubes-issues#8515
  • Loading branch information
marmarek committed Oct 15, 2024
1 parent e7d4a0c commit 1c5794d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ selinux_policies ::= qubes-gui-daemon.pp

all_targets := gui-daemon/qubes-guid gui-daemon/qubes-guid.1 \
shmoverride/shmoverride.so \
shmoverride/X-wrapper-qubes pulse/pacat-simple-vchan \
shmoverride/X-wrapper-qubes \
shmoverride/Xwayland-wrapper \
pulse/pacat-simple-vchan \
screen-layout-handler/watch-screen-layout-changes


Expand All @@ -52,6 +54,9 @@ shmoverride/shmoverride.so:
shmoverride/X-wrapper-qubes:
(cd shmoverride; $(MAKE) X-wrapper-qubes)

shmoverride/Xwayland-wrapper:
(cd shmoverride; $(MAKE) Xwayland-wrapper)

pulse/pacat-simple-vchan:
$(MAKE) -C pulse pacat-simple-vchan

Expand All @@ -67,6 +72,7 @@ install:
install -D pulse/pacat-simple-vchan $(DESTDIR)/usr/bin/pacat-simple-vchan
install -D shmoverride/X-wrapper-qubes $(DESTDIR)/usr/bin/X-wrapper-qubes
install -D shmoverride/shmoverride.so $(DESTDIR)$(LIBDIR)/qubes-gui-daemon/shmoverride.so
install -D shmoverride/Xwayland-wrapper $(DESTDIR)/usr/libexec/qubes/wrappers/Xwayland
install -D -m 0644 gui-daemon/guid.conf $(DESTDIR)/etc/qubes/guid.conf
install -D gui-daemon/qubes-localgroup.sh $(DESTDIR)/etc/X11/xinit/xinitrc.d/qubes-localgroup.sh
install -D -m 0644 common/90-default-gui-daemon.policy $(DESTDIR)/etc/qubes/policy.d/90-default-gui-daemon.policy
Expand Down
1 change: 1 addition & 0 deletions debian/qubes-gui-daemon.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
usr/bin/X.qubes
usr/bin/qubes-guid
usr/libexec/qubes/watch-screen-layout-changes
usr/libexec/qubes/wrappers/Xwayland
usr/share/man/man1/qubes-guid.1
usr/lib/*/qubes-gui-daemon/shmoverride.so
usr/lib/qubes/icon-receiver
Expand Down
1 change: 1 addition & 0 deletions rpm_spec/gui-daemon.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ rm -f %{name}-%{version}
/etc/xdg/autostart/qubes-icon-receiver.desktop
/etc/X11/xinit/xinitrc.d/qubes-localgroup.sh
/usr/libexec/qubes/watch-screen-layout-changes
/usr/libexec/qubes/wrappers/Xwayland
/usr/lib/qubes/icon-receiver
%config %{_sysconfdir}/qubes-rpc/qubes.WindowIconUpdater
%config %{_sysconfdir}/qubes/rpc-config/qubes.WindowIconUpdater
Expand Down
2 changes: 1 addition & 1 deletion shmoverride/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
X_wrapper_qubes
shmoverride.so

Xwayland-wrapper
7 changes: 5 additions & 2 deletions shmoverride/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extra_cflags := -g -O2 -I../include/ -fPIC -Wall -Wextra -Werror \
-I../include -fvisibility=hidden -pthread
CC=gcc

all: shmoverride.so X-wrapper-qubes
all: shmoverride.so X-wrapper-qubes Xwayland-wrapper

shmoverride.so: shmoverride.o ./list.o
$(CC) $(CFLAGS) $(extra_cflags) -shared -o shmoverride.so \
Expand All @@ -43,8 +43,11 @@ vpath %.c ../common

X-wrapper-qubes: X-wrapper-qubes.o

Xwayland-wrapper: Xwayland-wrapper.in
sed -e "s,@SHMOVERRIDE_LIB_PATH@,$(LIBDIR)/qubes-gui-daemon/shmoverride.so," < $< > $@

clean:
rm -f ./*~ ./*.o shmoverride.so X-wrapper-qubes
rm -f ./*~ ./*.o shmoverride.so X-wrapper-qubes Xwayland-wrapper

%.o: %.c Makefile
$(CC) -MD -MP -MF $@.dep -c -o $@ $(extra_cflags) $(CFLAGS) $<
Expand Down
4 changes: 4 additions & 0 deletions shmoverride/Xwayland-wrapper.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

export PATH="${PATH#*/wrappers:}"
exec env LD_PRELOAD="@SHMOVERRIDE_LIB_PATH@" Xwayland "$@"

0 comments on commit 1c5794d

Please sign in to comment.