diff options
author | aszlig <aszlig@redmoonstudios.org> | 2016-04-04 11:50:30 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2016-04-04 12:42:31 +0200 |
commit | e549839f61eeee87a575ccc132eff8099e333c32 (patch) | |
tree | bf5a4d7fd6eeb07054bdbb01363af3a6bf938d99 /modules/programs/gpg-agent/default.nix | |
parent | 11e6c261e8a0bd19378b5f2a3f5ac4277d748a94 (diff) |
modules/gpg-agent: Use dlopen() for libsystemd
Latest <nixpkgs> (NixOS/nixpkgs@e899ffc as of my latest pull) causes our preloader to load fork() from libpthread instead of using the overridden one from the preload wrapper (without store paths to be easier to read): binding file gpg-agent [0] to libpthread.so.0 [0]: normal symbol `fork' [GLIBC_2.2.5] However, at the time I've committed 8db1803, I was testing it on an older version (NixOS/nixpkgs@81af597) and it was bound correctly: binding file gpg-agent [0] to gpg-agent-wrapper [0]: normal symbol `fork' [GLIBC_2.2.5] Now after bisecting this against the latest <nixpkgs> master, it revealed that one of the following commits could be the problem: * NixOS/nixpkgs@559ecc9: stdenv-linux: Avoid building m4/bison twice * NixOS/nixpkgs@817145e: binutils: 2.23.1 -> 2.26 * NixOS/nixpkgs@2040a9a: stdenv-linux: Ensure binutils comes before bootstrapTools in $PATH So my guess was that the binutils update changed that behaviour somehow, so I checked against 2.23.1 (reverted NixOS/nixpkgs@817145e) and 2.25 and it worked correctly. I didn't bisect this against the binutils source tree, but what happens is that because we depend on libsystemd in our wrapper, libsystemd (and thus libpthread) is loaded first and thus we can't override things anymore which get pulled in by RTLD while loading libsystemd. The reason why I now went with dlopen() is that even if the behaviour is back to that of binutils 2.25, we want to make sure that even if something in ld.so should change which affect this as well we're still not tripping into the same problem again. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/programs/gpg-agent/default.nix')
-rw-r--r-- | modules/programs/gpg-agent/default.nix | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/programs/gpg-agent/default.nix b/modules/programs/gpg-agent/default.nix index 81a113f7..139813d0 100644 --- a/modules/programs/gpg-agent/default.nix +++ b/modules/programs/gpg-agent/default.nix @@ -23,8 +23,9 @@ let inherit pinentryWrapper; } '' cc -Wall -shared -std=c11 \ - $(pkg-config --cflags --libs libsystemd) -ldl \ + -DLIBSYSTEMD=\"${pkgs.systemd}/lib/libsystemd.so\" \ -DPINENTRY_WRAPPER=\"$pinentryWrapper\" \ + $(pkg-config --cflags libsystemd) -ldl \ "${./agent-wrapper.c}" -o "$out" -fPIC ''; |