Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2002 23:13:02 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Julian Elischer <julian@elischer.org>, bde@freebsd.org, current@freebsd.org, Alfred Perlstein <bright@mu.org>
Subject:   Re: ucred holding patch, BDE version
Message-ID:  <XFMail.020211231302.jhb@FreeBSD.org>
In-Reply-To: <3C6886C4.B2B08C5B@mindspring.com>

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

On 12-Feb-02 Terry Lambert wrote:
> John Baldwin wrote:
>> Yes, calling free() without Giant is about as good as calling fdrop()
>> without
>> Giant Alfred. :)
> 
> Alfred would be right, for per processor memory pools.  8-).
> 
>> >> And on the way into the system it does:
>> >> lock process
>> >> crhold() (which includes mutex ops)
>> >> unlock process
>> >
>> > This isn't needed, at least afaik.
>> 
>> Not strictly for the comparison as Julian and Terry pointed out since the
>> race
>> can occur anyway (i.e., you don't need the lock to see if p_ucred changed),
>> however, if you are actually doing a crhold(), you want to make sure p_ucred
>> isn't stale, so you need the proc lock.
> 
> No.  If you _depend_ on the frequency of change being low,
> you can do this with only atomic reference counts.  See the
> pseudo code in my other posting, in direct response to you.

Yes, the broken code with the race condition that can corrupt random kernel
structures long enough to trigger a panic or break a condition test in a branch
or loop.  I saw that, yes.

> -- Terry

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

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




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