On Tue, Jan 06, 2026 at 10:31:29AM +0000, Alexandr Semenikhin wrote:
This patch changes how the maximum socket count is calculated.
On some systems (e.g. GB200), physical_package_id values are not contiguous or zero-based. Instead of 0..N, they may contain large arbitrary identifiers (e.g. 256123234). The previous implementation assumed a 0..N range and used the maximum ID value directly.
This caused: excessive memory allocation extremely large loop bounds OOM / DoS scenarios unnecessary CPU time consumption
The new implementation computes the socket count as the number of unique package IDs present on the node, rather than relying on the maximum numeric value.
Signed-off-by: Alexandr Semenikhin <alexandr2e78@gmail.com> --- src/util/virhostcpu.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> and pushed. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|