How to catch segmentation fault in Linux userspace