linux/tools
Lukas Zobernig 32c52ec87d x86/insn-eval: Fix shadowed segment index in get_seg_reg_override_idx()
Commit 45e1dccc06 ("x86/insn: Simplify for_each_insn_prefix()") made
for_each_insn_prefix() declare its own loop counter named idx.
get_seg_reg_override_idx() keeps its result in a local of the same name,
so the assignments in the loop body now write the loop counter:

 - the function always returns INAT_SEG_REG_DEFAULT, so FS and GS
   overrides are ignored;

 - a CS override sets the counter to INAT_SEG_REG_CS (2), the increment
   makes it 3, and prefixes.bytes[3] holds the last prefix, 0x2e again,
   so the loop never terminates.

The UMIP emulation reaches this from the #GP handler for user space: an
SGDT, SIDT or SMSW with a memory operand and a CS prefix leaves the task
spinning in the kernel, never returning to user space, with a SIGKILL
that is never delivered.  Any user can thus tie up CPUs until reboot.
With an FS or GS prefix, the emulated result is written to the wrong
address.

Rename the internal macro iterator variable.

[ Lukas' original patch renamed the use site, I changed it to rename the
  iterator in the macro instead, but left Lukas' commit message and
  authorship   - Linus ]

Fixes: 45e1dccc06 ("x86/insn: Simplify for_each_insn_prefix()")
Signed-off-by: Lukas Zobernig <lukas.zobernig@gmail.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-10-17 06:36:20 -10:00
..
accounting tools/accounting: fix macro typos in getdelays 2026-08-03 21:10:17 -07:00
arch x86/insn-eval: Fix shadowed segment index in get_seg_reg_override_idx() 2026-10-17 06:36:20 -10:00
bootconfig bootconfig: give the footer size static_assert a message 2026-10-12 12:35:10 +09:00
bpf perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
build perf build: Remove leftover feature tests for removed cxx and clang support 2026-08-12 06:17:49 -07:00
certs
cgroup
counter
crypto
debugging
dma
docs doc tools: fix 'path' typos 2026-08-11 10:43:16 -06:00
firewire
firmware
gpio tools: gpio: fix building from the top level with O= 2026-10-12 16:08:35 +02:00
hv tools/hv: fix typo "retrive" in comment 2026-09-19 16:00:48 -07:00
iio iio: types: add IIO_VOLUMEFLOW channel type 2026-08-05 00:02:55 +01:00
include Including fixes from Bluetooth, IPSec and Netfilter. 2026-08-27 13:53:43 -07:00
kvm/kvm_stat
laptop
leds
lib libbpf: Reject truncated ldimm64 CO-RE relocations 2026-09-17 18:01:43 -07:00
memory-model
mm mm.git review status for master..mm-nonmm-stable 2026-08-23 08:07:11 -07:00
net Including fixes from Bluetooth, IPSec and Netfilter. 2026-08-27 13:53:43 -07:00
objtool objtool: Validate disassembler headers in libopcodes probe 2026-09-13 18:15:43 -07:00
pcmcia
perf perf-tools fixes for v7.3-rc3 2026-09-07 10:26:56 -07:00
platform/x86/amd
power turbostat 2026.09.28 2026-10-03 13:02:41 -04:00
rcu
sched
sched_ext sched_ext: Add a size argument to scx_bpf_cid_topo() so struct scx_cid_topo can grow 2026-09-26 10:09:12 -10:00
scripts perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
sound
spi
testing selftests/filesystems: test that a mntns file can't take over a lock 2026-10-14 22:08:06 +02:00
thermal
time
tracing rtla/cli: Unify and improve handling of invalid option arguments 2026-08-05 10:14:40 +02:00
unittests
usb
verification verification/rvgen: Use .old instead of .bak for kunit backup files 2026-08-25 13:56:53 +02:00
virtio tools/virtio: Fix control typo in trace agent comment 2026-08-19 06:38:48 -04:00
wmi
workqueue tools/workqueue/wq_dump.py: Support backward compatibility for wq->attrs rename 2026-08-31 10:17:08 -10:00
writeback
Makefile