Re: [RFC v3 8/9] kmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict

From: kbuild test robot
Date: Mon Oct 19 2015 - 09:53:09 EST


Hi Marcin,

[auto build test ERROR on next-20151016 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url: https://github.com/0day-ci/linux/commits/Paul-Osmialowski/Additional-kmsg-devices/20151019-211509
config: i386-randconfig-s1-201542 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

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

kernel/printk/kmsg.c: In function 'set_kmsg_dict':
>> kernel/printk/kmsg.c:55:32: error: implicit declaration of function 'task_tgid_nr' [-Werror=implicit-function-declaration]
len = sprintf(buf, "_PID=%d", task_tgid_nr(current)) + 1;
^
>> kernel/printk/kmsg.c:56:39: error: implicit declaration of function 'task_pid_nr' [-Werror=implicit-function-declaration]
len += sprintf(buf + len, "_TID=%d", task_pid_nr(current)) + 1;
^
>> kernel/printk/kmsg.c:59:2: error: implicit declaration of function 'get_task_comm' [-Werror=implicit-function-declaration]
get_task_comm(buf + len, current);
^
In file included from include/linux/fs.h:5:0,
from kernel/printk/kmsg.c:5:
kernel/printk/kmsg.c: In function 'kmsg_sys_write':
include/linux/wait.h:171:47: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
^
kernel/printk/kmsg.c:84:3: note: in expansion of macro 'wake_up_interruptible'
wake_up_interruptible(&log_b->wait);
^
include/linux/wait.h:171:47: note: each undeclared identifier is reported only once for each function it appears in
#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
^
kernel/printk/kmsg.c:84:3: note: in expansion of macro 'wake_up_interruptible'
wake_up_interruptible(&log_b->wait);
^
kernel/printk/kmsg.c: In function 'devkmsg_write':
>> kernel/printk/kmsg.c:40:10: error: 'TASK_COMM_LEN' undeclared (first use in this function)
6 + TASK_COMM_LEN)
^
kernel/printk/kmsg.c:102:12: note: in expansion of macro 'KMSG_DICT_MAX_LEN'
char dict[KMSG_DICT_MAX_LEN];
^
>> kernel/printk/kmsg.c:102:7: warning: unused variable 'dict' [-Wunused-variable]
char dict[KMSG_DICT_MAX_LEN];
^
In file included from include/linux/fs.h:5:0,
from kernel/printk/kmsg.c:5:
kernel/printk/kmsg.c: In function 'kmsg_read':
include/linux/wait.h:400:31: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
^
include/linux/wait.h:225:52: note: in definition of macro '___wait_event'
long __int = prepare_to_wait_event(&wq, &__wait, state);\
^
include/linux/wait.h:423:11: note: in expansion of macro '__wait_event_interruptible'
__ret = __wait_event_interruptible(wq, condition); \
^
kernel/printk/kmsg.c:181:10: note: in expansion of macro 'wait_event_interruptible'
ret = wait_event_interruptible(log_b->wait,
^
include/linux/wait.h:198:43: error: 'TASK_KILLABLE' undeclared (first use in this function)
state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
^
include/linux/wait.h:230:7: note: in expansion of macro '___wait_is_interruptible'
if (___wait_is_interruptible(state) && __int) { \
^
include/linux/wait.h:400:2: note: in expansion of macro '___wait_event'
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
^
include/linux/wait.h:423:11: note: in expansion of macro '__wait_event_interruptible'
__ret = __wait_event_interruptible(wq, condition); \
^
kernel/printk/kmsg.c:181:10: note: in expansion of macro 'wait_event_interruptible'
ret = wait_event_interruptible(log_b->wait,
^
include/linux/wait.h:401:9: error: implicit declaration of function 'schedule' [-Werror=implicit-function-declaration]
schedule())
^
include/linux/wait.h:240:3: note: in definition of macro '___wait_event'
cmd; \
^
include/linux/wait.h:423:11: note: in expansion of macro '__wait_event_interruptible'
__ret = __wait_event_interruptible(wq, condition); \
^
kernel/printk/kmsg.c:181:10: note: in expansion of macro 'wait_event_interruptible'
ret = wait_event_interruptible(log_b->wait,
^
kernel/printk/kmsg.c: In function 'kmsg_sys_buffer_del':
include/linux/wait.h:171:47: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
^
kernel/printk/kmsg.c:734:2: note: in expansion of macro 'wake_up_interruptible'
wake_up_interruptible(&log_b->wait);
^
cc1: some warnings being treated as errors

vim +/task_tgid_nr +55 kernel/printk/kmsg.c

34 * Fromat below describes dict appended to message written from userspace:
35 * "_PID=<pid>\0_TID=<tid>\0_COMM=<comm>"
36 * KMSG_DICT_MAX_LEN definition represents maximal length of this dict.
37 */
38 #define KMSG_DICT_MAX_LEN (5 + MAX_PID_LEN + 1 + \
39 5 + MAX_TID_LEN + 1 + \
> 40 6 + TASK_COMM_LEN)
41
42 /* /dev/kmsg - userspace message inject/listen interface */
43 struct devkmsg_user {
44 u64 seq;
45 u32 idx;
46 enum log_flags prev;
47 struct mutex lock;
48 char buf[CONSOLE_EXT_LOG_MAX];
49 };
50
51 static size_t set_kmsg_dict(char *buf)
52 {
53 size_t len;
54
> 55 len = sprintf(buf, "_PID=%d", task_tgid_nr(current)) + 1;
> 56 len += sprintf(buf + len, "_TID=%d", task_pid_nr(current)) + 1;
57 memcpy(buf + len, "_COMM=", 6);
58 len += 6;
> 59 get_task_comm(buf + len, current);
60 while (buf[len] != '\0')
61 len++;
62 return len;
63 }
64
65 static int kmsg_sys_write(int minor, int level,
66 const char *dict, size_t dictlen,
67 const char *fmt, ...)
68 {
69 va_list args;
70 int ret = -ENXIO;
71 struct log_buffer *log_b;
72
73 rcu_read_lock();
74 list_for_each_entry_rcu(log_b, &log_buf.list, list) {
75 if (log_b->minor != minor)
76 continue;
77
78 raw_spin_lock(&log_b->lock);
79
80 va_start(args, fmt);
81 log_format_and_store(log_b, 1 /* LOG_USER */, level,
82 dict, dictlen, fmt, args);
83 va_end(args);
> 84 wake_up_interruptible(&log_b->wait);
85
86 raw_spin_unlock(&log_b->lock);
87
88 ret = 0;
89 break;
90 }
91 rcu_read_unlock();
92 return ret;
93 }
94
95 static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
96 {
97 char *buf, *line;
98 int i;
99 int level = default_message_loglevel;
100 int facility = 1; /* LOG_USER */
101 size_t len = iov_iter_count(from);
> 102 char dict[KMSG_DICT_MAX_LEN];
103 size_t dictlen;
104 ssize_t ret = len;
105 int minor = iminor(iocb->ki_filp->f_inode);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data