[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] possible bug in sys_s_lbclose



On Wed, 2010-12-22 at 10:57 +0000, Helmut Karlowski wrote:
> Alan Hourihane wrote:
> 
> > On Sun, 2010-12-19 at 16:15 +0100, Helmut Karlowski wrote:
> > > Hello,
> > >
> > > When closing an slb-process, the flag P_FLAG_SLB is reset before
> > > terminating the slb.
> > >
> > > When free_ext is called by terminate, the parent may not be knowing if all
> > > data is malloced. In XaAES this may cause a duplicate free because the
> > > slb-ext-data (which may contain pointers to malloced data) is copied from
> > > its caller. This second free causes a system-HALT.
> > >
> > > I'd like to have an additional flag in p_flag for the slb-process to
> > > inform XaAES to not call free in this case.
> > >
> > > Would this be possible, or is there a better way?
> >
> > I wouldn't like adding an additional flag just to indicate a free
> > status.
> >
> > Wouldn't re-ordering things be possible for P_FLAG_SLB ?
> 
> 
> Problem here is that one release is called by MiNT, the other from
> XaAES. I don't know if the order can be exchanged, but if so there would
> still be a possible risk in other situations.

Then a simple lock/unlock should suffice, and then some null pointer
checking. No additional flags required.

Alan.