selinux: consolidate the ptrace parent lookup code