kinit: Increase environment size limit
start_kdeinit reads its environment over a pipe from start_kdeinit_wrapper. For security, each environment entry must be smaller than 4kb by default. Qt-based applications in Nixpkgs may have larger environments, and the recent upgrade to Plasma 5.17 pushed start_kdeinit_wrapper over the limit. The limit is now extended to 16kb. This problem was not detected during testing because the failure is silent: start_kdeinit will continue with an empty environment. In other circumstances, this strategy might work, but it does not work on NixOS. This failure is now treated as a fatal error. Fixes: #79707
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
From 715c5f461b4992dac066601202a673bc551a5e33 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Tuegel <ttuegel@mailbox.org>
|
||||
Date: Sun, 16 Feb 2020 14:23:31 -0600
|
||||
Subject: [PATCH 1/4] kinit-libpath
|
||||
|
||||
---
|
||||
src/kdeinit/kinit.cpp | 22 +++++++++-------------
|
||||
1 file changed, 9 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp
|
||||
index 8fff17a..0801b75 100644
|
||||
--- a/src/kdeinit/kinit.cpp
|
||||
+++ b/src/kdeinit/kinit.cpp
|
||||
@@ -622,19 +622,15 @@ static pid_t launch(int argc, const char *_name, const char *args,
|
||||
|
||||
if (!libpath.isEmpty()) {
|
||||
if (libpath_relative) {
|
||||
- // NB: Because Qt makes the actual dlopen() call, the
|
||||
- // RUNPATH of kdeinit is *not* respected - see
|
||||
- // https://sourceware.org/bugzilla/show_bug.cgi?id=13945
|
||||
- // - so we try hacking it in ourselves
|
||||
- QString install_lib_dir = QFile::decodeName(
|
||||
- CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/");
|
||||
- QString orig_libpath = libpath;
|
||||
- libpath = install_lib_dir + libpath;
|
||||
- l.setFileName(libpath);
|
||||
- if (!l.load()) {
|
||||
- libpath = orig_libpath;
|
||||
- l.setFileName(libpath);
|
||||
- l.load();
|
||||
+ // Try to load the library relative to the active profiles.
|
||||
+ QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
|
||||
+ // Reverse the profile list.
|
||||
+ std::reverse(profiles.begin(), profiles.end());
|
||||
+ for (const QByteArray &profile: profiles) {
|
||||
+ if (!profile.isEmpty()) {
|
||||
+ l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath);
|
||||
+ if (l.load()) break;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
l.load();
|
||||
--
|
||||
2.23.1
|
||||
|
||||
Reference in New Issue
Block a user