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: <202208101137.JDQ1Crdy-lkp@intel.com>
Date:   Wed, 10 Aug 2022 11:35:41 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Chang S. Bae" <chang.seok.bae@...el.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [intel-amx:init_fpstate 2/3] arch/x86/kernel/fpu/xstate.c:365:24:
 warning: format specifies type 'unsigned long' but the argument has type
 'unsigned int'

tree:   https://github.com/intel/amx-linux.git init_fpstate
head:   0dd11dae13f2a012cd33971c5917f946d09e895c
commit: e1dead9e3ed891a5024f59708e5059cdd094e3f5 [2/3] x86/fpu: Validate the init_fpstate size
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220810/202208101137.JDQ1Crdy-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel/amx-linux/commit/e1dead9e3ed891a5024f59708e5059cdd094e3f5
        git remote add intel-amx https://github.com/intel/amx-linux.git
        git fetch --no-tags intel-amx init_fpstate
        git checkout e1dead9e3ed891a5024f59708e5059cdd094e3f5
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/fpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/fpu/xstate.c:365:24: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
                          "%u bytes\n", sizeof(union fpregs_state), init_fpstate.size);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:507:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   1 warning generated.


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

   328	
   329	/*
   330	 * All supported features have either init state all zeros or are
   331	 * handled in setup_init_fpu() individually. This is an explicit
   332	 * feature list and does not use XFEATURE_MASK*SUPPORTED to catch
   333	 * newly added supported features at build time and make people
   334	 * actually look at the init state for the new feature.
   335	 */
   336	#define XFEATURES_INIT_FPSTATE_HANDLED		\
   337		(XFEATURE_MASK_FP |			\
   338		 XFEATURE_MASK_SSE |			\
   339		 XFEATURE_MASK_YMM |			\
   340		 XFEATURE_MASK_OPMASK |			\
   341		 XFEATURE_MASK_ZMM_Hi256 |		\
   342		 XFEATURE_MASK_Hi16_ZMM	 |		\
   343		 XFEATURE_MASK_PKRU |			\
   344		 XFEATURE_MASK_BNDREGS |		\
   345		 XFEATURE_MASK_BNDCSR |			\
   346		 XFEATURE_MASK_PASID |			\
   347		 XFEATURE_MASK_XTILE)
   348	
   349	/*
   350	 * setup the xstate image representing the init state
   351	 */
   352	static int __init setup_init_fpu_buf(void)
   353	{
   354		BUILD_BUG_ON((XFEATURE_MASK_USER_SUPPORTED |
   355			      XFEATURE_MASK_SUPERVISOR_SUPPORTED) !=
   356			     XFEATURES_INIT_FPSTATE_HANDLED);
   357	
   358		if (!boot_cpu_has(X86_FEATURE_XSAVE))
   359			return -ENODEV;
   360	
   361		print_xstate_features();
   362	
   363		if (init_fpstate.size > sizeof(union fpregs_state)) {
   364			pr_err("x86/fpu: init_fpstate (%lu bytes) is not enough for the configured size:"
 > 365			       "%u bytes\n", sizeof(union fpregs_state), init_fpstate.size);
   366			return -EINVAL;
   367		}
   368	
   369		xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures);
   370	
   371		/*
   372		 * Init all the features state with header.xfeatures being 0x0
   373		 */
   374		os_xrstor_booting(&init_fpstate.regs.xsave);
   375	
   376		/*
   377		 * All components are now in init state. Read the state back so
   378		 * that init_fpstate contains all non-zero init state. This only
   379		 * works with XSAVE, but not with XSAVEOPT and XSAVEC/S because
   380		 * those use the init optimization which skips writing data for
   381		 * components in init state.
   382		 *
   383		 * XSAVE could be used, but that would require to reshuffle the
   384		 * data when XSAVEC/S is available because XSAVEC/S uses xstate
   385		 * compaction. But doing so is a pointless exercise because most
   386		 * components have an all zeros init state except for the legacy
   387		 * ones (FP and SSE). Those can be saved with FXSAVE into the
   388		 * legacy area. Adding new features requires to ensure that init
   389		 * state is all zeroes or if not to add the necessary handling
   390		 * here.
   391		 */
   392		fxsave(&init_fpstate.regs.fxsave);
   393		return 0;
   394	}
   395	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ