ipc,shm: shorten critical region for shmat