linux-stable/arch/s390/mm
Heiko Carstens 484a8ed8b7 s390/extable: add dedicated uaccess handler
This is more or less a combination of commit 2e77a62cb3 ("arm64:
extable: add a dedicated uaccess handler") and commit 4b5305decc
("x86/extable: Extend extable functionality").

To describe the problem that needs to solved let's cite the full arm64
commit message:

------
For inline assembly, we place exception fixups out-of-line in the
`.fixup` section such that these are out of the way of the fast path.
This has a few drawbacks:

* Since the fixup code is anonymous, backtraces will symbolize fixups
  as offsets from the nearest prior symbol, currently
  `__entry_tramp_text_end`. This is confusing, and painful to debug
  without access to the relevant vmlinux.

* Since the exception handler adjusts the PC to execute the fixup, and
  the fixup uses a direct branch back into the function it fixes,
  backtraces of fixups miss the original function. This is confusing,
  and violates requirements for RELIABLE_STACKTRACE (and therefore
  LIVEPATCH).

* Inline assembly and associated fixups are generated from templates,
  and we have many copies of logically identical fixups which only
  differ in which specific registers are written to and which address
  is branched to at the end of the fixup. This is potentially wasteful
  of I-cache resources, and makes it hard to add additional logic to
  fixups without significant bloat.

This patch address all three concerns for inline uaccess fixups by
adding a dedicated exception handler which updates registers in
exception context and subsequent returns back into the function which
faulted, removing the need for fixups specialized to each faulting
instruction.

Other than backtracing, there should be no functional change as a result
of this patch.
------

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2022-03-08 00:33:00 +01:00
..
cmm.c s390/cmm: add missing virt_to_phys() conversion 2021-12-10 16:14:25 +01:00
dump_pagetables.c s390: add support for BEAR enhancement facility 2021-10-26 15:21:29 +02:00
extable.c s390/extable: add dedicated uaccess handler 2022-03-08 00:33:00 +01:00
extmem.c s390/extmem: remove stale -ENOSPC comment and handling 2020-07-03 10:49:16 +02:00
fault.c s390/extable: add and use fixup_exception helper function 2022-03-08 00:33:00 +01:00
gmap.c s390/mm,gmap: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
hugetlbpage.c s390/mm,hugetlb: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
init.c s390/sclp: release SCLP early buffer after kernel initialization 2021-12-16 19:58:07 +01:00
kasan_init.c s390/mm: use set_pXd()/set_pte() helper functions everywhere 2022-03-01 21:05:10 +01:00
maccess.c s390/extable: move EX_TABLE define to asm-extable.h 2022-03-08 00:33:00 +01:00
Makefile s390/extable: move extable related functions to mm/extable.c 2022-03-08 00:33:00 +01:00
mmap.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
page-states.c s390/extable: move EX_TABLE define to asm-extable.h 2022-03-08 00:33:00 +01:00
pageattr.c s390/mm,pageattr: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
pgalloc.c s390/mm: use CRST_ALLOC_ORDER instead of number 2022-02-09 22:56:04 +01:00
pgtable.c s390/mm,pgtable: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
vmem.c s390/mm: use set_pXd()/set_pte() helper functions everywhere 2022-03-01 21:05:10 +01:00