⬢ DragonFlyBSD Kernel Audit
DF-5343 / fix.diff
← back to finding ↓ download raw
--- a/sys/platform/pc64/x86_64/mptable.c	2026-10-03 04:37:03.595609252 +0000
+++ b/sys/platform/pc64/x86_64/mptable.c	2026-10-03 04:37:03.631608793 +0000
@@ -699,13 +699,15 @@
 		 */
 		bzero(&proc, sizeof(proc));
 		proc.type = 0;
-		proc.cpu_flags = (force_enable) ? PROCENTRY_FLAG_EN : ent->cpu_flags;
+		/* synthetic logical CPUs are never the BSP */
+		proc.cpu_flags = ((force_enable) ? PROCENTRY_FLAG_EN :
+		    ent->cpu_flags) & ~PROCENTRY_FLAG_BP;
 		proc.apic_id = ent->apic_id;
 
 		for (i = 1; i < arg->logical_cpus; i++) {
 			proc.apic_id++;
-			processor_entry(&proc, arg->cpu);
-			arg->cpu++;
+			if (processor_entry(&proc, arg->cpu))
+				arg->cpu++;
 		}
 	}
 	return 0;