On Sat, Jul 18, 2020 at 12:29:54PM +0000, Martin wrote: > Abort trap (core dumped) appeared exactly after updating 6.7 to -current with > previously installed aria2 from 6.7 -stable package. > Rebuilding www/aria2 from 6.7 -current port didn't fix Abort trap (core > dumped). > > It seems aria2 port is broken with new SSL/TLS on 6.7 -current.
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On Wednesday, July 15, 2020 11:40 AM, Martin <martin...@protonmail.com> wrote: > > > After build aria2 on 6.7-current I'm having an issue with SSL/TLS handshake > > for encrypted connections (--bt-force-enctyption=true option). > > > > -> [SocketCore.cc:1021] errorCode=1 SSL/TLS handshake failure: protocol > > error > > assertion "0" failed: file "SocketCore.cc", line 987, function > > "tlsHandshake" > > Abort trap (core dumped) > > > > Malloc is set to CF if it matters for this particular issue. This is an explicit abort(3), not a malloc(3) related bug; I saw this a few days ago which is why I enabled aria2's debug package: $ aria2c --file-allocation=none ./some.torrent 07/18 18:43:41 [NOTICE] Downloading 1 item(s) 07/18 18:43:41 [NOTICE] IPv4 DHT: listening on UDP port 6911 07/18 18:43:41 [NOTICE] IPv4 BitTorrent: listening on TCP port 6976 07/18 18:43:41 [NOTICE] IPv6 BitTorrent: listening on TCP port 6976 assertion "0" failed: file "SocketCore.cc", line 987, function "tlsHandshake" Abort trap (core dumped) $ egdb --quiet -batch -ex bt `which aria2c` ./aria2c.core [New process 524909] Core was generated by `aria2c'. Program terminated with signal SIGABRT, Aborted. #0 thrkill () at -:3 3 -: No such file or directory. #0 thrkill () at -:3 #1 0x00001ec4eb0f23be in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51 #2 0x00001ec4eb131438 in _libc___assert2 (file=<optimized out>, line=<optimized out>, func=<optimized out>, failedexpr=<optimized out>) at /usr/src/lib/libc/gen/assert.c:52 #3 0x00001ec2314e068b in aria2::SocketCore::tlsHandshake (this=0x1ec4dd20d798, tlsctx=<optimized out>, hostname=...) at SocketCore.cc:987 #4 0x00001ec2314823e9 in aria2::HttpRequestCommand::executeInternal (this=0x1ec464d69b00) at HttpRequestCommand.cc:127 #5 0x00001ec23146c933 in aria2::AbstractCommand::execute (this=0x1ec464d69b00) at AbstractCommand.cc:303 #6 0x00001ec2313fcc38 in aria2::(anonymous namespace)::executeCommand (commands=..., statusFilter=aria2::Command::STATUS_ACTIVE) at DownloadEngine.cc:139 #7 0x00001ec2313fc912 in aria2::DownloadEngine::run (this=0x1ec4d3887200, oneshot=<optimized out>) at DownloadEngine.cc:183 #8 0x00001ec2313f1374 in aria2::MultiUrlRequestInfo::execute (this=0x1ec46141a818) at MultiUrlRequestInfo.cc:361 #9 0x00001ec2313c03ec in aria2::main (argc=<optimized out>, argv=<optimized out>) at main.cc:78 #10 0x00001ec2313c04dc in main (argc=3, argv=0x7f7ffffbec18) at main.cc:91 Internally, aria2 seems to leave the TLS version unset, i.e. using their TLS_PROTO_NONE instead of TLS_PROTO_TLS1[123]: ${WRKSRC}/src/SocketCore.cc:tlsHandShake(): 975 std::string tlsVersion; 976 switch (ver) { 977 case TLS_PROTO_TLS11: 978 tlsVersion = A2_V_TLS11; 979 break; 980 case TLS_PROTO_TLS12: 981 tlsVersion = A2_V_TLS12; 982 break; 983 case TLS_PROTO_TLS13: 984 tlsVersion = A2_V_TLS13; 985 break; 986 default: 987 assert(0); 988 abort(); 989 } I quickly glanced at the code path but didn't find a point where aria2 is potentially missing to set the proper TLS version. Simply avoiding above default case and continuing with TLS_PROTO_NONE however makes aria2 work reliably for me; this is what the diff below does. Perhaps someone well versed in TLS and/or aria2 code wants to take over? Upstreams official bug tracker seems to be their GitHub issue page, as I'm not interested in registering with GitHub, someone else could report this. Index: Makefile =================================================================== RCS file: /cvs/ports/www/aria2/Makefile,v retrieving revision 1.59 diff -u -p -r1.59 Makefile --- Makefile 15 Jul 2020 21:13:23 -0000 1.59 +++ Makefile 18 Jul 2020 16:55:42 -0000 @@ -7,6 +7,7 @@ V = 1.35.0 DISTNAME = aria2-${V} CATEGORIES = www HOMEPAGE = https://aria2.github.io/ +REVISION = 0 MAINTAINER = Gonzalo L. R. <gonz...@openbsd.org> Index: patches/patch-src_SocketCore_cc =================================================================== RCS file: patches/patch-src_SocketCore_cc diff -N patches/patch-src_SocketCore_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SocketCore_cc 18 Jul 2020 16:55:36 -0000 @@ -0,0 +1,13 @@ +$OpenBSD$ + +Index: src/SocketCore.cc +--- src/SocketCore.cc.orig ++++ src/SocketCore.cc +@@ -984,6 +984,7 @@ bool SocketCore::tlsHandshake(TLSContext* tlsctx, cons + tlsVersion = A2_V_TLS13; + break; + default: ++ break; + assert(0); + abort(); + }