Go to file
Adrian Hunter ad36d26ab4 x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
BugLink: https://bugs.launchpad.net/bugs/2071668

[ Upstream commit 59162e0c11d7257cde15f907d19fefe26da66692 ]

The x86 instruction decoder is used not only for decoding kernel
instructions. It is also used by perf uprobes (user space probes) and by
perf tools Intel Processor Trace decoding. Consequently, it needs to
support instructions executed by user space also.

Opcode 0x68 PUSH instruction is currently defined as 64-bit operand size
only i.e. (d64). That was based on Intel SDM Opcode Map. However that is
contradicted by the Instruction Set Reference section for PUSH in the
same manual.

Remove 64-bit operand size only annotation from opcode 0x68 PUSH
instruction.

Example:

  $ cat pushw.s
  .global  _start
  .text
  _start:
          pushw   $0x1234
          mov     $0x1,%eax   # system call number (sys_exit)
          int     $0x80
  $ as -o pushw.o pushw.s
  $ ld -s -o pushw pushw.o
  $ objdump -d pushw | tail -4
  0000000000401000 <.text>:
    401000:       66 68 34 12             pushw  $0x1234
    401004:       b8 01 00 00 00          mov    $0x1,%eax
    401009:       cd 80                   int    $0x80
  $ perf record -e intel_pt//u ./pushw
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.014 MB perf.data ]

 Before:

  $ perf script --insn-trace=disasm
  Warning:
  1 instruction trace errors
           pushw   10349 [000] 10586.869237014:            401000 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw)           pushw $0x1234
           pushw   10349 [000] 10586.869237014:            401006 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw)           addb %al, (%rax)
           pushw   10349 [000] 10586.869237014:            401008 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw)           addb %cl, %ch
           pushw   10349 [000] 10586.869237014:            40100a [unknown] (/home/ahunter/git/misc/rtit-tests/pushw)           addb $0x2e, (%rax)
   instruction trace error type 1 time 10586.869237224 cpu 0 pid 10349 tid 10349 ip 0x40100d code 6: Trace doesn't match instruction

 After:

  $ perf script --insn-trace=disasm
             pushw   10349 [000] 10586.869237014:            401000 [unknown] (./pushw)           pushw $0x1234
             pushw   10349 [000] 10586.869237014:            401004 [unknown] (./pushw)           movl $1, %eax

Fixes: eb13296cfa ("x86: Instruction decoder API")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240502105853.5338-3-adrian.hunter@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2024-07-05 10:51:59 +02:00
Documentation ASoC: dt-bindings: rt5645: add cbj sleeve gpio property 2024-07-05 10:51:55 +02:00
LICENSES
arch x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map 2024-07-05 10:51:59 +02:00
block block: prevent division by zero in blk_rq_stat_sum() 2024-06-07 15:01:41 +02:00
certs
crypto Revert "crypto: api - Disallow identical driver names" 2024-06-07 15:01:46 +02:00
debian UBUNTU: [Packaging] Remove fips-checks script 2024-03-28 15:18:45 +01:00
debian.master UBUNTU: Upstream stable to v5.4.277 2024-07-05 10:51:55 +02:00
drivers RDMA/hns: Use complete parentheses in macros 2024-07-05 10:51:59 +02:00
fs jffs2: prevent xattr node from overflowing the eraseblock 2024-07-05 10:51:56 +02:00
include ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value 2024-07-05 10:51:58 +02:00
init init: open /initrd.image with O_LARGEFILE 2024-06-07 15:01:40 +02:00
ipc
kernel ring-buffer: Fix a race between readers and resize checks 2024-07-05 10:51:55 +02:00
lib dyndbg: fix old BUG_ON in >control parser 2024-07-05 10:51:54 +02:00
mm x86/mm/pat: fix VM_PAT handling in COW mappings 2024-06-07 15:01:42 +02:00
net ipv6: sr: fix invalid unregister error path 2024-07-05 10:51:58 +02:00
samples media: rename VFL_TYPE_GRABBER to _VIDEO 2024-06-07 15:01:29 +02:00
scripts kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 2024-06-07 15:01:35 +02:00
security smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity() 2024-06-07 15:01:32 +02:00
sound ASoC: da7219-aad: fix usage of device_get_named_child_node() 2024-07-05 10:51:55 +02:00
tools x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map 2024-07-05 10:51:59 +02:00
ubuntu
usr
virt KVM: async_pf: Cleanup kvm_setup_async_pf() 2024-06-07 15:01:45 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS iio: stx104: Move to addac subdirectory 2023-10-30 11:41:56 +01:00
Makefile Linux 5.4.277 2024-07-05 10:51:55 +02:00
README
Ubuntu.md
dropped.txt
snapcraft.yaml

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.