Re: [PATCH] Fix Python crash on getprop deallocation

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



On Sat, Dec 25, 2021 at 11:25:51AM +0100, Luca Weiss wrote:
> Hi David,
> 
> On Samstag, 25. Dezember 2021 07:29:58 CET David Gibson wrote:
> > On Fri, Dec 24, 2021 at 11:28:12AM +0100, Luca Weiss wrote:
> > > Fatal Python error: none_dealloc: deallocating None
> > > Python runtime state: finalizing (tstate=0x000055c9bac70920)
> > > 
> > > Current thread 0x00007fbe34e47740 (most recent call first):
> > >   <no Python frame>
> > > 
> > > Aborted (core dumped)
> > > 
> > > This is caused by a missing Py_INCREF on the returned Py_None, as
> > > demonstrated e.g. in https://github.com/mythosil/swig-python-incref or
> > > described at https://edcjones.tripod.com/refcount.html ("Remember to
> > > INCREF Py_None!")
> > > 
> > > A PoC for triggering this crash is uploaded to
> > > https://github.com/z3ntu/pylibfdt-crash .
> > > With this patch applied to pylibfdt the crash does not happen.
> > 
> > Any chance you could rework your testcase into the libfdt testsuite
> > (make check)?
> > 
> 
> To be completely honest I don't exactly understand why this crash is 
> happening. If you reduce the iteration count in my PoC from the "10" I used to 
> just 1 or 2, then the crash doesn't happen. But I don't have any insights into 
> how Python actually allocates and deallocates things internally, as this crash 
> happens during dellocation when Python exits and after the supplied code is 
> already run.

Ok, fair enough.  Applied to main branch.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux