From d35c4cfad5800b15ab730af5246df0366f2be558 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 5 Apr 2025 16:22:20 +0000 Subject: [PATCH] sysctl: Panic on OID reuse In CheriBSD we had a conflict in the KERN_PROC OID space and didn't notice for some time. Let's panic instead to make such conflicts easier to detect. Note that this doesn't affect conflicts arising from name collisions in OID_AUTO sysctls, which happen sometimes due to driver bugs. Reviewed by: brooks, kib, jhb MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D49351 --- sys/kern/kern_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 8cf8e7b19c8..46226cc3198 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -516,7 +516,7 @@ sysctl_register_oid(struct sysctl_oid *oidp) /* check for non-auto OID number collision */ if (oidp->oid_number >= 0 && oidp->oid_number < CTL_AUTO_START && oid_number >= CTL_AUTO_START) { - printf("sysctl: OID number(%d) is already in use for '%s'\n", + panic("sysctl: OID number(%d) is already in use for '%s'\n", oidp->oid_number, oidp->oid_name); } /* update the OID number, if any */