lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Jun 2024 15:53:03 +0800
From: kernel test robot <lkp@...el.com>
To: Aleksandr Nogikh <nogikh@...gle.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Memory Management List <linux-mm@...ck.org>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Andrey Konovalov <andreyknvl@...il.com>
Subject: kernel/kcov.c:635:32: error: 'KCOV_MODE_REMOTE' undeclared

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e5b3efbe1ab1793bb49ae07d56d0973267e65112
commit: 01c8f9806bde438ca1c8cbbc439f0a14a6694f6c kcov: don't lose track of remote references during softirqs
date:   5 days ago
config: x86_64-randconfig-014-20240202 (https://download.01.org/0day-ci/archive/20240620/202406201538.SMBucNWT-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240620/202406201538.SMBucNWT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406201538.SMBucNWT-lkp@intel.com/

All errors (new ones prefixed by >>):

         |                     ^~
   include/asm-generic/rwonce.h:55:27: note: in definition of macro '__WRITE_ONCE'
      55 |         *(volatile typeof(x) *)&(x) = (val);                            \
         |                           ^
   kernel/kcov.c:363:9: note: in expansion of macro 'WRITE_ONCE'
     363 |         WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
         |         ^~~~~~~~~~
   kernel/kcov.c:363:21: error: 'struct task_struct' has no member named 'kcov_mode'
     363 |         WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
         |                     ^~
   include/asm-generic/rwonce.h:55:34: note: in definition of macro '__WRITE_ONCE'
      55 |         *(volatile typeof(x) *)&(x) = (val);                            \
         |                                  ^
   kernel/kcov.c:363:9: note: in expansion of macro 'WRITE_ONCE'
     363 |         WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
         |         ^~~~~~~~~~
   kernel/kcov.c:363:34: error: 'KCOV_MODE_DISABLED' undeclared (first use in this function); did you mean 'KCOV_DISABLE'?
     363 |         WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
         |                                  ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:55:40: note: in definition of macro '__WRITE_ONCE'
      55 |         *(volatile typeof(x) *)&(x) = (val);                            \
         |                                        ^~~
   kernel/kcov.c:363:9: note: in expansion of macro 'WRITE_ONCE'
     363 |         WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
         |         ^~~~~~~~~~
   kernel/kcov.c:365:10: error: 'struct task_struct' has no member named 'kcov'
     365 |         t->kcov = NULL;
         |          ^~
   kernel/kcov.c:366:10: error: 'struct task_struct' has no member named 'kcov_size'
     366 |         t->kcov_size = 0;
         |          ^~
   kernel/kcov.c:367:10: error: 'struct task_struct' has no member named 'kcov_area'
     367 |         t->kcov_area = NULL;
         |          ^~
   kernel/kcov.c: In function 'kcov_task_reset':
   kernel/kcov.c:373:10: error: 'struct task_struct' has no member named 'kcov_sequence'
     373 |         t->kcov_sequence = 0;
         |          ^~
   kernel/kcov.c:374:10: error: 'struct task_struct' has no member named 'kcov_handle'
     374 |         t->kcov_handle = 0;
         |          ^~
   kernel/kcov.c: At top level:
   kernel/kcov.c:377:6: error: redefinition of 'kcov_task_init'
     377 | void kcov_task_init(struct task_struct *t)
         |      ^~~~~~~~~~~~~~
   In file included from kernel/kcov.c:24:
   include/linux/kcov.h:96:20: note: previous definition of 'kcov_task_init' with type 'void(struct task_struct *)'
      96 | static inline void kcov_task_init(struct task_struct *t) {}
         |                    ^~~~~~~~~~~~~~
   kernel/kcov.c: In function 'kcov_task_init':
   kernel/kcov.c:380:10: error: 'struct task_struct' has no member named 'kcov_handle'
     380 |         t->kcov_handle = current->kcov_handle;
         |          ^~
   kernel/kcov.c:380:33: error: 'struct task_struct' has no member named 'kcov_handle'
     380 |         t->kcov_handle = current->kcov_handle;
         |                                 ^~
   kernel/kcov.c: In function 'kcov_reset':
   kernel/kcov.c:386:22: error: 'KCOV_MODE_INIT' undeclared (first use in this function)
     386 |         kcov->mode = KCOV_MODE_INIT;
         |                      ^~~~~~~~~~~~~~
   kernel/kcov.c: At top level:
   kernel/kcov.c:434:6: error: redefinition of 'kcov_task_exit'
     434 | void kcov_task_exit(struct task_struct *t)
         |      ^~~~~~~~~~~~~~
   include/linux/kcov.h:97:20: note: previous definition of 'kcov_task_exit' with type 'void(struct task_struct *)'
      97 | static inline void kcov_task_exit(struct task_struct *t) {}
         |                    ^~~~~~~~~~~~~~
   kernel/kcov.c: In function 'kcov_task_exit':
   kernel/kcov.c:439:17: error: 'struct task_struct' has no member named 'kcov'
     439 |         kcov = t->kcov;
         |                 ^~
   kernel/kcov.c: In function 'kcov_open':
   kernel/kcov.c:515:22: error: 'KCOV_MODE_DISABLED' undeclared (first use in this function); did you mean 'KCOV_DISABLE'?
     515 |         kcov->mode = KCOV_MODE_DISABLED;
         |                      ^~~~~~~~~~~~~~~~~~
         |                      KCOV_DISABLE
   kernel/kcov.c: In function 'kcov_get_mode':
   kernel/kcov.c:532:24: error: 'KCOV_MODE_TRACE_PC' undeclared (first use in this function); did you mean 'KCOV_TRACE_PC'?
     532 |                 return KCOV_MODE_TRACE_PC;
         |                        ^~~~~~~~~~~~~~~~~~
         |                        KCOV_TRACE_PC
   kernel/kcov.c: In function 'kcov_ioctl_locked':
   kernel/kcov.c:593:35: error: 'KCOV_MODE_INIT' undeclared (first use in this function)
     593 |                 if (kcov->mode != KCOV_MODE_INIT || !kcov->area)
         |                                   ^~~~~~~~~~~~~~
   kernel/kcov.c:596:41: error: 'struct task_struct' has no member named 'kcov'
     596 |                 if (kcov->t != NULL || t->kcov != NULL)
         |                                         ^~
   kernel/kcov.c:612:43: error: 'struct task_struct' has no member named 'kcov'
     612 |                 if (unused != 0 || current->kcov != kcov)
         |                                           ^~
   kernel/kcov.c:624:41: error: 'struct task_struct' has no member named 'kcov'
     624 |                 if (kcov->t != NULL || t->kcov != NULL)
         |                                         ^~
   kernel/kcov.c:634:18: error: 'struct task_struct' has no member named 'kcov'
     634 |                 t->kcov = kcov;
         |                  ^~
   kernel/kcov.c:635:18: error: 'struct task_struct' has no member named 'kcov_mode'
     635 |                 t->kcov_mode = KCOV_MODE_REMOTE;
         |                  ^~
>> kernel/kcov.c:635:32: error: 'KCOV_MODE_REMOTE' undeclared (first use in this function)
     635 |                 t->kcov_mode = KCOV_MODE_REMOTE;
         |                                ^~~~~~~~~~~~~~~~
   kernel/kcov.c:672:26: error: 'struct task_struct' has no member named 'kcov_handle'
     672 |                         t->kcov_handle = remote_arg->common_handle;
         |                          ^~
   kernel/kcov.c: In function 'kcov_ioctl':
   kernel/kcov.c:710:35: error: 'KCOV_MODE_DISABLED' undeclared (first use in this function); did you mean 'KCOV_DISABLE'?
     710 |                 if (kcov->mode != KCOV_MODE_DISABLED) {
         |                                   ^~~~~~~~~~~~~~~~~~
         |                                   KCOV_DISABLE
   kernel/kcov.c:717:30: error: 'KCOV_MODE_INIT' undeclared (first use in this function)
     717 |                 kcov->mode = KCOV_MODE_INIT;
         |                              ^~~~~~~~~~~~~~
   kernel/kcov.c: In function 'kcov_mode_enabled':
   kernel/kcov.c:803:25: error: 'KCOV_IN_CTXSW' undeclared (first use in this function)
     803 |         return (mode & ~KCOV_IN_CTXSW) != KCOV_MODE_DISABLED;
         |                         ^~~~~~~~~~~~~
   kernel/kcov.c:803:43: error: 'KCOV_MODE_DISABLED' undeclared (first use in this function); did you mean 'KCOV_DISABLE'?
     803 |         return (mode & ~KCOV_IN_CTXSW) != KCOV_MODE_DISABLED;
         |                                           ^~~~~~~~~~~~~~~~~~
         |                                           KCOV_DISABLE
   kernel/kcov.c: In function 'kcov_remote_softirq_start':
   kernel/kcov.c:811:27: error: 'struct task_struct' has no member named 'kcov_mode'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                           ^~
   include/linux/compiler_types.h:467:23: note: in definition of macro '__compiletime_assert'
     467 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert'
     487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/kcov.c:811:16: note: in expansion of macro 'READ_ONCE'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                ^~~~~~~~~
   kernel/kcov.c:811:27: error: 'struct task_struct' has no member named 'kcov_mode'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                           ^~
   include/linux/compiler_types.h:467:23: note: in definition of macro '__compiletime_assert'
     467 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert'
     487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/kcov.c:811:16: note: in expansion of macro 'READ_ONCE'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                ^~~~~~~~~
   kernel/kcov.c:811:27: error: 'struct task_struct' has no member named 'kcov_mode'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                           ^~
   include/linux/compiler_types.h:467:23: note: in definition of macro '__compiletime_assert'
     467 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert'
     487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/kcov.c:811:16: note: in expansion of macro 'READ_ONCE'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                ^~~~~~~~~
   kernel/kcov.c:811:27: error: 'struct task_struct' has no member named 'kcov_mode'
     811 |         mode = READ_ONCE(t->kcov_mode);
         |                           ^~
   include/linux/compiler_types.h:467:23: note: in definition of macro '__compiletime_assert'
     467 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert'
     487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~


vim +/KCOV_MODE_REMOTE +635 kernel/kcov.c

   574	
   575	static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
   576				     unsigned long arg)
   577	{
   578		struct task_struct *t;
   579		unsigned long flags, unused;
   580		int mode, i;
   581		struct kcov_remote_arg *remote_arg;
   582		struct kcov_remote *remote;
   583	
   584		switch (cmd) {
   585		case KCOV_ENABLE:
   586			/*
   587			 * Enable coverage for the current task.
   588			 * At this point user must have been enabled trace mode,
   589			 * and mmapped the file. Coverage collection is disabled only
   590			 * at task exit or voluntary by KCOV_DISABLE. After that it can
   591			 * be enabled for another task.
   592			 */
   593			if (kcov->mode != KCOV_MODE_INIT || !kcov->area)
   594				return -EINVAL;
   595			t = current;
   596			if (kcov->t != NULL || t->kcov != NULL)
   597				return -EBUSY;
   598			mode = kcov_get_mode(arg);
   599			if (mode < 0)
   600				return mode;
   601			kcov_fault_in_area(kcov);
   602			kcov->mode = mode;
   603			kcov_start(t, kcov, kcov->size, kcov->area, kcov->mode,
   604					kcov->sequence);
   605			kcov->t = t;
   606			/* Put either in kcov_task_exit() or in KCOV_DISABLE. */
   607			kcov_get(kcov);
   608			return 0;
   609		case KCOV_DISABLE:
   610			/* Disable coverage for the current task. */
   611			unused = arg;
   612			if (unused != 0 || current->kcov != kcov)
   613				return -EINVAL;
   614			t = current;
   615			if (WARN_ON(kcov->t != t))
   616				return -EINVAL;
   617			kcov_disable(t, kcov);
   618			kcov_put(kcov);
   619			return 0;
   620		case KCOV_REMOTE_ENABLE:
   621			if (kcov->mode != KCOV_MODE_INIT || !kcov->area)
   622				return -EINVAL;
   623			t = current;
   624			if (kcov->t != NULL || t->kcov != NULL)
   625				return -EBUSY;
   626			remote_arg = (struct kcov_remote_arg *)arg;
   627			mode = kcov_get_mode(remote_arg->trace_mode);
   628			if (mode < 0)
   629				return mode;
   630			if ((unsigned long)remote_arg->area_size >
   631			    LONG_MAX / sizeof(unsigned long))
   632				return -EINVAL;
   633			kcov->mode = mode;
   634			t->kcov = kcov;
 > 635		        t->kcov_mode = KCOV_MODE_REMOTE;
   636			kcov->t = t;
   637			kcov->remote = true;
   638			kcov->remote_size = remote_arg->area_size;
   639			spin_lock_irqsave(&kcov_remote_lock, flags);
   640			for (i = 0; i < remote_arg->num_handles; i++) {
   641				if (!kcov_check_handle(remote_arg->handles[i],
   642							false, true, false)) {
   643					spin_unlock_irqrestore(&kcov_remote_lock,
   644								flags);
   645					kcov_disable(t, kcov);
   646					return -EINVAL;
   647				}
   648				remote = kcov_remote_add(kcov, remote_arg->handles[i]);
   649				if (IS_ERR(remote)) {
   650					spin_unlock_irqrestore(&kcov_remote_lock,
   651								flags);
   652					kcov_disable(t, kcov);
   653					return PTR_ERR(remote);
   654				}
   655			}
   656			if (remote_arg->common_handle) {
   657				if (!kcov_check_handle(remote_arg->common_handle,
   658							true, false, false)) {
   659					spin_unlock_irqrestore(&kcov_remote_lock,
   660								flags);
   661					kcov_disable(t, kcov);
   662					return -EINVAL;
   663				}
   664				remote = kcov_remote_add(kcov,
   665						remote_arg->common_handle);
   666				if (IS_ERR(remote)) {
   667					spin_unlock_irqrestore(&kcov_remote_lock,
   668								flags);
   669					kcov_disable(t, kcov);
   670					return PTR_ERR(remote);
   671				}
   672				t->kcov_handle = remote_arg->common_handle;
   673			}
   674			spin_unlock_irqrestore(&kcov_remote_lock, flags);
   675			/* Put either in kcov_task_exit() or in KCOV_DISABLE. */
   676			kcov_get(kcov);
   677			return 0;
   678		default:
   679			return -ENOTTY;
   680		}
   681	}
   682	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ