Page MenuHomeFreeBSD

openssh: Add ${SKSRCS} to libssh
ClosedPublic

Authored by jlduran on Apr 25 2025, 3:14 PM.
Tags
None
Referenced Files
F132577231: D50020.diff
Sat, Oct 18, 3:06 AM
Unknown Object (File)
Tue, Oct 7, 5:43 AM
Unknown Object (File)
Thu, Oct 2, 8:48 PM
Unknown Object (File)
Sat, Sep 27, 2:42 AM
Unknown Object (File)
Mon, Sep 22, 6:20 AM
Unknown Object (File)
Sep 14 2025, 1:38 AM
Unknown Object (File)
Sep 13 2025, 8:46 AM
Unknown Object (File)
Sep 12 2025, 12:18 PM

Details

Summary

sshkey.c references sshsk_sign(), which is defined in ${SKSRCS}.

Due to how FreeBSD builds libssh, or put differently, due to upstream
not building a shared libssh.so, we need to partially revert
65d8491719bb ("secure: Adapt Makefile to ssh-sk-client everywhere"), and
add ${SKSRCS} back, to avoid linking problems, especially when building
with GCC:

/usr/local/bin/ld:
/usr/obj/usr/src/amd64.amd64/secure/lib/libssh/libprivatessh.so:
undefined reference to `sshsk_sign'
collect2: error: ld returned 1 exit status`

Put the sources in a separate line, to maintain line-by-line
compatibility with upstream Makefile.in

PR: 286580
Fixes: 65d8491719bb ("secure: Adapt Makefile to ssh-sk-client everywhere")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This should fix sh freebsd-namespace.sh and technically, we can (should?) now revert a098111a28ed59e1ab1101ad09913f0235ebd28f.
In my opinion this is the least obstructive way forward.

Thank you @jrtc27 and @lattera-gmail.com for the observations, and @jhb for checking against gcc.

This isn't about namespacing though. Even without the namespacing you'd just have undefined symbols for the symbol without the prefix. Doesn't this just revert your earlier change though, and shouldn't we now drop all of the SKSRCS in all of the other Makefiles (not just the ones I added) since they are now redundant?

In D50020#1141667, @jhb wrote:

This isn't about namespacing though. Even without the namespacing you'd just have undefined symbols for the symbol without the prefix. Doesn't this just revert your earlier change though, and shouldn't we now drop all of the SKSRCS in all of the other Makefiles (not just the ones I added) since they are now redundant?

Yes, I am being extra cautious, I don't mind a bit of redundancy in favor of having matching SRCS, this way, if there is something redundant here, we just complain upstream (we are not quite there yet).
The other option would be to regenerate the FreeBSD-specific header ssh_namespace.h (which will remove Fssh_{client_converse, sshsk_enroll, sshsk_free_resident_keys, sshsk_load_resident, and sshsk_sign}): I don't know, I prefer doing things as they were, but this time having our Makefiles closer to Makefile.in.

sshkey.c references sshsk_sign(), which is defined in ssh-sk-client.c and in ssh-sk.c
We need the definition in order to successfully link (with GCC), add it back to libssh in a separate line.
I need to investigate why it is not needed using plain openssh-portable.

I need to investigate why it is not needed using plain openssh-portable.

I think upstream only builds a libssh.a, and the offending object won't be linked.

It would be good to include a sample of the error in the comment and perhaps mention that this differs from upstream because upstream doesn't build a shared libssh.so

  • Address suggestions
This revision is now accepted and ready to land.May 16 2025, 2:55 PM
This revision was automatically updated to reflect the committed changes.