Bug 506596 - arch_prctl ARCH_SET_CPUID/ARCH_GET_CPUID don't work
Summary: arch_prctl ARCH_SET_CPUID/ARCH_GET_CPUID don't work
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks: 506971
  Show dependency treegraph
 
Reported: 2025-07-04 17:26 UTC by Mark Wielaard
Modified: 2025-07-12 22:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2025-07-04 17:26:06 UTC
The ltp arch_prctl01 test fails:

Command: ./auxprogs/auxchecks/ltp-full-20250530/testcases/kernel/syscalls/arch_prctl/arch_prctl01
tst_test.c:1953: TINFO: LTP version: VALGRIND_3_25_0-71-gf89b54e8a601
tst_test.c:1956: TINFO: Tested kernel: 6.14.11-300.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 10 16:24:16 UTC 2025 x86_64
tst_kconfig.c:88: TINFO: Parsing kernel config '/lib/modules/6.14.11-300.fc42.x86_64/build/.config'
tst_test.c:1774: TINFO: Overall timeout per run is 0h 00m 30s
arch_prctl01.c:54: TFAIL: arch_prctl_set(ARCH_SET_CPUID, index) failed: EINVAL (22)
arch_prctl01.c:66: TFAIL: get wrong cpuid status
arch_prctl01.c:54: TFAIL: arch_prctl_set(ARCH_SET_CPUID, index) failed: EINVAL (22)
arch_prctl01.c:66: TFAIL: get wrong cpuid status

PRE(sys_arch_prctl) in coregrind/m_syswrap/syswrap-amd64-linux.c doesn't recognize ARCH_SET_CPUID and explicitly sets EINVAL.

ARCH_SET_CPUID enables or disables the cpuid instruction for the calling thread. If disabled trying to execute a cpuid instruction causes a SEGSEGV.

We would have to emulate that in VEX/priv/guest_amd64_toIR.c (and VEX/priv/guest_x86_toIR.c)