On Thu, May 29, 2025 at 10:46:15AM -0700, Kees Cook wrote: > Doing it on the other end doesn't look great (see the other reply). I was > suggesting it's not on fast path because the added code is a dependant > conditional following an "unlikley" conditional. But if you wanted to > push it totally out of line, we'd likely need to pass __func__ into > warn_slowpath_fmt() and __warn_printk(), and then have __warn_printk()
warn_slowpath_fmt() already uses buildin_return_address(0), and then it can use kallsyms to find the symbol name. No need to pass __func__ as a string. > return bool to make the call to __WARN_FLAGS() conditional. e.g.: > > - warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \ > + warn_slowpath_fmt(__FILE__, __LINE__, __func__, taint, arg); \ > > and: > > - __warn_printk(arg); \ > - __WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ > + if (__warn_printk(__func__, arg)) \ > + __WARN_FLAGS(BUGFLAG_NO_CUT_HERE | > BUGFLAG_TAINT(taint));\ > > But it still leaves bare __WARN unhandled... Nah, don't propagate, just eat the __WARN and handle things in __report_bug(), which is where they all end up. But the real purpose here seems to be to supress printk output, so why not use 'suppress_printk' ?