Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend shmoverride init config #152

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

marmarek
Copy link
Member

Support adding LD_PRELOAD to a parent process too (for example wayland compositor that only later will start Xwayland). See commit messages for details.

Note, this approach does not work together with linking with -z initfirst.

Built on top of #151

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
If shmoverride init fails to take the lock, it likely means it is used
by currently running process - do _not_ remove the file in such a case.
This may happen if LD_PRELOAD leaks to child processes (which seems to
happend on Xwayland when shmoverride is linked with -z initfirst).
But also, if X server is started several times for some reason (for
example user calls it manually), it will abort, but not early enough to
skip shmoverride init.

QubesOS/qubes-issues#8515
Look for display number as the first thing after stuff necessary to work
in passive mode. This will be relevant for filtering which process gets
shmoverride enabled.

QubesOS/qubes-issues#8515
This allows setting LD_PRELOAD earlier for some parent process, and have
it actually applied to selected child process.
This is especially helpful for Xwayland that is started by the wayland
compositor and rarely has an option to change binary path (contrary to
display managers starting Xorg). This feature allows setting LD_PRELOAD
on the compositor itself, and have it affected only Xwayland process.

Note, this feature does not work if shmoverride is linked with -z
initfirst, as getenv()/unsetenv() are not working in that case.

QubesOS/qubes-issues#8515
@marmarek
Copy link
Member Author

This does not work with kwin. LD_PRELOAD is not passed down to children.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants