Messages in this thread | | | Date | Wed, 17 Nov 2021 05:34:10 +0800 | From | kernel test robot <> | Subject | arch/x86/kernel/fpu/xstate.c:1310:9: sparse: sparse: incorrect type in argument 1 (different address spaces) |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 8ab774587903771821b59471cc723bba6d893942 commit: db8268df0983adc2bb1fb48c9e5f7bfbb5f617f3 x86/arch_prctl: Add controls for dynamic XSTATE components date: 3 weeks ago config: x86_64-randconfig-s021-20211116 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=db8268df0983adc2bb1fb48c9e5f7bfbb5f617f3 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout db8268df0983adc2bb1fb48c9e5f7bfbb5f617f3 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>) >> arch/x86/kernel/fpu/xstate.c:1310:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct lockdep_map const *lock @@ got struct lockdep_map [noderef] __rcu * @@ arch/x86/kernel/fpu/xstate.c:1310:9: sparse: expected struct lockdep_map const *lock arch/x86/kernel/fpu/xstate.c:1310:9: sparse: got struct lockdep_map [noderef] __rcu * >> arch/x86/kernel/fpu/xstate.c:1392:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ arch/x86/kernel/fpu/xstate.c:1392:31: sparse: expected struct spinlock [usertype] *lock arch/x86/kernel/fpu/xstate.c:1392:31: sparse: got struct spinlock [noderef] __rcu * arch/x86/kernel/fpu/xstate.c:1395:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ arch/x86/kernel/fpu/xstate.c:1395:33: sparse: expected struct spinlock [usertype] *lock arch/x86/kernel/fpu/xstate.c:1395:33: sparse: got struct spinlock [noderef] __rcu *
vim +1310 arch/x86/kernel/fpu/xstate.c
1303 1304 #ifdef CONFIG_X86_64 1305 static int validate_sigaltstack(unsigned int usize) 1306 { 1307 struct task_struct *thread, *leader = current->group_leader; 1308 unsigned long framesize = get_sigframe_size(); 1309 > 1310 lockdep_assert_held(¤t->sighand->siglock); 1311 1312 /* get_sigframe_size() is based on fpu_user_cfg.max_size */ 1313 framesize -= fpu_user_cfg.max_size; 1314 framesize += usize; 1315 for_each_thread(leader, thread) { 1316 if (thread->sas_ss_size && thread->sas_ss_size < framesize) 1317 return -ENOSPC; 1318 } 1319 return 0; 1320 } 1321 1322 static int __xstate_request_perm(u64 permitted, u64 requested) 1323 { 1324 /* 1325 * This deliberately does not exclude !XSAVES as we still might 1326 * decide to optionally context switch XCR0 or talk the silicon 1327 * vendors into extending XFD for the pre AMX states. 1328 */ 1329 bool compacted = cpu_feature_enabled(X86_FEATURE_XSAVES); 1330 struct fpu *fpu = ¤t->group_leader->thread.fpu; 1331 unsigned int ksize, usize; 1332 u64 mask; 1333 int ret; 1334 1335 /* Check whether fully enabled */ 1336 if ((permitted & requested) == requested) 1337 return 0; 1338 1339 /* Calculate the resulting kernel state size */ 1340 mask = permitted | requested; 1341 ksize = xstate_calculate_size(mask, compacted); 1342 1343 /* Calculate the resulting user state size */ 1344 mask &= XFEATURE_MASK_USER_SUPPORTED; 1345 usize = xstate_calculate_size(mask, false); 1346 1347 ret = validate_sigaltstack(usize); 1348 if (ret) 1349 return ret; 1350 1351 /* Pairs with the READ_ONCE() in xstate_get_group_perm() */ 1352 WRITE_ONCE(fpu->perm.__state_perm, requested); 1353 /* Protected by sighand lock */ 1354 fpu->perm.__state_size = ksize; 1355 fpu->perm.__user_state_size = usize; 1356 return ret; 1357 } 1358 1359 /* 1360 * Permissions array to map facilities with more than one component 1361 */ 1362 static const u64 xstate_prctl_req[XFEATURE_MAX] = { 1363 /* [XFEATURE_XTILE_DATA] = XFEATURE_MASK_XTILE, */ 1364 }; 1365 1366 static int xstate_request_perm(unsigned long idx) 1367 { 1368 u64 permitted, requested; 1369 int ret; 1370 1371 if (idx >= XFEATURE_MAX) 1372 return -EINVAL; 1373 1374 /* 1375 * Look up the facility mask which can require more than 1376 * one xstate component. 1377 */ 1378 idx = array_index_nospec(idx, ARRAY_SIZE(xstate_prctl_req)); 1379 requested = xstate_prctl_req[idx]; 1380 if (!requested) 1381 return -EOPNOTSUPP; 1382 1383 if ((fpu_user_cfg.max_features & requested) != requested) 1384 return -EOPNOTSUPP; 1385 1386 /* Lockless quick check */ 1387 permitted = xstate_get_host_group_perm(); 1388 if ((permitted & requested) == requested) 1389 return 0; 1390 1391 /* Protect against concurrent modifications */ > 1392 spin_lock_irq(¤t->sighand->siglock); 1393 permitted = xstate_get_host_group_perm(); 1394 ret = __xstate_request_perm(permitted, requested); 1395 spin_unlock_irq(¤t->sighand->siglock); 1396 return ret; 1397 } 1398 #else /* CONFIG_X86_64 */ 1399 static inline int xstate_request_perm(unsigned long idx) 1400 { 1401 return -EPERM; 1402 } 1403 #endif /* !CONFIG_X86_64 */ 1404
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |