Block all signals during store_pageinfo() and free_unclaimed_pages()
The friendly folks at #musl again:
21:34 < dalias> the cheap way around this problem is to block signals for the
entire duration of the unsafe operation
21:35 < dalias> formally (by the rules of the standard) this is not sufficient
21:35 < dalias> because formally it's not just calling pthread_mutex_lock again
on the same mutex while the first call is interrupted that's undefined
21:36 < dalias> it's calling ANY unsafe function while ANY unsafe function (the
same or otherwise) with any argument (e.g. not necessarily the same mutex)
that gives undefined behavior
21:38 < dalias> but real-world-implementations don't have this maximum
theoretical degree of unsafety
21:38 < dalias> so the approach i described (just ensuring your functions don't
interrupt themselves or each other) should be enough to make them safe
Showing
Please
register
or
sign in
to comment