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>] [day] [month] [year] [list]
Message-ID: <202408200939.peJOfCTH-lkp@intel.com>
Date: Tue, 20 Aug 2024 09:53:16 +0800
From: kernel test robot <lkp@...el.com>
To: Kees Cook <kees@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Shuah Khan <skhan@...uxfoundation.org>,
	Vitor Massaru Iha <vitor@...saru.org>,
	David Gow <davidgow@...gle.com>
Subject: lib/usercopy_kunit.c:205:2: error: unexpected token, expected comma

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6e4436539ae182dc86d57d13849862bcafaa4709
commit: cf6219ee889fb304cf8192c707ad280d93baafc7 usercopy: Convert test_user_copy to KUnit test
date:   9 weeks ago
config: mips-randconfig-r111-20240819 (https://download.01.org/0day-ci/archive/20240820/202408200939.peJOfCTH-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce: (https://download.01.org/0day-ci/archive/20240820/202408200939.peJOfCTH-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/202408200939.peJOfCTH-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from lib/usercopy_kunit.c:13:
   In file included from include/linux/mman.h:5:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> lib/usercopy_kunit.c:205:2: error: unexpected token, expected comma
     205 |         test_legit(u8,  0x5a);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:130:18: note: expanded from macro '__put_user'
     130 |                 __put_data_asm(user_sb, __pu_ptr);                      \
         |                                ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
>> lib/usercopy_kunit.c:205:2: error: invalid operand for instruction
     205 |         test_legit(u8,  0x5a);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:130:18: note: expanded from macro '__put_user'
     130 |                 __put_data_asm(user_sb, __pu_ptr);                      \
         |                                ^
   <inline asm>:4:10: note: instantiated into assembly here
       4 |         sbe $2, 0($17)
         |                 ^
>> lib/usercopy_kunit.c:205:2: error: unexpected token, expected comma
     205 |         test_legit(u8,  0x5a);
         |         ^
   lib/usercopy_kunit.c:199:4: note: expanded from macro 'test_legit'
     199 |                         get_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:177:23: note: expanded from macro '__get_user'
     177 |                 __get_data_asm((x), user_lb, __gu_ptr);                 \
         |                                     ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
>> lib/usercopy_kunit.c:205:2: error: invalid operand for instruction
     205 |         test_legit(u8,  0x5a);
         |         ^
   lib/usercopy_kunit.c:199:4: note: expanded from macro 'test_legit'
     199 |                         get_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:177:23: note: expanded from macro '__get_user'
     177 |                 __get_data_asm((x), user_lb, __gu_ptr);                 \
         |                                     ^
   <inline asm>:4:11: note: instantiated into assembly here
       4 |         lbe $20, 0($17)
         |                  ^
   lib/usercopy_kunit.c:206:2: error: unexpected token, expected comma
     206 |         test_legit(u16, 0x5a5b);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:133:18: note: expanded from macro '__put_user'
     133 |                 __put_data_asm(user_sh, __pu_ptr);                      \
         |                                ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   lib/usercopy_kunit.c:206:2: error: invalid operand for instruction
     206 |         test_legit(u16, 0x5a5b);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:133:18: note: expanded from macro '__put_user'
     133 |                 __put_data_asm(user_sh, __pu_ptr);                      \
         |                                ^
   <inline asm>:4:10: note: instantiated into assembly here
       4 |         she $2, 0($17)
         |                 ^
   lib/usercopy_kunit.c:206:2: error: unexpected token, expected comma
     206 |         test_legit(u16, 0x5a5b);
         |         ^
   lib/usercopy_kunit.c:199:4: note: expanded from macro 'test_legit'
     199 |                         get_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:180:23: note: expanded from macro '__get_user'
     180 |                 __get_data_asm((x), user_lh, __gu_ptr);                 \
         |                                     ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   lib/usercopy_kunit.c:206:2: error: invalid operand for instruction
     206 |         test_legit(u16, 0x5a5b);
         |         ^
   lib/usercopy_kunit.c:199:4: note: expanded from macro 'test_legit'
     199 |                         get_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:180:23: note: expanded from macro '__get_user'
     180 |                 __get_data_asm((x), user_lh, __gu_ptr);                 \
         |                                     ^
   <inline asm>:4:11: note: instantiated into assembly here
       4 |         lhe $20, 0($17)
         |                  ^
   lib/usercopy_kunit.c:207:2: error: unexpected token, expected comma
     207 |         test_legit(u32, 0x5a5b5c5d);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \
         |                                ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   lib/usercopy_kunit.c:207:2: error: invalid operand for instruction
     207 |         test_legit(u32, 0x5a5b5c5d);
         |         ^
   lib/usercopy_kunit.c:195:4: note: expanded from macro 'test_legit'
     195 |                         put_user(val_##size, (size __user *)usermem),   \
         |                         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \


vim +205 lib/usercopy_kunit.c

   172	
   173	/*
   174	 * Legitimate usage: none of these copies should fail.
   175	 */
   176	static void usercopy_test_valid(struct kunit *test)
   177	{
   178		struct usercopy_test_priv *priv = test->priv;
   179		char __user *usermem = priv->umem;
   180		char *kmem = priv->kmem;
   181	
   182		memset(kmem, 0x3a, PAGE_SIZE * 2);
   183		KUNIT_EXPECT_EQ_MSG(test, 0, copy_to_user(usermem, kmem, PAGE_SIZE),
   184		     "legitimate copy_to_user failed");
   185		memset(kmem, 0x0, PAGE_SIZE);
   186		KUNIT_EXPECT_EQ_MSG(test, 0, copy_from_user(kmem, usermem, PAGE_SIZE),
   187		     "legitimate copy_from_user failed");
   188		KUNIT_EXPECT_MEMEQ_MSG(test, kmem, kmem + PAGE_SIZE, PAGE_SIZE,
   189		     "legitimate usercopy failed to copy data");
   190	
   191	#define test_legit(size, check)						\
   192		do {								\
   193			size val_##size = (check);				\
   194			KUNIT_EXPECT_EQ_MSG(test, 0,				\
   195				put_user(val_##size, (size __user *)usermem),	\
   196				"legitimate put_user (" #size ") failed");	\
   197			val_##size = 0;						\
   198			KUNIT_EXPECT_EQ_MSG(test, 0,				\
   199				get_user(val_##size, (size __user *)usermem),	\
   200				"legitimate get_user (" #size ") failed");	\
   201			KUNIT_EXPECT_EQ_MSG(test, val_##size, check,		\
   202				"legitimate get_user (" #size ") failed to do copy"); \
   203		} while (0)
   204	
 > 205		test_legit(u8,  0x5a);
   206		test_legit(u16, 0x5a5b);
   207		test_legit(u32, 0x5a5b5c5d);
   208	#ifdef TEST_U64
   209		test_legit(u64, 0x5a5b5c5d6a6b6c6d);
   210	#endif
   211	#undef test_legit
   212	}
   213	

-- 
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