[Bug 3996] New: When using --with-selinux, sshd is unnecessarily linked against libselinux

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue Sep 1 10:16:33 AEST 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3996

            Bug ID: 3996
           Summary: When using --with-selinux, sshd is unnecessarily
                    linked against libselinux
           Product: Portable OpenSSH
           Version: 10.5p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: sshd
          Assignee: unassigned-bugs at mindrot.org
          Reporter: cjwatson at debian.org

Created attachment 3984
  --> https://bugzilla.mindrot.org/attachment.cgi?id=3984&action=edit
Don't link sshd against libselinux

I noticed that Debian's /usr/sbin/sshd is linked against libselinux,
and wondered if that was really necessary.  We configure using
--with-selinux, but even so, that linkage seems as though it should
only be needed in sshd-auth and sshd-session.

With a bit of experimentation I was able to reorganize things so that
the linker (at least in Debian's configuration with -Wl,--as-needed)
realizes that it doesn't need to require that library: I split
openbsd-compat/port-linux.c into two pieces, and moved
disconnect_controlling_tty into sshd.c since it's used nowhere else.

This does partially revert b0899ee26a6630883c0f2350098b6a35e647f512
(upstream 39fd9e8ebd7222615a837312face5cc7ae962885), which you may not
consider desirable; I can try some different refactoring if you want to
point me in the right direction.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list