[PATCH 0/4] arm64: entry: rework user return handling

Mark Rutland mark.rutland at arm.com
Mon Aug 2 07:07:29 PDT 2021


These patches (based on v5.14-rc3) rework the arm64 entry code,
converting the bulk of `ret_to_user` and `work_pending` assembly code to
C. This simplifies the code, and ensure that for each exception there is
a single assembly<->c transition, which may make it easier to handle
backtracing in future if metadata is necessary.

The bulk of the additions are comments added in patch 2, which clarify
the semantics of some helpers functions used during entry/exit.

There should be no functional change as a result of this series, other
than that backtraces starting within do_notify_resume() will now include
the exception handler for the exception the kernel was entered with,
rather than `ret_to_user` or `work_pending` as previously. This is
generally immaterial, but may make it easier to debug some issues where
knowing the original exception is helpful.

This series leaves handling of TFSRE0_EL1 and single-step in assembly,
to avoid clashing with concurrent MTE rework, and as moving this to C
will require some generic kernel infrastructure (e.g. arch_atomic
bitops) which is not yet in mainline. I intend to follow these up for
the next cycle.

The series can be found on my `arm64/entry/user-return-rework` branch on
kernel.org:

  https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/entry/user-return-rework
  git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/entry/user-return-rework

Thanks,
Mark.

Mark Rutland (4):
  arm64: entry: consolidate entry/exit helpers
  arm64: entry: clarify entry/exit helpers
  arm64: entry: move bulk of ret_to_user to C
  arm64: entry: call exit_to_user_mode() from C

 arch/arm64/include/asm/exception.h |   5 +-
 arch/arm64/kernel/entry-common.c   | 219 ++++++++++++++++++++++++++-----------
 arch/arm64/kernel/entry.S          |  36 +-----
 arch/arm64/kernel/signal.c         |   3 +-
 4 files changed, 162 insertions(+), 101 deletions(-)

-- 
2.11.0




More information about the linux-arm-kernel mailing list