On 12/22/2016 5:10 PM, Jason Gunthorpe wrote: > There is no guarantee how a process will be exiting, specifically there > is no guarantee that there is only 1 thread. This means what atexit > handlers can safely do is very limited. > > In particular freeing resources that would otherwise be freed by the OS > is absolutely wrong in a multi-threaded environment. > > - neigh.c: This deletes the netlink socket > - ocrdma_main.c: These delete locks and free devices > - cma.c: This frees pds and other objects > - amp.c: We don't need to wait for a thread to exit if we are > exiting. > > This fixes a crash on-exit observed with at least rping where a > thread calls exit() while the main thread is still running. > This creates a race where rdma_destroy_id() runs concurrently > with ucma_cleanup() and one of them will randomly crash with a jump > to NULL. > > This will create some leaked memory complaints from valgrind > mem checkers. These need to be solved with sensible resource > tracking to free the objects once all possible users are gone > and not relying on atexit. > > Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx> This all looks sane, thanks, applied. -- Doug Ledford <dledford@xxxxxxxxxx> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Attachment:
signature.asc
Description: OpenPGP digital signature