From eed0bc3ebd15bf94a28ca019ab656a3a0bc0d258 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Sun, 30 Sep 2018 15:11:24 +0300 Subject: Add support for installing binaries with DT_RPATH It's better to use DT_RPATH dynamic section of the elf binary to store the paths of libraries to load instead of overwriting LD_LIBRARY_PATH for the whole environment, causing surprises. This solution is much more transparent and perfectly suitable for running contained installations of wayland/wlroots/sway. The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as it's a placebo security at best - we should trust the execution path that leads us to running sway, and it's way too late to care about those variables since we already started executing our compositor, thus we would be compromised anyway. --- sway/main.c | 8 -------- sway/meson.build | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'sway') diff --git a/sway/main.c b/sway/main.c index 50b05b21..dea4a31c 100644 --- a/sway/main.c +++ b/sway/main.c @@ -241,14 +241,6 @@ int main(int argc, char **argv) { " --get-socketpath Gets the IPC socket path and prints it, then exits.\n" "\n"; - // Security: - unsetenv("LD_PRELOAD"); -#ifdef _LD_LIBRARY_PATH - setenv("LD_LIBRARY_PATH", _LD_LIBRARY_PATH, 1); -#else - unsetenv("LD_LIBRARY_PATH"); -#endif - int c; while (1) { int option_index = 0; diff --git a/sway/meson.build b/sway/meson.build index b6394ecb..6eb9a9d7 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -187,5 +187,6 @@ executable( include_directories: [sway_inc], dependencies: sway_deps, link_with: [lib_sway_common], + install_rpath : rpathdir, install: true ) -- cgit v1.2.3