-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] openssl core dumps under Ubuntu 22.04 when specifying the network service name instead of the port #2445
Comments
I think the PORT is determined here:
Let's check
Yes. So ... some checking if the PORT is a number? Or: remove non-numeric:
In one sed command:
|
OK ... an escape forward: accept and work with "nntps" and other descriptions: A few lines hacked together to get it working ... from the
|
That's a strange behavior from the shipped openssl binary. It works though when using an external new binary which is the default on Mac Silicon. The code looks different than I would write it today. I am terribly busy with other things atm, give me a ~week. |
I'll send a PR with cleaner code than my hacking above. |
Oh, wait: openssl does accept ":nntps". So why does it not work within testssl? Maybe I should find that out first?
|
As indicated, it depends on the openssl version. |
I looked into the sources of openssl and I couldn´t find translation or mapping of service --> port We were chasing a ghost, kind of: Same git commit as above. Also That's for Debian 11 and Opensuse Leap 15.5. Looks to me the OS tries to resolve that but not in your case (strace output:)
Sooo the best would be to find out why that fails on your machine and then look for the correct fix. |
It would be great to know the cause. I assume |
Correct: doesn't work either ... coredump too
|
Was able to reproduce this with a ootb Ubuntu Jammy Jellyfish: It core dumps when/after reading /etc/services 🤷🏽. Doesn't happen when the port is specified instead. Seems to be more a Ubuntu problem. As it is not an edge case we need a good workaround. Emphasis is on the work 'good'. Need to sleep on it. Recommended workaround is using |
Is the problematic openssl exe statically linked with glibc? If so, it could be symptomatic of known issues with glibc and its dependence upon libnss, which can not be statically linked. See this to get you started if you're not familiar with it. It seems plausible since getprotoent() depends upon NSS, to parse and adhere to nsswitch.conf If that is in fact the root of the issue (I'm not necessarily saying it is, but I might as well complete the thought at this point) then the "good" solution in my opinion would be to replace that statically linked exe with one built using a toolchain that is friendly towards static linking (and cross-compiling, for that matter) musl toolchains would be the obvious choice here Again, though- I'm making two assumptions here- that the toolchain used to build that exe used glibc, and that the NSS issue could in fact manifest as memory corruption/dumping core I didn't look if there was a "backtrace" and "info registers" from gdb posted, but it would probably be helpful if someone could take a look. Depending in your system you may be able to use "ulimit -c unlimited" to allow for a full core file |
Hey @mzpqnxow , this is a different problem, see my strace above, Did you see somewhere here getprotoent()? musl libc has performance issues and has also problems with NSS, at least in a container. Other then that: The toolchain I was using when compiling openssl the last time is very old. I did that deliberately because I wanted folks using old distros to use those binaries . That might contribute to the problem. In any case I'll try next time to upgrade the compile environment. One of the links you referred to was pointing to https://stackoverflow.com/questions/2725255/create-statically-linked-binary-that-uses-getaddrinfo . That might be helpful when recompiling. |
Assuming you mean do I see any sequences of system calls that may be in line with what glibc getprotoent() does - no, I don't. Though I imagine if it was an NSS issue, it might be triggered by any number of libc functions that reference nsswitch.conf (getservbyname, getaddrinfo, etc.) Regardless, if you're fairly certain it's not an NSS issue, I believe you
Pardon me as I hijack the issue for a moment 😀 I'm very surprised to hear of performance issues. I'm even more surprised to hear of issues manifesting in containers, especially given one of the most common bases for Docker containers (for services/applications at least) is Alpine with musl. If you have details on either I would be happy to raise them on the musl development list, I've had great experiences there EDIT: I see #2354 has some information on this, I may take a look out of curiosity I wonder if maybe you haven't given musl a fair shot recently? I'm being so insistent because I use it specifically for statically linked executables very regularly on all sorts of kernels (2.6, 3.x, 4.x, 5.x) and architectures (x64, x86, arm, mips) and haven't had any issues in as long as I can remember
Happy it may be helpful My last words on this, if you didn't see them coming... I can't recommend strongly enough that you reconsider using musl for this. Aside from the fact that glibc hasn't been intended for/supported with static linking for a long time (you know that already) musl just makes cross-compiling so much easier I will cease and desist now 😊 As always, thanks for the work you do on this project |
Wrong input, so PEBKAC, but core dumped, so worth reporting?
Before you open an issue please check which version you are running and whether it is the latest in stable / dev branch
I am running version
Before you open an issue please whether this is a known problem by searching the issues
Probably not related to #1934
Command line / docker command to reproduce
No problem when I use:
Expected behavior
Accept the
:nntps
, or reject it without core dump.Your system (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: