Re: [PATCH v2 3/7] perf syscalltbl: Remove struct syscalltbl

2025-02-10 Thread Arnd Bergmann
On Mon, Feb 10, 2025, at 17:51, Ian Rogers wrote: > The syscalltbl held entries of system call name and number pairs, > generated from a native syscalltbl at start up. As there are gaps in > the system call number there is a notion of index into the > table. Going forward we want the system call ta

Re: [PATCH v2 6/7] perf syscalltbl: Use lookup table containing multiple architectures

2025-02-10 Thread Ian Rogers
On Mon, Feb 10, 2025 at 3:39 PM Charlie Jenkins wrote: > > On Mon, Feb 10, 2025 at 08:51:07AM -0800, Ian Rogers wrote: > > Switch to use the lookup table containing all architectures rather > > than tables matching the perf binary. > > > > This fixes perf trace when executed on a 32-bit i386 binar

Re: [PATCH v2 5/7] perf trace beauty: Add syscalltbl.sh generating all system call tables

2025-02-10 Thread Ian Rogers
On Mon, Feb 10, 2025 at 4:22 PM Charlie Jenkins wrote: > > On Mon, Feb 10, 2025 at 08:51:06AM -0800, Ian Rogers wrote: > > Rather than generating individual syscall header files generate a > > single trace/beauty/generated/syscalltbl.c. In a syscalltbls array > > have references to each architectu

Re: [PATCH v2 6/7] perf syscalltbl: Use lookup table containing multiple architectures

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:07AM -0800, Ian Rogers wrote: > Switch to use the lookup table containing all architectures rather > than tables matching the perf binary. > > This fixes perf trace when executed on a 32-bit i386 binary on an > x86-64 machine. Note in the following the system call nam

Re: [PATCH v2 5/7] perf trace beauty: Add syscalltbl.sh generating all system call tables

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:06AM -0800, Ian Rogers wrote: > Rather than generating individual syscall header files generate a > single trace/beauty/generated/syscalltbl.c. In a syscalltbls array > have references to each architectures tables along with the > corresponding e_machine. When the 32-b

Re: [PATCH v2 4/7] perf thread: Add support for reading the e_machine type for a thread

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:05AM -0800, Ian Rogers wrote: > Use the executable from /proc/pid/exe and read the e_machine from the > ELF header. On failure use EM_HOST. Change builtin-trace syscall > functions to pass e_machine from the thread rather than EM_HOST, so > that in later patches when s

Re: [PATCH v2 3/7] perf syscalltbl: Remove struct syscalltbl

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:04AM -0800, Ian Rogers wrote: > The syscalltbl held entries of system call name and number pairs, > generated from a native syscalltbl at start up. As there are gaps in > the system call number there is a notion of index into the > table. Going forward we want the syst

Re: [PATCH v2 2/7] perf trace: Reorganize syscalls

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:03AM -0800, Ian Rogers wrote: > Identify struct syscall information in the syscalls table by a machine > type and syscall number, not just system call number. Having the > machine type means that 32-bit system calls can be differentiated from > 64-bit ones on a machine

Re: [PATCH v2 1/7] perf syscalltble: Remove syscall_table.h

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:02AM -0800, Ian Rogers wrote: > The definition of "static const char *const syscalltbl[] = {" is done > in a generated syscalls_32.h or syscalls_64.h that is architecture > dependent. In order to include the appropriate file a syscall_table.h > is found via the perf in

Re: [PATCH v2 6/7] perf syscalltbl: Use lookup table containing multiple architectures

2025-02-10 Thread Charlie Jenkins
On Mon, Feb 10, 2025 at 08:51:07AM -0800, Ian Rogers wrote: > Switch to use the lookup table containing all architectures rather > than tables matching the perf binary. > > This fixes perf trace when executed on a 32-bit i386 binary on an > x86-64 machine. Note in the following the system call nam

[PATCH v2 7/7] perf build: Remove Makefile.syscalls

2025-02-10 Thread Ian Rogers
Now a single beauty file is generated and used by all architectures, remove the per-architecture Makefiles, Kbuild files and previous generator script. Note: there was conversation with Charlie Jenkins and they'd written an alternate approach to support multiple architectures: https://lore.kernel

[PATCH v2 6/7] perf syscalltbl: Use lookup table containing multiple architectures

2025-02-10 Thread Ian Rogers
Switch to use the lookup table containing all architectures rather than tables matching the perf binary. This fixes perf trace when executed on a 32-bit i386 binary on an x86-64 machine. Note in the following the system call names of the 32-bit i386 binary as seen by an x86-64 perf. Before: ```

[PATCH v2 5/7] perf trace beauty: Add syscalltbl.sh generating all system call tables

2025-02-10 Thread Ian Rogers
Rather than generating individual syscall header files generate a single trace/beauty/generated/syscalltbl.c. In a syscalltbls array have references to each architectures tables along with the corresponding e_machine. When the 32-bit or 64-bit table is ambiguous, match the perf binary's type. For A

[PATCH v2 4/7] perf thread: Add support for reading the e_machine type for a thread

2025-02-10 Thread Ian Rogers
Use the executable from /proc/pid/exe and read the e_machine from the ELF header. On failure use EM_HOST. Change builtin-trace syscall functions to pass e_machine from the thread rather than EM_HOST, so that in later patches when syscalltbl can use the e_machine the system calls are specific to the

[PATCH v2 3/7] perf syscalltbl: Remove struct syscalltbl

2025-02-10 Thread Ian Rogers
The syscalltbl held entries of system call name and number pairs, generated from a native syscalltbl at start up. As there are gaps in the system call number there is a notion of index into the table. Going forward we want the system call table to be identifiable by a machine type, for example, i38

[PATCH v2 0/7] perf: Support multiple system call tables in the build

2025-02-10 Thread Ian Rogers
This work builds on the clean up of system call tables and removal of libaudit by Charlie Jenkins . The system call table in perf trace is used to map system call numbers to names and vice versa. Prior to these changes, a single table matching the perf binary's build was present. The table would b

[PATCH v2 1/7] perf syscalltble: Remove syscall_table.h

2025-02-10 Thread Ian Rogers
The definition of "static const char *const syscalltbl[] = {" is done in a generated syscalls_32.h or syscalls_64.h that is architecture dependent. In order to include the appropriate file a syscall_table.h is found via the perf include path and it includes the syscalls_32.h or syscalls_64.h as app

[PATCH v2 2/7] perf trace: Reorganize syscalls

2025-02-10 Thread Ian Rogers
Identify struct syscall information in the syscalls table by a machine type and syscall number, not just system call number. Having the machine type means that 32-bit system calls can be differentiated from 64-bit ones on a machine capable of both. Having a table for all machine types and all syste

[PATCH v5 3/7] syscall.h: add syscall_set_arguments()

2025-02-10 Thread Dmitry V. Levin
This function is going to be needed on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. This partially reverts commit 7962c2eddbfe ("arch: remove unused function syscall_set_arguments()") by reusing some of old syscall_set_arguments() implementations. Signed-off-by:

[PATCH v5 0/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO API

2025-02-10 Thread Dmitry V. Levin
PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of system calls the tracee is blocked in. This API allows ptracers to obtain and modify system call details in a straightforward and architecture-agnostic way, providing a