Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Apr 2012 00:14:45 GMT
From:      Gary Palmer <freebsd-gnats@in-addr.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/166548: Mismatch in ifdefs can cause problems for /sys/kern/sysv_shm.c
Message-ID:  <201204010014.q310EjgF031237@red.freebsd.org>
Resent-Message-ID: <201204010020.q310KCIV044608@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 01 00:20:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Gary Palmer
>Release:        FreeBSD 8.3-RC2
>Organization:
>Environment:
>Description:
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
>How-To-Repeat:
Remove

options         COMPAT_FREEBSD4
options         COMPAT_FREEBSD5
options         COMPAT_FREEBSD6
options         COMPAT_FREEBSD7

from a kernel config file on i386 but leave 

options         COMPAT_43

in
>Fix:
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) ||
    defined(COMPAT_43)



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204010014.q310EjgF031237>