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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202110111337.g1T17sF2-lkp@intel.com>
Date:   Mon, 11 Oct 2021 13:53:44 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Chang S. Bae" <chang.seok.bae@...el.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>
Subject: [tglx-devel:x86/fpu 62/77] arch/x86/kernel/fpu/xstate.c:1311:9:
 sparse: sparse: incorrect type in argument 1 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu
head:   a365ccb2764d58791ee5946b16fa0ffceb17021f
commit: 1220c1c84393869a348163238581fef56cf60a84 [62/77] x86/arch_prctl: Add controls for dynamic XSTATE components
config: x86_64-randconfig-s031-20211011 (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/tglx/devel.git/commit/?id=1220c1c84393869a348163238581fef56cf60a84
        git remote add tglx-devel https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git
        git fetch --no-tags tglx-devel x86/fpu
        git checkout 1220c1c84393869a348163238581fef56cf60a84
        # 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@...el.com>


sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/fpu/xstate.c:1311:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct qspinlock *lock @@     got struct qspinlock [noderef] __rcu * @@
   arch/x86/kernel/fpu/xstate.c:1311:9: sparse:     expected struct qspinlock *lock
   arch/x86/kernel/fpu/xstate.c:1311:9: sparse:     got struct qspinlock [noderef] __rcu *
>> arch/x86/kernel/fpu/xstate.c:1424:39: 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:1424:39: sparse:     expected struct spinlock [usertype] *lock
   arch/x86/kernel/fpu/xstate.c:1424:39: sparse:     got struct spinlock [noderef] __rcu *
   arch/x86/kernel/fpu/xstate.c:1427:41: 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:1427:41: sparse:     expected struct spinlock [usertype] *lock
   arch/x86/kernel/fpu/xstate.c:1427:41: sparse:     got struct spinlock [noderef] __rcu *

vim +1311 arch/x86/kernel/fpu/xstate.c

  1304	
  1305	#ifdef CONFIG_DYNAMIC_SIGALTSTACK
  1306	static int validate_sigaltstack(unsigned int usize)
  1307	{
  1308		struct task_struct *thread, *leader = current->group_leader;
  1309		unsigned long framesize = get_sigframe_size();
  1310	
> 1311		assert_spin_locked(&current->sighand->siglock);
  1312	
  1313		framesize += usize - fpu_user_cfg.default_size;
  1314		for_each_thread(leader, thread) {
  1315			if (thread->sas_ss_size && thread->sas_ss_size < framesize)
  1316				return -ENOSPC;
  1317		}
  1318		return 0;
  1319	}
  1320	
  1321	static int xstate_request_perm(u64 permitted, u64 requested)
  1322	{
  1323		/*
  1324		 * This deliberately does not exclude !XSAVES as we still might
  1325		 * decide to optionally context switch XCR0 or talk the silicon
  1326		 * vendors into extending XFD for the pre AMX states.
  1327		 */
  1328		bool compacted = cpu_feature_enabled(X86_FEATURE_XSAVES);
  1329		struct fpu *fpu = &current->group_leader->thread.fpu;
  1330		unsigned int ksize, usize;
  1331		u64 mask;
  1332		int ret;
  1333	
  1334		/* Check whether fully enabled */
  1335		if ((permitted & requested) == requested)
  1336			return 0;
  1337	
  1338		/* Calculate the resulting kernel state size */
  1339		mask = permitted | requested;
  1340		ksize = xstate_calculate_size(mask, compacted);
  1341	
  1342		/* Calculate the resulting user state size */
  1343		mask &= XFEATURE_MASK_USER_SUPPORTED;
  1344		usize = xstate_calculate_size(mask, false);
  1345	
  1346		ret = validate_sigaltstack(usize);
  1347		if (ret)
  1348			return ret;
  1349	
  1350		/* Pairs with the READ_ONCE() in xstate_get_group_perm() */
  1351		WRITE_ONCE(fpu->__state_perm, requested);
  1352		/* Protected by sighand lock */
  1353		fpu->__state_size = ksize;
  1354		fpu->__user_state_size = usize;
  1355		return ret;
  1356	}
  1357	
  1358	/*
  1359	 * Permissions array to map facilities with more than one component
  1360	 */
  1361	static const u64 xstate_prctl_req[XFEATURE_MAX] = {
  1362		/* [XFEATURE_XTILE_DATA] = XFEATURE_MASK_XTILE, */
  1363	};
  1364	
  1365	/**
  1366	 * fpu_xstate_prctl - xstate permission operations
  1367	 * @tsk:	Redundant pointer to current
  1368	 * @option:	A subfunction of arch_prctl()
  1369	 * @arg2:	option argument
  1370	 * Return:	0 if successful; otherwise, an error code
  1371	 *
  1372	 * Option arguments:
  1373	 *
  1374	 * ARCH_GET_XCOMP_SUPP: Pointer to user space u64 to store the info
  1375	 * ARCH_GET_XCOMP_PERM: Pointer to user space u64 to store the info
  1376	 * ARCH_REQ_XCOMP_PERM: Facility number requested
  1377	 *
  1378	 * For facilities which require more than one XSTATE component, the request
  1379	 * must be the highest state component number related to that facility,
  1380	 * e.g. for AMX which requires XFEATURE_XTILE_CFG(17) and
  1381	 * XFEATURE_XTILE_DATA(18) this would be XFEATURE_XTILE_DATA(18).
  1382	 */
  1383	long fpu_xstate_prctl(struct task_struct *tsk, int option, unsigned long arg2)
  1384	{
  1385		u64 __user *uptr = (u64 __user *)arg2;
  1386		u64 permitted, requested, supported;
  1387		unsigned long idx = arg2;
  1388		int ret;
  1389	
  1390		if (tsk != current)
  1391			return -EPERM;
  1392	
  1393		switch (option) {
  1394		case ARCH_GET_XCOMP_SUPP:
  1395			supported = fpu_user_cfg.max_features |	fpu_user_cfg.legacy_features;
  1396			return put_user(supported , uptr);
  1397	
  1398		case ARCH_GET_XCOMP_PERM:
  1399			/*
  1400			 * Lockless snapshot as it can change right after the
  1401			 * dropping the lock.
  1402			 */
  1403			permitted = xstate_get_group_perm();
  1404			permitted &= XFEATURE_MASK_USER_SUPPORTED;
  1405			return put_user(permitted, uptr);
  1406	
  1407		case ARCH_REQ_XCOMP_PERM:
  1408			if (idx >= XFEATURE_MAX)
  1409				return -EINVAL;
  1410	
  1411			/*
  1412			 * Look up the facility mask which can require more than
  1413			 * one xstate component.
  1414			 */
  1415			idx = array_index_nospec(idx, ARRAY_SIZE(xstate_prctl_req));
  1416			requested = xstate_prctl_req[idx];
  1417			if (!requested)
  1418				return -ENOTSUPP;
  1419	
  1420			if ((fpu_user_cfg.max_features & requested) != requested)
  1421				return -ENOTSUPP;
  1422	
  1423			/* Protect against concurrent modifications */
> 1424			spin_lock_irq(&current->sighand->siglock);
  1425			permitted = xstate_get_group_perm();
  1426			ret = xstate_request_perm(permitted, requested);
  1427			spin_unlock_irq(&current->sighand->siglock);
  1428			return ret;
  1429	
  1430		default:
  1431			return -EINVAL;
  1432		}
  1433	}
  1434	#endif /* CONFIG_DYNAMIC_SIGALTSTACK */
  1435	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (36646 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ