Skip to content

Commit

Permalink
rtorrent: backport _FORTIFY_SOURCE=3 stack smashing fix
Browse files Browse the repository at this point in the history
Without the change on current `master` `rtorrent` crashes at start as:

*** buffer overflow detected ***: terminated
                                                                                        __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44      pthread_kill.c: No such file or directory.
(gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
    NixOS#1  0x00007ffff7880af3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
    NixOS#2  0x00007ffff7831c86 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    NixOS#3  0x00007ffff781b8ba in __GI_abort () at abort.c:79
    NixOS#4  0x00007ffff781c5f5 in __libc_message (fmt=fmt@entry=0x7ffff7992540 "*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:150
    NixOS#5  0x00007ffff7910679 in __GI___fortify_fail (msg=msg@entry=0x7ffff79924e6 "buffer overflow detected") at fortify_fail.c:24
    NixOS#6  0x00007ffff790eea4 in __GI___chk_fail () at chk_fail.c:28
    NixOS#7  0x00007ffff790ea85 in ___snprintf_chk (s=<optimized out>, maxlen=<optimized out>, flag=<optimized out>, slen=<optimized out>, format=<optimized out>) at snprintf_chk.c:29
    NixOS#8  0x0000000000472acf in utils::Lockfile::try_lock() ()
    NixOS#9  0x000000000044b524 in core::DownloadStore::enable(bool) ()
    NixOS#10 0x00000000004b1f7b in Control::initialize() ()
    NixOS#11 0x000000000043000b in main ()
  • Loading branch information
trofi committed Sep 13, 2023
1 parent 8fd97b6 commit bd2f50c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkgs/applications/networking/p2p/rakshasa-rtorrent/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, stdenv
, fetchurl
, fetchFromGitHub
, fetchpatch
, autoreconfHook
, autoconf-archive
, cppunit
Expand All @@ -27,6 +28,16 @@ stdenv.mkDerivation rec {
hash = "sha256-er7UdIb+flhq0ye76UmomgfHV2ZSBROpXmfrNDHwTWw=";
};

patches = [
# Backport fix for _FORTIFY_SOURCE=3 stack smash detection.
# https://github.com/rakshasa/rtorrent/pull/1169
(fetchpatch {
name = "fortify3.patch";
url = "https://github.com/rakshasa/rtorrent/commit/812bba81bc049a5f786282b3654cab294b0ef236.patch";
hash = "sha256-WopCiMeUhcBIq8MQOIzFJN2QXeLHcSkQdz3K2QCmwgc=";
})
];

passthru = {
inherit libtorrent;
};
Expand Down

0 comments on commit bd2f50c

Please sign in to comment.