All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: linux@armlinux.org.uk, oleg@redhat.com, catalin.marinas@arm.com,
	will.deacon@arm.com, peterz@infradead.org, mingo@redhat.com,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	jolsa@redhat.com, namhyung@kernel.org, b.zolnierkie@samsung.com,
	m.szyprowski@samsung.com, k.lewandowsk@samsung.com,
	m.slodczyk2@partner.samsung.com
Subject: [PATCH v2 0/7] arm64: uprobes - ARM32 instruction probing
Date: Wed, 26 Sep 2018 14:11:58 +0200	[thread overview]
Message-ID: <1537963925-25313-1-git-send-email-m.slodczyk2@partner.samsung.com> (raw)
In-Reply-To: CGME20180926121213eucas1p1e85f71d1187eb6b50c320377e5ea907f@eucas1p1.samsung.com

The uprobe feature on ARM64 kernel does not support ARM A32 instruction
probing, making 32 bit apps running on 64 bit kernel unprobeable.

This patchset utilizes ARM32 uprobe code in ARM64 tree with following
modifications:
- moves ARM32 uprobes code form arch/arm to lib/uprobes/arm to be reused
by ARM64 code
- makes adjustments in api so that it suits the one used by ARM64 kernel, e.g.
struct pt_regs, register numbers
- takes into account differences between 32 and 64 bit ARM architectures.
A64 instruction handling is left unchanged.

Detect what kind of instruction is being probed and depending on the result:
- if an A64 instruction handle it the old way, using existing A64 instructions
probing code,
- if an A32 instruction decode it and handle using the new code, moved from
32 bit arm kernel tree.

Currently following test cases have been carried out with positive results:
- simulation-able instructions, like: STM, LDM, BLX, BL
- xol-able instructions, like: STR, LDR, ADD, CMN, CMP
- branching
- uretprobes.

This patchset does not implement T32 (Thumb) instructions probing (which is
also unsupported on "native" ARM32 arch).

v2:
- Rebased on 4.19-rc4 and tested against it
- Fixed build errors reported by kbuild test robot

Maciej Slodczyk (7):
  arm64: move arm uprobes code to be reused by arm64
  arm64: uprobes - fix checkpatch issues
  arm64: introduce get_swbp_insn() instead of static assignment
  arm64: change arm64 probes handler prototype
  arm64: make arm uprobes code reusable by arm64
  arm64: change arm_probe_decode_insn() function name
  arm64: uprobes - ARM32 instruction probing

 arch/arm/include/asm/probes.h                      |   8 ++
 arch/arm/include/asm/ptrace.h                      |  32 +++++
 arch/arm/include/asm/uprobes.h                     |   2 +-
 arch/arm/probes/Makefile                           |   8 +-
 arch/arm/probes/kprobes/actions-arm.c              |   2 +-
 arch/arm/probes/kprobes/checkers-arm.c             |   4 +-
 arch/arm/probes/kprobes/checkers-common.c          |   4 +-
 arch/arm/probes/kprobes/checkers-thumb.c           |   2 +-
 arch/arm/probes/kprobes/checkers.h                 |   2 +-
 arch/arm/probes/kprobes/core.c                     |   2 +-
 arch/arm/probes/kprobes/core.h                     |   2 +-
 arch/arm/probes/kprobes/test-core.c                |   2 +-
 arch/arm/probes/uprobes/Makefile                   |   2 +-
 arch/arm/probes/uprobes/core.c                     |  10 +-
 arch/arm64/include/asm/probes.h                    |  24 +++-
 arch/arm64/include/asm/ptrace.h                    |  21 +++
 arch/arm64/include/asm/uprobes.h                   |  21 ++-
 arch/arm64/kernel/debug-monitors.c                 |   8 ++
 arch/arm64/kernel/probes/Makefile                  |   2 +
 arch/arm64/kernel/probes/decode-insn.c             |  30 ++--
 arch/arm64/kernel/probes/decode-insn.h             |  15 +-
 arch/arm64/kernel/probes/kprobes.c                 |   4 +-
 arch/arm64/kernel/probes/simulate-insn.c           |  32 +++--
 arch/arm64/kernel/probes/simulate-insn.h           |  24 ++--
 arch/arm64/kernel/probes/uprobes.c                 | 122 ++++++++++++++--
 include/linux/uprobes.h                            |   1 +
 kernel/events/uprobes.c                            |  12 +-
 lib/Makefile                                       |   2 +
 lib/probes/Makefile                                |   2 +
 lib/probes/arm/Makefile                            |  11 ++
 .../uprobes => lib/probes/arm}/actions-arm.c       | 153 ++++++++++++++++++---
 {arch/arm/probes => lib/probes/arm}/decode-arm.c   |  58 +++++---
 {arch/arm/probes => lib/probes/arm}/decode-arm.h   |   4 +-
 {arch/arm/probes => lib/probes/arm}/decode.c       |  18 ++-
 {arch/arm/probes => lib/probes/arm}/decode.h       |  48 ++++---
 35 files changed, 552 insertions(+), 142 deletions(-)
 create mode 100644 lib/probes/Makefile
 create mode 100644 lib/probes/arm/Makefile
 rename {arch/arm/probes/uprobes => lib/probes/arm}/actions-arm.c (61%)
 rename {arch/arm/probes => lib/probes/arm}/decode-arm.c (95%)
 rename {arch/arm/probes => lib/probes/arm}/decode-arm.h (94%)
 rename {arch/arm/probes => lib/probes/arm}/decode.c (98%)
 rename {arch/arm/probes => lib/probes/arm}/decode.h (94%)

-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: m.slodczyk2@partner.samsung.com (Maciej Slodczyk)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 0/7] arm64: uprobes - ARM32 instruction probing
Date: Wed, 26 Sep 2018 14:11:58 +0200	[thread overview]
Message-ID: <1537963925-25313-1-git-send-email-m.slodczyk2@partner.samsung.com> (raw)
In-Reply-To: CGME20180926121213eucas1p1e85f71d1187eb6b50c320377e5ea907f@eucas1p1.samsung.com

The uprobe feature on ARM64 kernel does not support ARM A32 instruction
probing, making 32 bit apps running on 64 bit kernel unprobeable.

This patchset utilizes ARM32 uprobe code in ARM64 tree with following
modifications:
- moves ARM32 uprobes code form arch/arm to lib/uprobes/arm to be reused
by ARM64 code
- makes adjustments in api so that it suits the one used by ARM64 kernel, e.g.
struct pt_regs, register numbers
- takes into account differences between 32 and 64 bit ARM architectures.
A64 instruction handling is left unchanged.

Detect what kind of instruction is being probed and depending on the result:
- if an A64 instruction handle it the old way, using existing A64 instructions
probing code,
- if an A32 instruction decode it and handle using the new code, moved from
32 bit arm kernel tree.

Currently following test cases have been carried out with positive results:
- simulation-able instructions, like: STM, LDM, BLX, BL
- xol-able instructions, like: STR, LDR, ADD, CMN, CMP
- branching
- uretprobes.

This patchset does not implement T32 (Thumb) instructions probing (which is
also unsupported on "native" ARM32 arch).

v2:
- Rebased on 4.19-rc4 and tested against it
- Fixed build errors reported by kbuild test robot

Maciej Slodczyk (7):
  arm64: move arm uprobes code to be reused by arm64
  arm64: uprobes - fix checkpatch issues
  arm64: introduce get_swbp_insn() instead of static assignment
  arm64: change arm64 probes handler prototype
  arm64: make arm uprobes code reusable by arm64
  arm64: change arm_probe_decode_insn() function name
  arm64: uprobes - ARM32 instruction probing

 arch/arm/include/asm/probes.h                      |   8 ++
 arch/arm/include/asm/ptrace.h                      |  32 +++++
 arch/arm/include/asm/uprobes.h                     |   2 +-
 arch/arm/probes/Makefile                           |   8 +-
 arch/arm/probes/kprobes/actions-arm.c              |   2 +-
 arch/arm/probes/kprobes/checkers-arm.c             |   4 +-
 arch/arm/probes/kprobes/checkers-common.c          |   4 +-
 arch/arm/probes/kprobes/checkers-thumb.c           |   2 +-
 arch/arm/probes/kprobes/checkers.h                 |   2 +-
 arch/arm/probes/kprobes/core.c                     |   2 +-
 arch/arm/probes/kprobes/core.h                     |   2 +-
 arch/arm/probes/kprobes/test-core.c                |   2 +-
 arch/arm/probes/uprobes/Makefile                   |   2 +-
 arch/arm/probes/uprobes/core.c                     |  10 +-
 arch/arm64/include/asm/probes.h                    |  24 +++-
 arch/arm64/include/asm/ptrace.h                    |  21 +++
 arch/arm64/include/asm/uprobes.h                   |  21 ++-
 arch/arm64/kernel/debug-monitors.c                 |   8 ++
 arch/arm64/kernel/probes/Makefile                  |   2 +
 arch/arm64/kernel/probes/decode-insn.c             |  30 ++--
 arch/arm64/kernel/probes/decode-insn.h             |  15 +-
 arch/arm64/kernel/probes/kprobes.c                 |   4 +-
 arch/arm64/kernel/probes/simulate-insn.c           |  32 +++--
 arch/arm64/kernel/probes/simulate-insn.h           |  24 ++--
 arch/arm64/kernel/probes/uprobes.c                 | 122 ++++++++++++++--
 include/linux/uprobes.h                            |   1 +
 kernel/events/uprobes.c                            |  12 +-
 lib/Makefile                                       |   2 +
 lib/probes/Makefile                                |   2 +
 lib/probes/arm/Makefile                            |  11 ++
 .../uprobes => lib/probes/arm}/actions-arm.c       | 153 ++++++++++++++++++---
 {arch/arm/probes => lib/probes/arm}/decode-arm.c   |  58 +++++---
 {arch/arm/probes => lib/probes/arm}/decode-arm.h   |   4 +-
 {arch/arm/probes => lib/probes/arm}/decode.c       |  18 ++-
 {arch/arm/probes => lib/probes/arm}/decode.h       |  48 ++++---
 35 files changed, 552 insertions(+), 142 deletions(-)
 create mode 100644 lib/probes/Makefile
 create mode 100644 lib/probes/arm/Makefile
 rename {arch/arm/probes/uprobes => lib/probes/arm}/actions-arm.c (61%)
 rename {arch/arm/probes => lib/probes/arm}/decode-arm.c (95%)
 rename {arch/arm/probes => lib/probes/arm}/decode-arm.h (94%)
 rename {arch/arm/probes => lib/probes/arm}/decode.c (98%)
 rename {arch/arm/probes => lib/probes/arm}/decode.h (94%)

-- 
2.7.4

       reply	other threads:[~2018-09-26 12:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180926121213eucas1p1e85f71d1187eb6b50c320377e5ea907f@eucas1p1.samsung.com>
2018-09-26 12:11 ` Maciej Slodczyk [this message]
2018-09-26 12:11   ` [PATCH v2 0/7] arm64: uprobes - ARM32 instruction probing Maciej Slodczyk
     [not found]   ` <CGME20180926121214eucas1p2b262936ddd96980b7b4369f16b52c6ce@eucas1p2.samsung.com>
2018-09-26 12:11     ` [PATCH v2 1/7] arm64: move arm uprobes code to be reused by arm64 Maciej Slodczyk
2018-09-26 12:11       ` Maciej Slodczyk
2018-09-29  9:37       ` Suzuki K Poulose
2018-09-29  9:37         ` Suzuki K Poulose
2018-10-01 13:12         ` Maciej Slodczyk
2018-10-01 13:12           ` Maciej Slodczyk
     [not found]   ` <CGME20180926121214eucas1p1660542d20425551038da8d3feaf7e1b7@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 2/7] arm64: uprobes - fix checkpatch issues Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
2018-09-29  9:39       ` Suzuki K Poulose
2018-09-29  9:39         ` Suzuki K Poulose
     [not found]   ` <CGME20180926121215eucas1p10437d5bd9db81bedbcc363d24d196ded@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 3/7] arm64: introduce get_swbp_insn() instead of static assignment Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
     [not found]   ` <CGME20180926121216eucas1p28c13ab1a21ac5ef5058206b92954604f@eucas1p2.samsung.com>
2018-09-26 12:12     ` [PATCH v2 4/7] arm64: change arm64 probes handler prototype Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
     [not found]   ` <CGME20180926121216eucas1p2b896ce19f49214d497721db9d6e59bfb@eucas1p2.samsung.com>
2018-09-26 12:12     ` [PATCH v2 5/7] arm64: make arm uprobes code reusable by arm64 Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
2018-09-27 15:52       ` Julien Thierry
2018-09-27 15:52         ` Julien Thierry
2018-10-01 13:28         ` Maciej Slodczyk
2018-10-01 13:28           ` Maciej Slodczyk
2018-10-02  8:08           ` Julien Thierry
2018-10-02  8:08             ` Julien Thierry
     [not found]   ` <CGME20180926121217eucas1p198d96ed637d1aa8a98c1b90466dde745@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 6/7] arm64: change arm_probe_decode_insn() function name Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
     [not found]   ` <CGME20180926121218eucas1p1b20a88cfec17c6403a35e4f23de96ade@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 7/7] arm64: uprobes - ARM32 instruction probing Maciej Slodczyk
2018-09-26 12:12       ` Maciej Slodczyk
2018-09-27 16:18       ` Julien Thierry
2018-09-27 16:18         ` Julien Thierry
2018-09-27 17:01       ` Robin Murphy
2018-09-27 17:01         ` Robin Murphy
2018-10-01 13:40         ` Maciej Slodczyk
2018-10-01 13:40           ` Maciej Slodczyk
2018-10-02 11:04           ` Robin Murphy
2018-10-02 11:04             ` Robin Murphy

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=1537963925-25313-1-git-send-email-m.slodczyk2@partner.samsung.com \
    --to=m.slodczyk2@partner.samsung.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=catalin.marinas@arm.com \
    --cc=jolsa@redhat.com \
    --cc=k.lewandowsk@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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.