net-misc/openssh: Add a workaround to HPN for the OSX threading implemntation
authorPatrick McLean <chutzpah@gentoo.org>
Wed, 7 Sep 2016 04:54:04 +0000 (21:54 -0700)
committerPatrick McLean <chutzpah@gentoo.org>
Wed, 7 Sep 2016 04:54:23 +0000 (21:54 -0700)
The MT AES-CTR has a section of code that compares the currently running thread's
thread id with the first thread created. It seems on OSX, the first thread will
sometimes run before the thread ID is filled in (hence is zero), so this test
will fail, and the initialization code does not get run. This makes the test
also check if the thread ID of the first thread is 0, and run the initialization
code in that case as well.

Package-Manager: portage-2.3.0

net-misc/openssh/files/openssh-7.3_p1-hpn-update.patch

index 980a666f4924664b7ea0c8b19b11973865343ee4..8ae29e1e0551b924b6880fb154af4ee791d40e6f 100644 (file)
@@ -1,5 +1,5 @@
 --- openssh-7_2_P2-hpn-14.10.diff.orig 2016-09-01 10:34:05.905112131 -0700
-+++ openssh-7_2_P2-hpn-14.10.diff      2016-09-06 19:35:24.308215237 -0700
++++ openssh-7_2_P2-hpn-14.10.diff      2016-09-06 21:49:35.583704017 -0700
 @@ -156,145 +156,6 @@
        compat.o crc32.o deattack.o fatal.o hostfile.o \
        log.o match.o md-sha256.o moduli.o nchan.o packet.o opacket.o \
  +/*
  + * OpenSSH Multi-threaded AES-CTR Cipher
  + *
+@@ -737,7 +598,7 @@
+ +      * Handle the special case of startup, one thread must fill
+ +      * the first KQ then mark it as draining. Lock held throughout.
+ +      */
+-+     if (pthread_equal(pthread_self(), c->tid[0])) {
+++     if (pthread_equal(pthread_self(), c->tid[0]) || c->tid[0] == 0) {
+ +             q = &c->q[0];
+ +             pthread_mutex_lock(&q->lock);
+ +             if (q->qstate == KQINIT) {
 @@ -790,6 +651,7 @@
  +              * can see that it's being filled.
  +              */