diff mbox series

[PATCHv4,1/5] libx11: create tmpfile dir for x11 domain socket

Message ID 20250515214919.1404453-2-rs@ti.com
State New
Headers show
Series Display manager proposal for x11 and wayland | expand

Commit Message

Randolph Sapp May 15, 2025, 9:49 p.m. UTC
From: Randolph Sapp <rs@ti.com>

Register a tmpfile.d or volatile directory entry for the x11 domain
socket so this will always be created with the correct permissions.

Currently some x11 related applications will create this directory if it
doesn't already exist, but this is not true for everything. In addition,
if the application in question isn't started as root, it's possible this
directory can be owned by a non-root user. This isn't an issue by
itself, but it can potentially lead to problems in a multi-user
environment.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Denys Dmytriyenko May 15, 2025, 10:54 p.m. UTC | #1
On Thu, May 15, 2025 at 04:49:15PM -0500, rs@ti.com wrote:
> From: Randolph Sapp <rs@ti.com>
> 
> Register a tmpfile.d or volatile directory entry for the x11 domain
> socket so this will always be created with the correct permissions.
> 
> Currently some x11 related applications will create this directory if it
> doesn't already exist, but this is not true for everything. In addition,
> if the application in question isn't started as root, it's possible this
> directory can be owned by a non-root user. This isn't an issue by
> itself, but it can potentially lead to problems in a multi-user
> environment.
> 
> Signed-off-by: Randolph Sapp <rs@ti.com>
> ---
>  meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb b/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
> index 5ce5481743..59df95291a 100644
> --- a/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
> +++ b/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
> @@ -36,6 +36,19 @@ PACKAGECONFIG[xcms] = "--enable-xcms,--disable-xcms"
>  
>  PACKAGES =+ "${PN}-xcb"
>  
> +do_install:append() {
> +	# temporary directory required for x11 domain sockets
> +	if ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'true', 'false', d)}; then
> +		install -d ${D}${libdir}/tmpfiles.d
> +		echo "D! /tmp/.X11-unix 1777 root root 10d" \
> +			> ${D}${libdir}/tmpfiles.d/x11.conf
> +	else
> +		install -d ${D}${sysconfdir}/default/volatiles
> +		echo "d root root 1777 /tmp/.X11-unix none" \
> +			> ${D}${sysconfdir}/default/volatiles/99_x11
> +	fi

Hmm, can we have these as actual files and install them accordingly, instead 
of generating them on the fly? Otherwise it gets harder to modify or adjust 
them downstream.


> +}
> +
>  FILES:${PN} += "${datadir}/X11/XKeysymDB ${datadir}/X11/XErrorDB ${datadir}/X11/Xcms.txt"
>  FILES:${PN}-xcb += "${libdir}/libX11-xcb.so.*"
>  FILES:${PN}-locale += "${datadir}/X11/locale ${libdir}/X11/locale"
> -- 
> 2.49.0
diff mbox series

Patch

diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb b/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
index 5ce5481743..59df95291a 100644
--- a/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
+++ b/meta/recipes-graphics/xorg-lib/libx11_1.8.12.bb
@@ -36,6 +36,19 @@  PACKAGECONFIG[xcms] = "--enable-xcms,--disable-xcms"
 
 PACKAGES =+ "${PN}-xcb"
 
+do_install:append() {
+	# temporary directory required for x11 domain sockets
+	if ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'true', 'false', d)}; then
+		install -d ${D}${libdir}/tmpfiles.d
+		echo "D! /tmp/.X11-unix 1777 root root 10d" \
+			> ${D}${libdir}/tmpfiles.d/x11.conf
+	else
+		install -d ${D}${sysconfdir}/default/volatiles
+		echo "d root root 1777 /tmp/.X11-unix none" \
+			> ${D}${sysconfdir}/default/volatiles/99_x11
+	fi
+}
+
 FILES:${PN} += "${datadir}/X11/XKeysymDB ${datadir}/X11/XErrorDB ${datadir}/X11/Xcms.txt"
 FILES:${PN}-xcb += "${libdir}/libX11-xcb.so.*"
 FILES:${PN}-locale += "${datadir}/X11/locale ${libdir}/X11/locale"