+ /* XXX: Can't happen; probably tree coruption.*/
+ break; /* rejects unknown version */
+ }
+ }
+
+#if defined(HAS_APPLE_PAC)
+ if (removed_oidp && removed_oidp->oid_handler && old_oidp == NULL) {
+ /*
+ * Revert address-discriminated signing performed by
+ * sysctl_register_oid() (in case this oid is registered again).
+ */
+ removed_oidp->oid_handler = ptrauth_auth_function(removed_oidp->oid_handler,
+ ptrauth_key_function_pointer,
+ ptrauth_blend_discriminator(&removed_oidp->oid_handler,
+ ptrauth_string_discriminator("oid_handler")));
+ /*
+ * Dereference the function-pointer-signed result to prevent an
+ * attacker with the ability to observe the result of the
+ * auth_and_resign above from trying all possible inputs until an auth
+ * succeeds.
+ */
+ if (__builtin_expect(!*(uintptr_t*)ptrauth_auth_data((void*)
+ removed_oidp->oid_handler, ptrauth_key_function_pointer, 0), 0)) {
+ /*
+ * This is necessary to force the dereference but will never
+ * actually be reached, dereferencing an invalidly signed pointer
+ * will trap before getting here (and the codegen is nicer than
+ * with a panic).
+ */
+ __builtin_trap();