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: <202208091405.uYHLXk68-lkp@intel.com>
Date:   Tue, 9 Aug 2022 15:04:31 +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:362:24:
 warning: format specifies type 'unsigned int' but the argument has type
 'unsigned long'

tree:   https://github.com/intel/amx-linux.git init_fpstate
head:   b1323896658f2b069193a782265a47e3c99611e4
commit: 86878d20f388dc243b534c20a5de1bedfb534df1 [2/3] x86/fpu: Avoid the init XSTATE buffer overflow
config: x86_64-randconfig-r023-20220808 (https://download.01.org/0day-ci/archive/20220809/202208091405.uYHLXk68-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/86878d20f388dc243b534c20a5de1bedfb534df1
        git remote add intel-amx https://github.com/intel/amx-linux.git
        git fetch --no-tags intel-amx init_fpstate
        git checkout 86878d20f388dc243b534c20a5de1bedfb534df1
        # 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=x86_64 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:362:24: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-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 +362 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		print_xstate_features();
   359	
   360		if (init_fpstate.size > sizeof(union fpregs_state)) {
   361			pr_err("x86/fpu: init_fpstate (%u bytes) is not enough for the configured size:"
 > 362			       "%u bytes\n", sizeof(union fpregs_state), init_fpstate.size);
   363			return -EINVAL;
   364		}
   365	
   366		xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures);
   367	
   368		/*
   369		 * Init all the features state with header.xfeatures being 0x0
   370		 */
   371		os_xrstor_booting(&init_fpstate.regs.xsave);
   372	
   373		/*
   374		 * All components are now in init state. Read the state back so
   375		 * that init_fpstate contains all non-zero init state. This only
   376		 * works with XSAVE, but not with XSAVEOPT and XSAVEC/S because
   377		 * those use the init optimization which skips writing data for
   378		 * components in init state.
   379		 *
   380		 * XSAVE could be used, but that would require to reshuffle the
   381		 * data when XSAVEC/S is available because XSAVEC/S uses xstate
   382		 * compaction. But doing so is a pointless exercise because most
   383		 * components have an all zeros init state except for the legacy
   384		 * ones (FP and SSE). Those can be saved with FXSAVE into the
   385		 * legacy area. Adding new features requires to ensure that init
   386		 * state is all zeroes or if not to add the necessary handling
   387		 * here.
   388		 */
   389		fxsave(&init_fpstate.regs.fxsave);
   390		return 0;
   391	}
   392	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ