Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Apr 2001 11:19:08 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        Matt Dillon <dillon@earth.backplane.com>, arch@FreeBSD.ORG
Subject:   Re: Found BAD BUG: squashed
Message-ID:  <Pine.BSF.4.21.0104191046120.5481-100000@besplex.bde.org>
In-Reply-To: <200104182323.QAA22635@usr07.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 Apr 2001, Terry Lambert wrote:

> > :The cr_ref is an unsigned short, and ...

This was fixed in -current in:

    RCS file: /home/ncvs/src/sys/sys/ucred.h,v
    Working file: ucred.h
    head: 1.22
    ...
    ----------------------------
    revision 1.18
    date: 2000/11/27 00:09:16;  author: alfred;  state: Exp;  lines: +11 -3
    ucred system overhaul:
    ...
    4) expand the size of the refcount from a u_short to an u_int, by using
       shorts we might have an overflow.

    Glanced at by: jake
    ----------------------------

> > 
> >     Ahhh..  Excellent find Terry!
> > 
> >     Why do you want to cycle a new credential when the unsigned short
> >     ref count reaches 65535 (what you call the right fix) verses simply
> >     changing the ref count to an unsigned long (what you call the quick
> >     and dirty fix)?  That seems kinda reversed to me.

> Because my use is not the common use, and it bloats the cred
> structure to a non-4-byte boundary, which I thought might end
> up being problematic for some people.

Bloatage of struct ucred occurred in 4.4BSD when uid_t's and gid_t's
were changed from 16 bits to 32 bits.  "u_short cr_ref" is followed
by "uid_t cr_uid", so there are normally 2 bytes wasted after "cr_ref".
These bytes can used for larger reference counts without changing the
size of the struct, but not without breaking binary compatibility.
Fortunately, "cr_ref" is invalid in userland.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104191046120.5481-100000>