www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24230] New: Infinite loop in core.cpuid.getCpuInfo0B in

https://issues.dlang.org/show_bug.cgi?id=24230

          Issue ID: 24230
           Summary: Infinite loop in core.cpuid.getCpuInfo0B in
                    Solaris/x86 kernel zone
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Solaris
            Status: NEW
          Severity: critical
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Any program that pulls in core.cpuid results in an infinite loop when running
inside a Solaris kernel zone.

https://github.com/dlang/dmd/blob/d24a8859b090911a2a48cbbd7666ff7e448acfc8/druntime/src/core/cpuid.d#L672-L696


Quote from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112408
---
Running getCpuInfo0B side-by-side in the kernel zone and on bare metal shows:

                        kernel zone     bare metal

  level 0

  a                     0               1
  b                     1               2

  level 1

  a                     0               5
  b                     1               28

  level 2

  a                     0               0
  b                     1               0

and so on for each higher level.  So inside a kernel zone, a!=0 || b!=0 remains
true, explaining the loop.

If I'm reading the spec (Intel® 64 and IA-32 Architectures
Software Developer’s Manual, Combined Volumes: 1, 2A, 2B, 2C, 2D, 3A, 3B,
3C, 3D, and 4, Order Number: 325462-081US, September 2023, Vol. 2A,
3-225, p.821) correctly, this is a bug in the kernel zone software:

A sub-leaf returning an invalid domain always returns 0 in EAX and EBX.

OTOH I don't see why getCpuInfo0B needs to loop here since it's only interested
in levels 0 and 1 anyway.
---

--
Nov 06 2023