Add strict checks for SHM usage