All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenta Tada <Kenta.Tada@sony.com>
To: andrii@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, kafai@fb.com,
	songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org, Kenta Tada <Kenta.Tada@sony.com>
Subject: [PATCH v5 0/3] Fix the incorrect register read for syscalls on x86_64
Date: Mon, 24 Jan 2022 23:16:19 +0900	[thread overview]
Message-ID: <20220124141622.4378-1-Kenta.Tada@sony.com> (raw)

Currently, rcx is read as the fourth parameter of syscall on x86_64.
But x86_64 Linux System Call convention uses r10 actually.
This commit adds the wrapper for users who want to access to
syscall params to analyze the user space.

Changelog:
----------
v1 -> v2:
- Rebase to current bpf-next
https://lore.kernel.org/bpf/20211222213924.1869758-1-andrii@kernel.org/

v2 -> v3:
- Modify the definition of SYSCALL macros for only targeted archs.
- Define __BPF_TARGET_MISSING variants for completeness.
- Remove CORE variants. These macros will not be used.
- Add a selftest.

v3 -> v4:
- Modify a selftest not to use serial tests.
- Modify a selftest to use ASSERT_EQ().
- Extract syscall wrapper for all the other tests.
- Add CORE variants.

v4 -> v5:
- Modify the CORE variant macro not to read memory directly.
- Remove the unnecessary comment.
- Add a selftest for the CORE variant.

Kenta Tada (3):
  libbpf: Extract syscall wrapper
  libbpf: Fix the incorrect register read for syscalls on x86_64
  libbpf: Add a test to confirm PT_REGS_PARM4_SYSCALL

 tools/lib/bpf/bpf_tracing.h                   | 34 ++++++++++
 .../bpf/prog_tests/test_bpf_syscall_macro.c   | 63 ++++++++++++++++++
 tools/testing/selftests/bpf/progs/bpf_misc.h  | 19 ++++++
 .../selftests/bpf/progs/bpf_syscall_macro.c   | 64 +++++++++++++++++++
 .../selftests/bpf/progs/test_probe_user.c     | 15 +----
 5 files changed, 181 insertions(+), 14 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_misc.h
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_syscall_macro.c

-- 
2.32.0


             reply	other threads:[~2022-01-24 14:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 14:16 Kenta Tada [this message]
2022-01-24 14:16 ` [PATCH v5 1/3] libbpf: Extract syscall wrapper Kenta Tada
2022-01-24 14:16 ` [PATCH v5 2/3] libbpf: Fix the incorrect register read for syscalls on x86_64 Kenta Tada
2022-01-24 14:16 ` [PATCH v5 3/3] libbpf: Add a test to confirm PT_REGS_PARM4_SYSCALL Kenta Tada
2022-01-25  5:05   ` Andrii Nakryiko
2022-02-01 19:36     ` Andrii Nakryiko
2022-02-01 21:01       ` Ilya Leoshkevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220124141622.4378-1-Kenta.Tada@sony.com \
    --to=kenta.tada@sony.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.