public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
       [not found] <172A08C84FADCD55.3230@groups.io>
@ 2022-12-06 12:38 ` Pedro Falcato
  2023-04-26 21:54   ` Benjamin Doron
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Falcato @ 2022-12-06 12:38 UTC (permalink / raw)
  To: devel, pedro.falcato
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Jason A . Donenfeld

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

Hi,

Ping. Is there a blocker here?

Pedro

[-- Attachment #2: Type: text/html, Size: 206 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
  2022-12-07  1:57 ` 回复: [edk2-devel] " gaoliming
@ 2022-12-07  3:41   ` Pedro Falcato
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Falcato @ 2022-12-07  3:41 UTC (permalink / raw)
  To: devel, gaoliming; +Cc: Michael D Kinney, Zhiguang Liu, Jason A . Donenfeld

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

> Pedro:
>   To keep the same behavior, I suggest to only update
> BaseRngLibConstructor() API with TestRdRand, don't touch other APIs.

Liming,
the point is to fix the library's broken behavior, as previously discussed
in the ML, and documented in the commit message and the bugzilla.
Only updating BaseRngLibConstructor would do absolutely nothing.
ArchIsRngSupported needs updating because it's bogus.
The individual ArchGetRandomNumberN() do not *need* updating, but it's a
good idea to make sure that "Existing software depends on this always
returning TRUE" isn't actually reality.

Pedro

[-- Attachment #2: Type: text/html, Size: 930 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
  2022-12-06 12:38 ` [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID Pedro Falcato
@ 2023-04-26 21:54   ` Benjamin Doron
  2023-04-27 15:20     ` Pedro Falcato
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Doron @ 2023-04-26 21:54 UTC (permalink / raw)
  To: Pedro Falcato, devel

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]

Hi,
Is there merit to removing the assert statement? When this instance of the RngLib class is used, the platform builder says there's RNG support. Asserts are a little easier to see than debug prints, especially when they stall the platform. I think that leaving it in is better. If asserts don't call CpuDeadLoop() or are removed from the build entirely, then ` ArchIsRngSupported()` will ensure safe behaviour (but incorrect functionality).

Also, I'm slightly concerned that the check for minimum RDRAND changes will succeed if it returns 0s, then 1s, then 0s... Though this seems like an RDRAND broken too conveniently, not a true errata.

Regards,
Benjamin

[-- Attachment #2: Type: text/html, Size: 737 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
  2023-04-26 21:54   ` Benjamin Doron
@ 2023-04-27 15:20     ` Pedro Falcato
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Falcato @ 2023-04-27 15:20 UTC (permalink / raw)
  To: Benjamin Doron; +Cc: devel

On Wed, Apr 26, 2023 at 10:54 PM Benjamin Doron
<benjamin.doron00@gmail.com> wrote:
>
> Hi,
> Is there merit to removing the assert statement? When this instance of the RngLib class is used, the platform builder says there's RNG support. Asserts are a little easier to see than debug prints, especially when they stall the platform. I think that leaving it in is better. If asserts don't call CpuDeadLoop() or are removed from the build entirely, then `ArchIsRngSupported()` will ensure safe behaviour (but incorrect functionality).

Certain platforms may not know if the CPU has rdrand or if it's broken
at all. For instance, OVMF (1st case) or firmware for the AMD AM4
mobos (where they had zen1, 2 and 3 with some RDRAND breakage in
between).
Also, as you mentioned, ASSERTs can be entirely removed from the
build. So I don't think asserts are a good idea here. Unless you want
to suggest hiding the ASSERT with a PCD, in which case, yuck?

> Also, I'm slightly concerned that the check for minimum RDRAND changes will succeed if it returns 0s, then 1s, then 0s... Though this seems like an RDRAND broken too conveniently, not a true errata.

Ack, I don't think the algorithm is perfect, but it's what Jason wrote
for Linux and suggested; I guess it may be adjusted if we so need, but
at the moment it definitely detects the egregious AMD breakage.

-- 
Pedro

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-27 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <172A08C84FADCD55.3230@groups.io>
2022-12-06 12:38 ` [edk2-devel] [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID Pedro Falcato
2023-04-26 21:54   ` Benjamin Doron
2023-04-27 15:20     ` Pedro Falcato
2022-11-22 22:31 Pedro Falcato
2022-12-07  1:57 ` 回复: [edk2-devel] " gaoliming
2022-12-07  3:41   ` Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox