diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2021-04-09 11:34:43 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-04-12 13:46:42 +0300 |
commit | 17a363dcd2f7455d8661a7b2f9ba7cfb85bbc7e4 (patch) | |
tree | 15b3c8c49de3ed353e3b7f5a6ff41ee50fd725b1 /arch/s390/kernel/traps.c | |
parent | 61311e32892b008886478bdba4ce2a34f4d938f8 (diff) | |
download | linux-17a363dcd2f7455d8661a7b2f9ba7cfb85bbc7e4.tar.xz |
s390/traps,mm: add conditional trap handlers
Add conditional trap handlers similar to conditional system calls
(COND_SYSCALL), to reduce the number of ifdefs.
Trap handlers which may or may not exist depending on config options
are supposed to have a COND_TRAP entry, which redirects to
default_trap_handler() for non-existent trap handlers during link
time.
This allows to get rid of the secure execution trap handlers for the
!PGSTE case.
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/traps.c')
-rw-r--r-- | arch/s390/kernel/traps.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index e8b894184f83..63021d484626 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -79,7 +79,7 @@ void do_per_trap(struct pt_regs *regs) } NOKPROBE_SYMBOL(do_per_trap); -void default_trap_handler(struct pt_regs *regs) +static void default_trap_handler(struct pt_regs *regs) { if (user_mode(regs)) { report_user_fault(regs, SIGSEGV, 0); @@ -404,3 +404,12 @@ static void (*pgm_check_table[128])(struct pt_regs *regs) = { [0x40] = monitor_event_exception, [0x41 ... 0x7f] = default_trap_handler, }; + +#define COND_TRAP(x) asm( \ + ".weak " __stringify(x) "\n\t" \ + ".set " __stringify(x) "," \ + __stringify(default_trap_handler)) + +COND_TRAP(do_secure_storage_access); +COND_TRAP(do_non_secure_storage_access); +COND_TRAP(do_secure_storage_violation); |