This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: simultaneous socket write/close causes panic?


Grant Edwards <grante@visi.com> writes:

> On Tue, Oct 29, 2002 at 03:30:58PM +0100, Andrew Lunn wrote:
> > On Tue, Oct 29, 2002 at 12:16:30AM -0800, NavEcos wrote:
> > > Correct me if I'm wrong (because I might be), but isn't this
> > > inherently a race condition in the first place?  These seems like an
> > > application programmer error to me, not an error of eCos.
> > 
> > It should not cause a panic. Either the write should succeed, or it
> > should return an err code saying the file is closed. These operations
> > should be atomic with respect to each other.
> 
> Agreed.  
> 
> We've run into similar problems in the past with this stack.
> The original socket handling code appeared to rely on the
> mutual exclusion provided by the BSD system call framework.
> This mutual exclusion is absent in eCos and had to be added
> within the stack code.  Back in the 1.3.1 days, we found that
> additional mutex code had to be added in one spot, and I
> suspect that this is a similar issue.
> 

Yep. This is precisely the problem. The BSD code relies on the fact
that all Unix kernel code is non-preemptable. Under eCos the network
code only becomes serialized when something call splnet() and is
unserialized as soon as it undoes it with an splx(). There is some
code executed outside this serialization that is prone to races.

I ported the BSD4.4 stack to Helios (another OS I designed) several
years ago, and had to simulate the Unix kernel environment with a big
lock around the whole stack which was claimed before making any calls
into it.

I have expressed my concerns about this several times over the past
few years. Perhaps it is time to sort this out properly once and for
all.

-- 
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]