tech-kern archive

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

Re: psref leak detector (aggressive version)



On Fri, May 10, 2019 at 7:01 PM Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
>
> Hi,
>
> https://www.netbsd.org/~ozaki-r/psref-debug-aggressive.diff
>
> This patch implements yet another psref leak detector that
> enables to tell where a leak occurs while a simpler version
> that is already committed just tells an occurrence of a leak.
>
> Investigating of psref leaks is hard because once a leak occurs
> a percpu list of psref that tracks references can be corrupted.
> A reference to a tracking object is memorized in the list
> via an intermediate object (struct psref) that is normally allocated
> on a stack of a thread.  Thus, the intermediate object can be
> overwritten on a leak resulting in corrupt of the list.
>
> The tracker makes a shadow entry to an intermediate object and
> stores some hints into it (currently it's a caller address of
> psref_acquire).  We can detect a leak by checking the entries on
> certain points where any references should be released such as
> the return point of syscalls and the end of each softint handler.
>
> Note that the current version is based on -current.  Once the
> simpler version is revised as using lwp_specificdata [*], the
> patch will be tweaked too.
>
> [*] http://mail-index.netbsd.org/source-changes-d/2019/05/08/msg011297.html
>
> Any comments?

FYI I've committed the patch last week.

Note that the patch has been committed without tweaks mentioned above
because the simpler version is decided to be kept as is.

  ozaki-r


Home | Main Index | Thread Index | Old Index