1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> 4 * 5 * Panic RV reactor: 6 * Prints the exception msg to the kernel message log and panic(). 7 */ 8 9 #include <linux/ftrace.h> 10 #include <linux/tracepoint.h> 11 #include <linux/kernel.h> 12 #include <linux/module.h> 13 #include <linux/init.h> 14 #include <linux/rv.h> 15 16 __printf(1, 2) static void rv_panic_reaction(const char *msg, ...) 17 { 18 va_list args; 19 20 va_start(args, msg); 21 vpanic(msg, args); 22 va_end(args); 23 } 24 25 static struct rv_reactor rv_panic = { 26 .name = "panic", 27 .description = "panic the system if an exception is found.", 28 .react = rv_panic_reaction 29 }; 30 31 static int __init register_react_panic(void) 32 { 33 rv_register_reactor(&rv_panic); 34 return 0; 35 } 36 37 static void __exit unregister_react_panic(void) 38 { 39 rv_unregister_reactor(&rv_panic); 40 } 41 42 module_init(register_react_panic); 43 module_exit(unregister_react_panic); 44 45 MODULE_AUTHOR("Daniel Bristot de Oliveira"); 46 MODULE_DESCRIPTION("panic rv reactor: panic if an exception is found."); 47