Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)   Generic support for BUG()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)   This respects the following config options:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)   CONFIG_BUG - emit BUG traps.  Nothing happens without this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)   CONFIG_GENERIC_BUG - enable this code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)   CONFIG_GENERIC_BUG_RELATIVE_POINTERS - use 32-bit pointers relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	the containing struct bug_entry for bug_addr and file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)   CONFIG_DEBUG_BUGVERBOSE - emit full file+line information for each BUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)   CONFIG_BUG and CONFIG_DEBUG_BUGVERBOSE are potentially user-settable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)   (though they're generally always on).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)   CONFIG_GENERIC_BUG is set by each architecture using this code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)   To use this, your architecture must:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)   1. Set up the config options:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)      - Enable CONFIG_GENERIC_BUG if CONFIG_BUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)   2. Implement BUG (and optionally BUG_ON, WARN, WARN_ON)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)      - Define HAVE_ARCH_BUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)      - Implement BUG() to generate a faulting instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)      - NOTE: struct bug_entry does not have "file" or "line" entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)        when CONFIG_DEBUG_BUGVERBOSE is not enabled, so you must generate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)        the values accordingly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)   3. Implement the trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)      - In the illegal instruction trap handler (typically), verify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)        that the fault was in kernel mode, and call report_bug()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)      - report_bug() will return whether it was a false alarm, a warning,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)        or an actual bug.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)      - You must implement the is_valid_bugaddr(bugaddr) callback which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)        returns true if the eip is a real kernel address, and it points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)        to the expected BUG trap instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)     Jeremy Fitzhardinge <jeremy@goop.org> 2006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define pr_fmt(fmt) fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #include <linux/bug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #include <linux/rculist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #include <linux/ftrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #include <trace/hooks/bug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) extern struct bug_entry __start___bug_table[], __stop___bug_table[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static inline unsigned long bug_addr(const struct bug_entry *bug)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	return bug->bug_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	return (unsigned long)bug + bug->bug_addr_disp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #ifdef CONFIG_MODULES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) /* Updates are protected by module mutex */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static LIST_HEAD(module_bug_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static struct bug_entry *module_find_bug(unsigned long bugaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct module *mod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct bug_entry *bug = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	rcu_read_lock_sched();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	list_for_each_entry_rcu(mod, &module_bug_list, bug_list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		unsigned i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		bug = mod->bug_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		for (i = 0; i < mod->num_bugs; ++i, ++bug)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			if (bugaddr == bug_addr(bug))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 				goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	bug = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	rcu_read_unlock_sched();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	return bug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			 struct module *mod)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	char *secstrings;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	lockdep_assert_held(&module_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	mod->bug_table = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	mod->num_bugs = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	/* Find the __bug_table section, if present */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	for (i = 1; i < hdr->e_shnum; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		if (strcmp(secstrings+sechdrs[i].sh_name, "__bug_table"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		mod->bug_table = (void *) sechdrs[i].sh_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 * Strictly speaking this should have a spinlock to protect against
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * traversals, but since we only traverse on BUG()s, a spinlock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 * could potentially lead to deadlock and thus be counter-productive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	 * Thus, this uses RCU to safely manipulate the bug list, since BUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	 * must run in non-interruptive state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	list_add_rcu(&mod->bug_list, &module_bug_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void module_bug_cleanup(struct module *mod)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	lockdep_assert_held(&module_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	list_del_rcu(&mod->bug_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) static inline struct bug_entry *module_find_bug(unsigned long bugaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct bug_entry *find_bug(unsigned long bugaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct bug_entry *bug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		if (bugaddr == bug_addr(bug))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			return bug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	return module_find_bug(bugaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	struct bug_entry *bug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	const char *file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	unsigned line, warning, once, done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	if (!is_valid_bugaddr(bugaddr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		return BUG_TRAP_TYPE_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	bug = find_bug(bugaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	if (!bug)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		return BUG_TRAP_TYPE_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	disable_trace_on_warning();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	file = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	line = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #ifdef CONFIG_DEBUG_BUGVERBOSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	file = bug->file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	file = (const char *)bug + bug->file_disp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	line = bug->line;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	warning = (bug->flags & BUGFLAG_WARNING) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	once = (bug->flags & BUGFLAG_ONCE) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	done = (bug->flags & BUGFLAG_DONE) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	if (warning && once) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		if (done)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			return BUG_TRAP_TYPE_WARN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		 * Since this is the only store, concurrency is not an issue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		bug->flags |= BUGFLAG_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 * BUG() and WARN_ON() families don't print a custom debug message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	 * before triggering the exception handler, so we must add the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	 * "cut here" line now. WARN() issues its own "cut here" before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	 * extra debugging message it writes before triggering the handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	if ((bug->flags & BUGFLAG_NO_CUT_HERE) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		printk(KERN_DEFAULT CUT_HERE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	if (warning) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		/* this is a WARN_ON rather than BUG/BUG_ON */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		__warn(file, line, (void *)bugaddr, BUG_GET_TAINT(bug), regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		       NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		return BUG_TRAP_TYPE_WARN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	if (file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		pr_crit("kernel BUG at %s:%u!\n", file, line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			(void *)bugaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	trace_android_rvh_report_bug(file, line, bugaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	return BUG_TRAP_TYPE_BUG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static void clear_once_table(struct bug_entry *start, struct bug_entry *end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct bug_entry *bug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	for (bug = start; bug < end; bug++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		bug->flags &= ~BUGFLAG_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) void generic_bug_clear_once(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #ifdef CONFIG_MODULES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	struct module *mod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	rcu_read_lock_sched();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	list_for_each_entry_rcu(mod, &module_bug_list, bug_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		clear_once_table(mod->bug_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				 mod->bug_table + mod->num_bugs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	rcu_read_unlock_sched();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	clear_once_table(__start___bug_table, __stop___bug_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }