Path: blob/master/include/asm-generic/error-injection.h
26278 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_GENERIC_ERROR_INJECTION_H2#define _ASM_GENERIC_ERROR_INJECTION_H34#if defined(__KERNEL__) && !defined(__ASSEMBLY__)5enum {6EI_ETYPE_NULL, /* Return NULL if failure */7EI_ETYPE_ERRNO, /* Return -ERRNO if failure */8EI_ETYPE_ERRNO_NULL, /* Return -ERRNO or NULL if failure */9EI_ETYPE_TRUE, /* Return true if failure */10};1112struct error_injection_entry {13unsigned long addr;14int etype;15};1617struct pt_regs;1819#ifdef CONFIG_FUNCTION_ERROR_INJECTION20/*21* Whitelist generating macro. Specify functions which can be error-injectable22* using this macro. If you unsure what is required for the error-injectable23* functions, please read Documentation/fault-injection/fault-injection.rst24* 'Error Injectable Functions' section.25*/26#define ALLOW_ERROR_INJECTION(fname, _etype) \27static struct error_injection_entry __used \28__section("_error_injection_whitelist") \29_eil_addr_##fname = { \30.addr = (unsigned long)fname, \31.etype = EI_ETYPE_##_etype, \32}3334void override_function_with_return(struct pt_regs *regs);35#else36#define ALLOW_ERROR_INJECTION(fname, _etype)3738static inline void override_function_with_return(struct pt_regs *regs) { }39#endif40#endif4142#endif /* _ASM_GENERIC_ERROR_INJECTION_H */434445