Bug 336 - ssh does not compile on Linux with libc5 and 2.0 kernel
Summary: ssh does not compile on Linux with libc5 and 2.0 kernel
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: -current
Hardware: ix86 Linux
: P2 critical
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-04 22:25 AEST by Johan Wevers
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments
Add check for CMSG_FIRSTHDR to configure (697 bytes, patch)
2003-05-21 10:53 AEST, Darren Tucker
no flags Details | Diff
Add CMSG_DATA and CMSG_FIRSTHDR macros to monitor_fdpass.h (1.03 KB, patch)
2003-06-29 23:16 AEST, Darren Tucker
no flags Details | Diff
Make OpenSSH work on old Linuxes (2.27 KB, patch)
2003-08-06 18:42 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Wevers 2002-07-04 22:25:15 AEST
When compiling ssh on an older Linux system with a 2.0 kernel and libc5, compile errors arise because configure erroneously defines 
HAVE_CONTROL_IN_MSGHDR in config.h. This results in undefined references:

./libssh.a(monitor_fdpass.o): In function `mm_send_fd':
/Packages/ssh/openssh-3.4p1/monitor_fdpass.c:54: undefined reference to `CMSG_FIRSTHDR'
/Packages/ssh/openssh-3.4p1/monitor_fdpass.c:58: undefined reference to `CMSG_DATA'
./libssh.a(monitor_fdpass.o): In function `mm_receive_fd':
/Packages/ssh/openssh-3.4p1/monitor_fdpass.c:114: undefined reference to `CMSG_FIRSTHDR'
/Packages/ssh/openssh-3.4p1/monitor_fdpass.c:118: undefined reference to `CMSG_DATA'
make: *** [ssh] Error 1

Commenting out the line 

/* #define HAVE_CONTROL_IN_MSGHDR 1 */

results in a working version, although PrivilegeSeparation does not work then and you have to disable it in the config file.
Comment 1 Tim Rice 2002-07-08 10:57:28 AEST
Please post the section of your config.log where it is doing 
the msghdr tests.
Comment 2 Gaston Senac 2002-09-03 12:27:37 AEST
configure:13893: checking for msg_accrights field in struct msghdr
configure:13922: gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wno-
uninitialized -I/usr/local/ssl
/include  -L/usr/local/ssl/lib  conftest.c -lbsd -lz  -lcrypto >&5
configure: In function `main':
configure:13914: structure has no member named `msg_accrights'
configure:13925: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 13904 "configure"
#include "confdefs.h"

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_accrights
exit(1);
#endif
struct msghdr m;
m.msg_accrights = 0;
exit(0);
}

configure:13945: result: no
configure:13954: checking for msg_control field in struct msghdr
configure:13983: gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wno-
uninitialized -I/usr/local/ssl
/include  -L/usr/local/ssl/lib  conftest.c -lbsd -lz  -lcrypto >&5


ac_cv_have_accrights_in_msghdr=no
ac_cv_have_clock_t=yes
ac_cv_have_control_in_msghdr=yes


#define HAVE_CONTROL_IN_MSGHDR 1
Comment 3 Damien Miller 2003-05-14 22:34:38 AEST
I think that this was fixed in CVS recently:

 - (dtucker) Bug #544: ignore invalid cmsg_type on Linux 2.0 kernels,
   privsep should now work.
Comment 4 Darren Tucker 2003-05-14 23:33:42 AEST
Actually, I think this is a different problem to bug #544 but I've also had 
reports of libc5 working with recent OpenSSH versions.  Anyway, please try a 
snapshot and re-open this is not fixed.
Comment 5 Darren Tucker 2003-05-21 10:36:26 AEST
I've had a report from Dr. Oliver Schurr that this is still a problem with (at 
least) libc5 v5.4.46.
Comment 6 Darren Tucker 2003-05-21 10:53:23 AEST
Created attachment 308 [details]
Add check for CMSG_FIRSTHDR to configure 

Please try the attached patch.	You will need to run "autoreconf" to rebuild
configure.

Style question: is it OK to combine the tests like this (perhaps expanding on
the comment) or should I add another AC_TRY_RUN()?
Comment 7 Damien Miller 2003-05-21 11:10:43 AEST
Probably best as two tests (we need to rework configure significantly though)
Comment 8 Darren Tucker 2003-06-29 23:16:07 AEST
Created attachment 344 [details]
Add CMSG_DATA and CMSG_FIRSTHDR macros to monitor_fdpass.h

It seems that the kernel capabilities are there it's just the macros are
missing.  How about stealing the macros from OpenBSD rather the messing with
configure?  Then privsep might even work on those Linux/libc5 boxes.

Anyone care to test this?  I don't have an old enough Linux...
Comment 9 Darren Tucker 2003-08-06 18:42:37 AEST
Created attachment 365 [details]
Make OpenSSH work on old Linuxes

Found a really old redhat CD and installed it on my test machine....
# uname -r
1.2.13
# rpm -q libc
libc-5.2.18-1

The patch changes:
session.c: only does session_break_req if TIOCSBRK is defined.
bsd-misc.h: adds CMSG_DATA and CMSG_FIRSTHDR macros (stolen from OpenBSD).
canohost.c: only does check_ip_options if IP_OPTIONS is defined.

Everything appears to work OK apart from PrivSep (because mmap seems terminally
broken).  With a newer kernel with a working mmap, PrivSep might even work. 
Anyone complaining about older systems is on their own :-).

Anything objectionable in this patch?
Comment 10 Damien Miller 2003-08-07 08:54:29 AEST
The patchs looks good, except I think that the definitions added to bsd-misc.h
should instead go to defines.h
Comment 11 Darren Tucker 2003-08-07 16:07:47 AEST
OK, have moved the CMSG_* macros to defines.h, eliminated MY_ALIGN(), re-tested 
and committed.  If you want to try it, grab tomorrow's snapshot from:
ftp://ftp.ca.openbsd.org/pub/OpenBSD/OpenSSH/portable/snapshot/
Comment 12 Damien Miller 2004-04-14 12:24:18 AEST
Mass change of RESOLVED bugs to CLOSED