BullseyeCoverage Up Contents Search

Segmentation Fault Upon fork

SYMPTOMS

On a Unix-like operating system, the child process of a call to fork terminates with a segmentation fault immediately upon startup. The parent process previously unloaded an instrumented shared object via dlclose.

CAUSE

When auto-save is enabled, the BullseyeCoverage run-time uses pthread_atfork to prevent synchronization errors between parent and child processes. When a shared object is instrumented, the function pointer parameter to pthread_atfork points into the BullseyeCoverage run-time in the shared object. If the shared object is unloaded, the function pointer becomes invalid. A call to fork causes the function pointer to be dereferenced, resulting in a crash.

RESOLUTION

Disable auto-save by setting environment variable COVAUTOSAVE=0.

SEE ALSO

Unix-like Systems

segfault shared object

Updated: 23 Mar 2015