* [linux-next:master 2466/3226] lib/tests/usercopy_kunit.c:221:30: sparse: sparse: cast removes address space '__user' of expression
@ 2025-02-12 13:26 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-02-12 13:26 UTC (permalink / raw)
To: Kees Cook; +Cc: oe-kbuild-all, David Gow, Rae Moar
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: c674aa7c289e51659e40dda0f954886ef7f80042
commit: db6fe4d61ece24193eb4d94a82d967501d53358c [2466/3226] lib: Move KUnit tests into tests/ subdirectory
config: s390-randconfig-r123-20250212 (https://download.01.org/0day-ci/archive/20250212/202502122136.Sjpqw7DS-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce: (https://download.01.org/0day-ci/archive/20250212/202502122136.Sjpqw7DS-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502122136.Sjpqw7DS-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> lib/tests/usercopy_kunit.c:221:30: sparse: sparse: cast removes address space '__user' of expression
lib/tests/usercopy_kunit.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
include/linux/uaccess.h:385:23: sparse: sparse: self-comparison always evaluates to false
include/linux/uaccess.h:386:23: sparse: sparse: self-comparison always evaluates to false
include/linux/uaccess.h:393:21: sparse: sparse: self-comparison always evaluates to false
include/linux/uaccess.h:395:28: sparse: sparse: self-comparison always evaluates to false
--
>> lib/tests/overflow_kunit.c:31:36: sparse: sparse: undefined preprocessor identifier '__clang_major__'
lib/tests/overflow_kunit.c:41:36: sparse: sparse: undefined preprocessor identifier '__clang_major__'
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:359:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:360:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:361:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:362:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:363:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:364:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:365:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:365:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:365:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:366:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:366:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:366:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:373:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:379:1: sparse: sparse: self-comparison always evaluates to true
lib/tests/overflow_kunit.c:379:1: sparse: sparse: self-comparison always evaluates to true
vim +/__user +221 lib/tests/usercopy_kunit.c
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 213
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 214 /*
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 215 * Invalid usage: none of these copies should succeed.
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 216 */
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 217 static void usercopy_test_invalid(struct kunit *test)
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 218 {
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 219 struct usercopy_test_priv *priv = test->priv;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 220 char __user *usermem = priv->umem;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 @221 char *bad_usermem = (char *)usermem;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 222 char *kmem = priv->kmem;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 223 u64 *kmem_u64 = (u64 *)kmem;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 224
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 225 if (IS_ENABLED(CONFIG_ALTERNATE_USER_ADDRESS_SPACE) ||
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 226 !IS_ENABLED(CONFIG_MMU)) {
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 227 kunit_skip(test, "Testing for kernel/userspace address confusion is only sensible on architectures with a shared address space");
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 228 return;
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 229 }
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 230
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 231 /* Prepare kernel memory with check values. */
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 232 memset(kmem, 0x5a, PAGE_SIZE);
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 233 memset(kmem + PAGE_SIZE, 0, PAGE_SIZE);
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 234
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 235 /* Reject kernel-to-kernel copies through copy_from_user(). */
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 236 KUNIT_EXPECT_NE_MSG(test, copy_from_user(kmem, (char __user *)(kmem + PAGE_SIZE),
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 237 PAGE_SIZE), 0,
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 238 "illegal all-kernel copy_from_user passed");
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 239
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 240 /* Destination half of buffer should have been zeroed. */
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 241 KUNIT_EXPECT_MEMEQ_MSG(test, kmem + PAGE_SIZE, kmem, PAGE_SIZE,
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 242 "zeroing failure for illegal all-kernel copy_from_user");
cf6219ee889fb3 lib/usercopy_kunit.c Kees Cook 2024-06-12 243
:::::: The code at line 221 was first introduced by commit
:::::: cf6219ee889fb304cf8192c707ad280d93baafc7 usercopy: Convert test_user_copy to KUnit test
:::::: TO: Kees Cook <kees@kernel.org>
:::::: CC: Shuah Khan <skhan@linuxfoundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-12 13:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 13:26 [linux-next:master 2466/3226] lib/tests/usercopy_kunit.c:221:30: sparse: sparse: cast removes address space '__user' of expression kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.