[Bug 279901] glibc-2.39-2 and above on the host segfault

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 28 Feb 2025 04:29:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279901

--- Comment #68 from Koichiro Iwao <meta@FreeBSD.org> ---
(In reply to Koichiro Iwao from comment #65)
This wasn't correct.

> The bhyve patch means here is the following:
> 
>--- a/sys/amd64/vmm/x86.c
>+++ b/sys/amd64/vmm/x86.c
>@@ -152,6 +152,8 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
>                                * pkg_id_shift and other OSes may rely on it.
>                                */
>                                width = MIN(0xF, log2(threads * cores));
>+                               if (width < 0x4)
>+                                       width = 0;
>                                logical_cpus = MIN(0xFF, threads * cores - 1);
>                                regs[2] = (width << AMDID_COREID_SIZE_SHIFT) | logical_cpus;

This is the correct patch I meant. 

--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -258,7 +256,7 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax,
uint64_t *rbx,
                                func = 3;       /* unified cache */
                                break;
                        default:
-                               logical_cpus = 0;
+                               logical_cpus = sockets * threads * cores;
                                level = 0;
                                func = 0;
                                break;
@@ -268,7 +266,7 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax,
uint64_t *rbx,
                        regs[0] = (logical_cpus << 14) | (1 << 8) |
                            (level << 5) | func;
                        regs[1] = (func > 0) ? (CACHE_LINE_SIZE - 1) : 0;
-                       regs[2] = 0;
+                       regs[2] = 1;    /* Num of cache ways */
                        regs[3] = 0;
                        break;

-- 
You are receiving this mail because:
You are the assignee for the bug.