#include <linux/error-injection.h>
#include <linux/debugfs.h>
#include <linux/fault-inject.h>
#include <linux/kallsyms.h>
#include <linux/kprobes.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs);
static void fei_post_handler(struct kprobe *kp, struct pt_regs *regs,
unsigned long flags)
{ … }
struct fei_attr { … };
static DEFINE_MUTEX(fei_lock);
static LIST_HEAD(fei_attr_list);
static DECLARE_FAULT_ATTR(fei_fault_attr);
static struct dentry *fei_debugfs_dir;
static unsigned long adjust_error_retval(unsigned long addr, unsigned long retv)
{ … }
static struct fei_attr *fei_attr_new(const char *sym, unsigned long addr)
{ … }
static void fei_attr_free(struct fei_attr *attr)
{ … }
static struct fei_attr *fei_attr_lookup(const char *sym)
{ … }
static bool fei_attr_is_valid(struct fei_attr *_attr)
{ … }
static int fei_retval_set(void *data, u64 val)
{ … }
static int fei_retval_get(void *data, u64 *val)
{ … }
DEFINE_DEBUGFS_ATTRIBUTE(…);
static void fei_debugfs_add_attr(struct fei_attr *attr)
{ … }
static void fei_debugfs_remove_attr(struct fei_attr *attr)
{ … }
static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs)
{ … }
NOKPROBE_SYMBOL(…)
static void *fei_seq_start(struct seq_file *m, loff_t *pos)
{ … }
static void fei_seq_stop(struct seq_file *m, void *v)
{ … }
static void *fei_seq_next(struct seq_file *m, void *v, loff_t *pos)
{ … }
static int fei_seq_show(struct seq_file *m, void *v)
{ … }
static const struct seq_operations fei_seq_ops = …;
static int fei_open(struct inode *inode, struct file *file)
{ … }
static void fei_attr_remove(struct fei_attr *attr)
{ … }
static void fei_attr_remove_all(void)
{ … }
static ssize_t fei_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations fei_ops = …;
static int __init fei_debugfs_init(void)
{ … }
late_initcall(fei_debugfs_init);