Page MenuHomeFreeBSD

cxa_thread_call_dtors(): restore limit on the number of destructors called
Needs ReviewPublic

Authored by kib on Mon, Mar 23, 6:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 30, 12:33 PM
Unknown Object (File)
Mon, Mar 30, 12:00 PM
Unknown Object (File)
Mon, Mar 30, 5:09 AM
Unknown Object (File)
Mon, Mar 30, 12:59 AM
Unknown Object (File)
Sun, Mar 29, 1:08 PM
Unknown Object (File)
Sun, Mar 29, 2:10 AM
Unknown Object (File)
Sat, Mar 28, 2:32 AM
Unknown Object (File)
Wed, Mar 25, 11:10 AM
Subscribers

Details

Summary
If the exiting thread has a destructor registered that keeps
re-registering itself, the function loops forever. Implement
approximation for the number of passes over the desctructor list as it
was done before 9d26b82826d99.  Maintain the count of destructors
registered, and break out of the loop if we called more destructors then
the memoized count times CXA_DTORS_ITERATIONS.

__cxa_thread_call_dtors(3): bump number of iterations

This allows more breezing room for somewhat weird code that registers
thread-local destructors at destruction time.  At the same time, we
still limit the amount of iterations, making this aspect of the thread
termination time-bound.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib edited the summary of this revision. (Show Details)
kib added reviewers: markj, emaste, aokblast.

Bump the iteration limit. Request review.

Seems ok, but I'm not sure if it's sufficient for the LLVM test case that @aokblast was looking at.

lib/libc/stdlib/cxa_thread_atexit_impl.c
129

cnt is uninitialized.

kib marked an inline comment as done.

Initialize cnt

Seems ok, but I'm not sure if it's sufficient for the LLVM test case that @aokblast was looking at.

It works on my test but a problem comes from my previous comment in D56022

ignore my incomplete comment

lib/libc/stdlib/cxa_thread_atexit_impl.c
126

Can we just