!kyXJonZuBXCGzVwuSn:nixos.org

Systems Programming

173 Members
Kernel, stdenv, low-level hacking, patchelf, … 63 Servers

Load older messages


SenderMessageTime
9 Jun 2022
@v0id:nltrix.netv0|d joined the room.22:39:47
10 Jun 2022
@kn:envs.netkn TIL dlopen(3) treats DT_RUNPATH differently on linux and bsd, which is why the program needs LD_LIBRARY_PATH=/path/to/module on linux but only /path/to/module added to DT_RUNPATH on e.g. openbsd 04:37:36
@kn:envs.netknconsider a program that dynamically links against a shared library which dlopen()s another shared library, e.g. a gui app that loads smart-card modules at runtime through Qt's QtLibrary04:39:57
@kn:envs.netkn LD_LIBRARY_PATH always overrules but it's inherited by children and generally too broad, so one should avoid that if possible. 04:40:48
@kn:envs.netkn dlopen() search order on linux is basically 1. DT_RPATH (deprecated), 2. LD_LIBRARY_PATH, 3. DT_RUNPATH, 4. default libs 04:41:56
@kn:envs.netkn * dlopen() search order on linux is basically 1. DT_RPATH (deprecated), 2. LD_LIBRARY_PATH, 3. DT_RUNPATH, 4. default paths (useless with nix) 04:42:19
@kn:envs.netkn DT_RUNPATH is read from the calling object, i.e. if a gui app uses libQtCore.so to eventually dlopen() a module, the library path of libQtCore.so alone is used 04:44:44
@kn:envs.netknwhich is generally fine in non-nix systems, but on nixos where you define your gui app's dependency on the smart-card module in the gui app and not the generic Qt library, things are different04:45:54
@kn:envs.netkn that means you can patchelf --set-rpath /path/to/module my-gui-program but it won't help anything and LD_LIBRARY_PATH is required to overrule the library path for everything 04:47:08
@kn:envs.netknon at least openbsd, dlopen() will continue to search the main program's runtime path if the calling object (here the Qt library) doesn't have it in its search path04:49:20
@kn:envs.netkn which in turn allows exactly this kind of minimal patchelf ... fixup above to work 04:50:07
@kn:envs.netkn i think openbsd's behaviour makes sense, and it is especially useful on nixos where default library paths (/usr/lib, etc.) never yield a working fallback 04:51:08
@joerg:thalheim.ioMic92
In reply to @kn:envs.net
TIL dlopen(3) treats DT_RUNPATH differently on linux and bsd, which is why the program needs LD_LIBRARY_PATH=/path/to/module on linux but only /path/to/module added to DT_RUNPATH on e.g. openbsd
Some environment variable for libraries that is not inherited by child processes would be also useful. Than we could just set a path for an executables but won't break other binaries that are called from it.
05:47:03
@joerg:thalheim.ioMic92 One could have a special patched libc that has a different dlopen behavior and than patchelf it's link loader just for applications that needs it. 05:50:55
@kn:envs.netkn
In reply to @joerg:thalheim.io
Some environment variable for libraries that is not inherited by child processes would be also useful. Than we could just set a path for an executables but won't break other binaries that are called from it.
I think LD_PRELOAD is not inherited, but it takes object names not paths, so this semantic change might not be applicable to every program expecting prefix based lookup
05:51:03
@joerg:thalheim.ioMic92
In reply to @kn:envs.net
I think LD_PRELOAD is not inherited, but it takes object names not paths, so this semantic change might not be applicable to every program expecting prefix based lookup
Maybe there could be a special LD_PRELOAD that just preloads further libraries.
05:52:44
@joerg:thalheim.ioMic92like a list05:52:47
@joerg:thalheim.ioMic92If an object is already loaded than dlopen should just use that, no?05:53:16
@kn:envs.netkn
In reply to @joerg:thalheim.io
If an object is already loaded than dlopen should just use that, no?
yes
05:54:43
@joerg:thalheim.ioMic92Also are you, that LD_PRELOAD is not inherited?05:54:54
@kn:envs.netkn
In reply to @joerg:thalheim.io
Also are you, that LD_PRELOAD is not inherited?
I'm not [sure], that's why I wrote "think"
05:55:23
@joerg:thalheim.ioMic92This tool depends on LD_PRELOAD being inherited: https://github.com/rizsotto/Bear05:56:06
@kn:envs.netkn just reread ld.so(1) and the env var is inherited, but --preload is there as a one-shot mechanism 05:56:58
@kn:envs.netkn * just reread ld.so(8) and the env var is inherited, but --preload is there as a one-shot mechanism 05:57:46
@kn:envs.netkn
In reply to @joerg:thalheim.io
One could have a special patched libc that has a different dlopen behavior and than patchelf it's link loader just for applications that needs it.
you can also use ldconfig(8) :)
06:03:56
13 Jun 2022
@woobilicious:matrix.orgwoobilicious Mic92: how do I configure networking to work in nixos-shell? did I just forget to enable it in my kernel. 21:56:11
@woobilicious:matrix.orgwoobilicioussure enough CONFIG_VIRTIO_NET was disabled...lol22:00:38
14 Jun 2022
@kity:kity.wtfash (it/its) 🏳️‍⚧️ changed their profile picture.00:41:53
@joerg:thalheim.ioMic92 woobilicious: yeah. This is really just the builtin qemu networking. I don't think nixos-shell itself enables virtio for networking but maybe the qemu abstraction that it takes from nixpkgs, does that: https://github.com/Mic92/nixos-shell/blob/master/share/modules/nixos-shell-config.nix 07:08:11
19 Jun 2022
@woobilicious:matrix.orgwoobiliciousAnyone else having issues with 9p file system?09:11:03

There are no newer messages yet.


Back to Room ListRoom Version: 6