Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug: Add BUG_FORMAT_ARGS infrastructure

Add BUG_FORMAT_ARGS; when an architecture is able to provide a va_list
given pt_regs, use this to print format arguments.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115757.457339417@infradead.org

+16 -2
+1
include/asm-generic/bug.h
··· 13 13 #define BUGFLAG_ONCE (1 << 1) 14 14 #define BUGFLAG_DONE (1 << 2) 15 15 #define BUGFLAG_NO_CUT_HERE (1 << 3) /* CUT_HERE already sent */ 16 + #define BUGFLAG_ARGS (1 << 4) 16 17 #define BUGFLAG_TAINT(taint) ((taint) << 8) 17 18 #define BUG_GET_TAINT(bug) ((bug)->flags >> 8) 18 19 #endif
+15 -2
lib/bug.c
··· 163 163 return module_find_bug(bugaddr); 164 164 } 165 165 166 - static void __warn_printf(const char *fmt) 166 + static void __warn_printf(const char *fmt, struct pt_regs *regs) 167 167 { 168 168 if (!fmt) 169 169 return; 170 + 171 + #ifdef HAVE_ARCH_BUG_FORMAT_ARGS 172 + if (regs) { 173 + struct arch_va_list _args; 174 + va_list *args = __warn_args(&_args, regs); 175 + 176 + if (args) { 177 + vprintk(fmt, *args); 178 + return; 179 + } 180 + } 181 + #endif 170 182 171 183 printk("%s", fmt); 172 184 } ··· 205 193 once = bug->flags & BUGFLAG_ONCE; 206 194 done = bug->flags & BUGFLAG_DONE; 207 195 no_cut = bug->flags & BUGFLAG_NO_CUT_HERE; 196 + has_args = bug->flags & BUGFLAG_ARGS; 208 197 209 198 if (warning && once) { 210 199 if (done) ··· 225 212 */ 226 213 if (!no_cut) { 227 214 printk(KERN_DEFAULT CUT_HERE); 228 - __warn_printf(fmt); 215 + __warn_printf(fmt, has_args ? regs : NULL); 229 216 } 230 217 231 218 if (warning) {