Re: [PATCH] tty: use printk_safe context at tty_msg()

From: kernel test robot
Date: Sat Apr 03 2021 - 02:56:08 EST


Hi Tetsuo,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Tetsuo-Handa/tty-use-printk_safe-context-at-tty_msg/20210403-121636
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: microblaze-randconfig-r001-20210403 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/88235b87a105a519a205a28753857b7db5e6b3d1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tetsuo-Handa/tty-use-printk_safe-context-at-tty_msg/20210403-121636
git checkout 88235b87a105a519a205a28753857b7db5e6b3d1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/tty.h:17,
from kernel/signal.c:26:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
--
In file included from include/linux/tty.h:17,
from kernel/audit.h:13,
from kernel/audit.c:63:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
kernel/audit.c:1778:14: warning: no previous prototype for 'audit_serial' [-Wmissing-prototypes]
1778 | unsigned int audit_serial(void)
| ^~~~~~~~~~~~
kernel/audit.c: In function 'audit_log_vformat':
kernel/audit.c:1926:2: warning: function 'audit_log_vformat' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
1926 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args);
| ^~~
kernel/audit.c:1935:3: warning: function 'audit_log_vformat' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
1935 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2);
| ^~~
--
In file included from include/linux/tty.h:17,
from kernel/audit.h:13,
from kernel/auditfilter.c:23:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
kernel/auditfilter.c: In function 'audit_data_to_entry':
kernel/auditfilter.c:609:37: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
609 | audit_remove_mark(entry->rule.exe); /* that's the template one */
| ^
kernel/auditfilter.c: In function 'audit_dupe_rule':
kernel/auditfilter.c:875:32: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
875 | audit_remove_mark(new->exe);
| ^
kernel/auditfilter.c: In function 'audit_del_rule':
kernel/auditfilter.c:1045:35: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
1045 | audit_remove_mark_rule(&e->rule);
| ^
kernel/auditfilter.c: In function 'audit_rule_change':
kernel/auditfilter.c:1150:38: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
1150 | audit_remove_mark(entry->rule.exe);
| ^
kernel/auditfilter.c: In function 'update_lsm_rule':
kernel/auditfilter.c:1402:37: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
1402 | audit_remove_mark(entry->rule.exe);
| ^
--
In file included from include/linux/tty.h:17,
from kernel/fork.c:78:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
kernel/fork.c:161:13: warning: no previous prototype for 'arch_release_task_struct' [-Wmissing-prototypes]
161 | void __weak arch_release_task_struct(struct task_struct *tsk)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/fork.c:746:20: warning: no previous prototype for 'arch_task_cache_init' [-Wmissing-prototypes]
746 | void __init __weak arch_task_cache_init(void) { }
| ^~~~~~~~~~~~~~~~~~~~
kernel/fork.c:836:12: warning: no previous prototype for 'arch_dup_task_struct' [-Wmissing-prototypes]
836 | int __weak arch_dup_task_struct(struct task_struct *dst,
| ^~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/tty.h:17,
from include/linux/vt_kern.h:12,
from kernel/panic.c:19:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
kernel/panic.c:85:13: warning: no previous prototype for 'panic_smp_self_stop' [-Wmissing-prototypes]
85 | void __weak panic_smp_self_stop(void)
| ^~~~~~~~~~~~~~~~~~~
kernel/panic.c:95:13: warning: no previous prototype for 'nmi_panic_self_stop' [-Wmissing-prototypes]
95 | void __weak nmi_panic_self_stop(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~
kernel/panic.c:106:13: warning: no previous prototype for 'crash_smp_send_stop' [-Wmissing-prototypes]
106 | void __weak crash_smp_send_stop(void)
| ^~~~~~~~~~~~~~~~~~~
kernel/panic.c:576:6: warning: no previous prototype for '__warn' [-Wmissing-prototypes]
576 | void __warn(const char *file, int line, void *caller, unsigned taint,
| ^~~~~~
kernel/panic.c: In function '__warn':
kernel/panic.c:590:3: warning: function '__warn' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
590 | vprintk(args->fmt, args->args);
| ^~~~~~~
kernel/panic.c: At top level:
kernel/panic.c:620:6: warning: no previous prototype for 'warn_slowpath_fmt' [-Wmissing-prototypes]
620 | void warn_slowpath_fmt(const char *file, int line, unsigned taint,
| ^~~~~~~~~~~~~~~~~
--
In file included from include/linux/tty.h:17,
from kernel/exit.c:21:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
kernel/exit.c:1763:13: warning: no previous prototype for 'abort' [-Wmissing-prototypes]
1763 | __weak void abort(void)
| ^~~~~
--
In file included from include/linux/tty.h:17,
from kernel/printk/printk.c:24:
>> include/uapi/../../kernel/printk/internal.h:59:20: warning: no previous prototype for 'vprintk_func' [-Wmissing-prototypes]
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
In file included from kernel/printk/printk.c:61:
>> kernel/printk/internal.h:59:20: error: redefinition of 'vprintk_func'
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
In file included from include/linux/tty.h:17,
from kernel/printk/printk.c:24:
include/uapi/../../kernel/printk/internal.h:59:20: note: previous definition of 'vprintk_func' was here
59 | __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
| ^~~~~~~~~~~~
In file included from kernel/printk/printk.c:61:
>> kernel/printk/internal.h:72:20: error: redefinition of 'printk_safe_init'
72 | static inline void printk_safe_init(void) { }
| ^~~~~~~~~~~~~~~~
In file included from include/linux/tty.h:17,
from kernel/printk/printk.c:24:
include/uapi/../../kernel/printk/internal.h:72:20: note: previous definition of 'printk_safe_init' was here
72 | static inline void printk_safe_init(void) { }
| ^~~~~~~~~~~~~~~~
In file included from kernel/printk/printk.c:61:
>> kernel/printk/internal.h:73:20: error: redefinition of 'printk_percpu_data_ready'
73 | static inline bool printk_percpu_data_ready(void) { return false; }
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/tty.h:17,
from kernel/printk/printk.c:24:
include/uapi/../../kernel/printk/internal.h:73:20: note: previous definition of 'printk_percpu_data_ready' was here
73 | static inline bool printk_percpu_data_ready(void) { return false; }
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/printk/printk.c:175:5: warning: no previous prototype for 'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes]
175 | int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
| ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +/vprintk_func +59 kernel/printk/internal.h

099f1c84c0052e Sergey Senozhatsky 2016-12-27 58
099f1c84c0052e Sergey Senozhatsky 2016-12-27 @59 __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
099f1c84c0052e Sergey Senozhatsky 2016-12-27 60
099f1c84c0052e Sergey Senozhatsky 2016-12-27 61 /*
099f1c84c0052e Sergey Senozhatsky 2016-12-27 62 * In !PRINTK builds we still export logbuf_lock spin_lock, console_sem
099f1c84c0052e Sergey Senozhatsky 2016-12-27 63 * semaphore and some of console functions (console_unlock()/etc.), so
099f1c84c0052e Sergey Senozhatsky 2016-12-27 64 * printk-safe must preserve the existing local IRQ guarantees.
099f1c84c0052e Sergey Senozhatsky 2016-12-27 65 */
099f1c84c0052e Sergey Senozhatsky 2016-12-27 66 #define printk_safe_enter_irqsave(flags) local_irq_save(flags)
099f1c84c0052e Sergey Senozhatsky 2016-12-27 67 #define printk_safe_exit_irqrestore(flags) local_irq_restore(flags)
099f1c84c0052e Sergey Senozhatsky 2016-12-27 68
099f1c84c0052e Sergey Senozhatsky 2016-12-27 69 #define printk_safe_enter_irq() local_irq_disable()
099f1c84c0052e Sergey Senozhatsky 2016-12-27 70 #define printk_safe_exit_irq() local_irq_enable()
099f1c84c0052e Sergey Senozhatsky 2016-12-27 71
ab6f762f0f5316 Sergey Senozhatsky 2020-03-03 @72 static inline void printk_safe_init(void) { }
ab6f762f0f5316 Sergey Senozhatsky 2020-03-03 @73 static inline bool printk_percpu_data_ready(void) { return false; }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip