Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone
Summary: Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: x86_64 Solaris
: P1 critical
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2023-11-06 16:28 UTC by Iain Buclaw
Modified: 2023-11-20 11:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2023-11-06 16:28:16 UTC
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.
---
Comment 1 Dlang Bot 2023-11-06 17:13:59 UTC
@ibuclaw created dlang/dmd pull request #15778 "fix Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone" fixing this issue:

- fix Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone

https://github.com/dlang/dmd/pull/15778
Comment 2 Dlang Bot 2023-11-07 06:22:15 UTC
dlang/dmd pull request #15778 "fix Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone" was merged into stable:

- a52b48111411b0a88858f44db84cf6f3dfb8a1ca by Iain Buclaw:
  fix Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone

https://github.com/dlang/dmd/pull/15778
Comment 3 Dlang Bot 2023-11-20 11:13:28 UTC
dlang/dmd pull request #15829 "merge stable" was merged into master:

- 505e475b373a40d81635ee1df16cc1818448bb20 by Iain Buclaw:
  fix Issue 24230 - Infinite loop in core.cpuid.getCpuInfo0B in Solaris/x86 kernel zone

https://github.com/dlang/dmd/pull/15829