kern/166548: Mismatch in ifdefs can cause problems for /sys/kern/sysv_shm.c

Gary Palmer freebsd-gnats at
Sun Apr 1 00:20:13 UTC 2012

>Number:         166548
>Category:       kern
>Synopsis:       Mismatch in ifdefs can cause problems for /sys/kern/sysv_shm.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 01 00:20:12 UTC 2012
>Originator:     Gary Palmer
>Release:        FreeBSD 8.3-RC2
While upgrading an old 7.x kern config file to 8.x I stumbled across a problem
where if you leave COMPAT_43 in your config file without one of COMPAT_FREEBSD4 through COMPAT_FREEBSD7 the compile breaks.  The problem comes from /sys/sys/ipc.h where ipc_perm_old is only defined if one of 

#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)

is true.  However in /sys/kern/sysv_shm.c the code has

#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43))
struct oshmid_ds {
        struct  ipc_perm_old shm_perm;  /* operation perms */

So if you put COMPAT_43 in your config file and leave out one of the COMPAT_FREEBSD options ipc_perm_old isn't defined.  It seems that COMPAT_43 should probably be added to the ifdef conditionals in /sys/sys/ipc.h

options         COMPAT_FREEBSD4
options         COMPAT_FREEBSD5
options         COMPAT_FREEBSD6
options         COMPAT_FREEBSD7

from a kernel config file on i386 but leave 

options         COMPAT_43

Untested, but I suspect modifying the code at line 72 of /sys/sys/ipc.h would fix it.  Something like:

#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) ||


More information about the freebsd-bugs mailing list