ipc: make shm_get_stat() more robust