amd64/86229: Missing recvmsg syscall in freebsd32 API causes sshd crash on amd64

Phil Regnauld pr-gnats at
Fri Sep 16 14:00:32 PDT 2005

>Number:         86229
>Category:       amd64
>Synopsis:       Missing recvmsg syscall in freebsd32 API causes sshd crash on amd64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 16 21:00:29 GMT 2005
>Originator:     Phil Regnauld
>Release:        FreeBSD 5.4-STABLE amd64
catpipe Systems ApS
System: FreeBSD j2 5.4-STABLE FreeBSD 5.4-STABLE #0: Thu Sep 15 21:21:01 CEST 2005     admin at j2:/usr/obj/usr/src/sys/JAIL  amd64


recvmsg(2) is not implemented in the freebsd32 compatibility layer.
>From /sys/compat/freebsd32/syscalls.master:

	; XXX implement
	27      AUE_NULL        UNIMPL  recvmsg

This is a problem when trying to run, among others sshd from i386/4-STABLE
or 5-STABLE (for example in a jail): if privilege separation (the default)
is used, then recvmsg is called by the child after the fork.  The missing
syscall causes a termination of sshd with SIGSYS (12):

	14143 sshd     CALL  recvmsg
	14143 sshd     RET   recvmsg -1 errno 78 Function not implemented
	14143 sshd     PSIG  SIGSYS SIG_DFL

This is a problem as both i386 and amd64 are Tier 1 platforms, and the
non availability of recvmsg() can be a problem for many applications.


Compile the following statically on 5.x/i386 or 4.x/i386 system and execute on
an amd64 system with "options COMPAT_IA32" in the kernel.

#include <sys/types.h>
#include <sys/socket.h>
#include <err.h>
#include <stdio.h>

        fprintf(stderr, "moo1\n");
        recvmsg(0, 0, 0);
        fprintf(stderr, "moo2\n");
        err(1, "moo");
        return 0;


	No known fix.  In the case of sshd, disable privilege separation 
	in /etc/ssh/sshd_config (not necessary if logging in as root).

More information about the freebsd-amd64 mailing list