The code to autodetect x86 CPU model runs the cpuid instruction after setting 
up 1 in eax. This gives the processor signature back in eax which encodes the 
model number.

As per Intel Application Note 485 and AMD publication #25481, when deriving 
model, we should look at both the base model in eax[7:4] and the extended model 
in eax[19:16]. However current code is only looking at base model and this 
causes some newer CPUs like Icelake(Model 0x6a) to be detected wrongly as 
Pentium 3(Model 0x0a).

Note that this code is only exercised when rpm is built as 32-bit binary 
because all of this is within a `#if defined(__i386__)`.

Because of this misdetection on Icelake, `setarch x86_64 rpm --showrc` has 
`pentium3` as the `installed arch` instead of the expected `x86_64`. It 
doesn't have `x86_64` as one of the `compatible archs` as expected. 
Attempting to install a x86_64 rpm with `setarch x86_64 rpm -i` is failing with 
`is intended for a different architecture` errors.

```
ARCHITECTURE AND OS:
build arch            : i386
compatible build archs: pentium3 i686 i586 i486 i386 noarch fat
build os              : Linux
compatible build os's : Linux
install arch          : pentium3
install os            : Linux
compatible archs      : pentium3 i686 i586 i486 i386 noarch fat
compatible os's       : Linux
```

Fix the code to also consider extended model and extended family when 
applicable. The implementation is similar to the one in the linuxi kernel.

References:
https://www.scss.tcd.ie/~jones/CS4021/processor-identification-cpuid-instruction-note.pdf
 https://www.amd.com/system/files/TechDocs/25481.pdf 
https://elixir.bootlin.com/linux/v6.3.6/source/arch/x86/lib/cpu.c#L19

Fixes: #2535
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/2536

-- Commit Summary --

  * rpmrc: Fix how x86 models are derived

-- File Changes --

    M lib/rpmrc.c (37)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/2536.patch
https://github.com/rpm-software-management/rpm/pull/2536.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2536
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to