rapier1 / hpn-ssh

HPN-SSH based on OpenSSH
https://psc.edu/hpn-ssh-home
Other
331 stars 45 forks source link

Alpine linux: __linux__ def #50

Closed uichleba closed 1 year ago

uichleba commented 1 year ago

Small update to be able build hpn-ssh metrics.* because of included tcp and stdio libraries. __alpine__ macro it this case needs to be defined while ./configure or make call with:

CFLAGS="-D__alpine__" ./configure

Used libraries:

rapier1 commented 1 year ago

Hey there,

Sorry it's taken me longer than I'd like to get get back to you on this. Just a couple of questions, this is specifically for builds under Alpine linux. Correct? In the case someone is building this under Alpine do they still need to pass the "-Dalpine" cflag or is that going to end up being part of the build environment? If not, is there are decent way of getting this defined in configure.ac instead?

rapier1 commented 1 year ago

I've run into another problem under alpine. The dhgex regression test is failing with the AES-CTR ciphers. I've never really used alpine before so I don't know if it's something specific to the alpine build environment or not. It seems that the threaded AES-CTR cipher itself is broken under alpine. I segfault when I try to connect using it. It doesn't seem to be an openssl issue as I was able to get it to work with 3.1.2 on another host. Is there something odd about threading/pthreads on alpine?

I'm wondering if this is an issue with how musl implements pthreads.

uichleba commented 1 year ago

Hello,

Thank you for addressing this issue. In Alpine Linux, when I was building, I had to consistently add "-Dalpine" to the "./configure" command. Theoretically, when installing a package using "apk," the macro "alpine" should be automatically created in the configure.ac file, but I don't have experience with it yet.

Regarding the use of pthreads in Alpine Linux, it can cause a stack size issue, as it might be set to a small value and, consequently, lead to segfaults.

To address this, the environment variable PTHREAD_STACK_MIN is used.

rapier1 commented 1 year ago

Can you do me a favor and test using the aes ctr cipher. Sometime like ./hpnssh -caes256-ctr localhost would be enough. If it crashes could you try increasing the thread stack size and being me know if that helps?

On Thu, Jul 20, 2023, 16:58 Lukas Franek @.***> wrote:

Hello,

Thank you for addressing this issue. In Alpine Linux, when I was building, I had to consistently add "-Dalpine" to the "./configure" command. Theoretically, when installing a package using "apk," the macro "alpine" should be automatically created in the configure.ac file, but I don't have experience with it yet.

Regarding the use of pthreads in Alpine Linux, it can cause a stack size issue, as it might be set to a small value and, consequently, lead to segfaults.

To address this, the environment variable PTHREAD_STACK_MIN is used.

— Reply to this email directly, view it on GitHub https://github.com/rapier1/openssh-portable/pull/50#issuecomment-1644595685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKL66ENEKIKZYXWPTR3IRTXRGLVHANCNFSM6AAAAAA2HQ7XOE . You are receiving this because you commented.Message ID: @.***>

uichleba commented 1 year ago

I tried hpnssh -caes256-ctr localhost, and everything went smoothly, and I successfully logged in. I tested it in a Docker container with Alpine Linux v3.12.

uichleba commented 1 year ago

Btw. If You want a testing Dockerfile where I'm building a binaries with for a Alpine Linux, just ask. I would be glad to help you.

rapier1 commented 1 year ago

I wonder if my problem is that I was doing this in VM on an arm64 M1 Mac. I'll look into this. In the meantime, can you point to this docker you have? I have x86 dev servers I can use for testing.

On Fri, Jul 21, 2023, 05:59 Lukas Franek @.***> wrote:

I tried hpnssh -caes256-ctr localhost, and everything went smoothly, and I successfully logged in. I tested it in a Docker container with Alpine Linux v3.12.

— Reply to this email directly, view it on GitHub https://github.com/rapier1/openssh-portable/pull/50#issuecomment-1645327022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKL66F3VZEJELE42HTFBSDXRJHHLANCNFSM6AAAAAA2HQ7XOE . You are receiving this because you commented.Message ID: @.***>

rapier1 commented 1 year ago

So I figured out the problem we were having. You were right, it was a stack size issue. I'm working on right sizing the stack size and once that's done I'll incorporate the changes for alpine. I'll be changing some of it and try to get a configure time thing add the alpine cflag. So It might not be your exact PR but it will have your changes in it. That okay with you?

rapier1 commented 1 year ago

I just pushed out a new release candidate that incorporates your changes and fixes the stack size issue. Checkout 18v1-93p1-RC1 and see if it works under Alpine for you. For me it builds and tests out fine. If it works for you let me know and I'll close this PR. If not we can get back to work on it :)

uichleba commented 1 year ago

I apologize for the late response; I had a lot on my plate recently. I'm really glad that the stack size helped, and it doesn't matter that my PR won't be part of the repository. The main thing is that we've improved an already great project for others.

I'll try the final RC and let you know if it works. Once again, thank you so much, Chris, and I'll close this PR after confirmation.

uichleba commented 1 year ago

I tried the 18v1-93p1-RC1 branch, removed the CFLAGS, performed the build, and everything works perfectly. Thank you once again for your time; it was a pleasure, and I wish you all the best :).

I'm closing the PR - consider it resolved from my side.

uichleba commented 1 year ago

@rapier1 Hello Chris,

I apologize for the inconvenience, but I would like to ask a few things:

Thank you very much for your response.

rapier1 commented 1 year ago

1) The RC1 branch should be considered unstable. The master branch is where all stable releases go. We will also be starting to do actual releases through github with this version. We are in a bit of a transition period in terms of our release and branch structure. Going forward we'll be using a much more logical setup. 2) I hope we can do that this week. We're still doing some code clean up that the CI tests have brought to light. 3) I was really hoping you'd take on releasing an APK or getting it into the Alpine repo :) Right now we are largely focused on debian, fedora, and gentoo packaging. We hope to expand that when we can but it's just two people right now and it's a lot of work as it is. We are always looking for volunteers and collaborators though.

uichleba commented 1 year ago
  1. Great - having a stable releases with binaries or just code should be awesome
  2. That would be amazing, thanks a lot - I will switch to master after RC version will be merged
  3. Sure I was just asking. I will take a look how to make a apk package and let you know. Thanks