error-inject.c (00c9d5632277b21ba8802e26c27254cd9d0dfa13) | error-inject.c (86e5908ec293bf6505a59d02542da006226bcaa7) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2// error-inject.c: Function-level error injection table 3#include <linux/error-injection.h> 4#include <linux/debugfs.h> 5#include <linux/kallsyms.h> 6#include <linux/kprobes.h> 7#include <linux/module.h> 8#include <linux/mutex.h> --- 26 unchanged lines hidden (view full) --- 35 } 36 mutex_unlock(&ei_mutex); 37 return ret; 38} 39 40int get_injectable_error_type(unsigned long addr) 41{ 42 struct ei_entry *ent; | 1// SPDX-License-Identifier: GPL-2.0 2// error-inject.c: Function-level error injection table 3#include <linux/error-injection.h> 4#include <linux/debugfs.h> 5#include <linux/kallsyms.h> 6#include <linux/kprobes.h> 7#include <linux/module.h> 8#include <linux/mutex.h> --- 26 unchanged lines hidden (view full) --- 35 } 36 mutex_unlock(&ei_mutex); 37 return ret; 38} 39 40int get_injectable_error_type(unsigned long addr) 41{ 42 struct ei_entry *ent; |
43 int ei_type = EI_ETYPE_NONE; |
|
43 | 44 |
45 mutex_lock(&ei_mutex); |
|
44 list_for_each_entry(ent, &error_injection_list, list) { | 46 list_for_each_entry(ent, &error_injection_list, list) { |
45 if (addr >= ent->start_addr && addr < ent->end_addr) 46 return ent->etype; | 47 if (addr >= ent->start_addr && addr < ent->end_addr) { 48 ei_type = ent->etype; 49 break; 50 } |
47 } | 51 } |
48 return EI_ETYPE_NONE; | 52 mutex_unlock(&ei_mutex); 53 54 return ei_type; |
49} 50 51/* 52 * Lookup and populate the error_injection_list. 53 * 54 * For safety reasons we only allow certain functions to be overridden with 55 * bpf_error_injection, so we need to populate the list of the symbols that have 56 * been marked as safe for overriding. --- 179 unchanged lines hidden --- | 55} 56 57/* 58 * Lookup and populate the error_injection_list. 59 * 60 * For safety reasons we only allow certain functions to be overridden with 61 * bpf_error_injection, so we need to populate the list of the symbols that have 62 * been marked as safe for overriding. --- 179 unchanged lines hidden --- |