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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210191111.XTgMRb3E-lkp@intel.com>
Date:   Wed, 19 Oct 2022 11:43:54 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Steven Rostedt (Google)" <rostedt@...dmis.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Tom Zanussi <zanussi@...nel.org>
Subject: kernel/trace/trace_events_synth.c:436:68: sparse: sparse: incorrect
 type in argument 2 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   aae703b02f92bde9264366c545e87cec451de471
commit: 0934ae9977c27133449b6dd8c6213970e7eece38 tracing: Fix reading strings from synthetic events
date:   6 days ago
config: x86_64-randconfig-s022-20221017
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0934ae9977c27133449b6dd8c6213970e7eece38
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 0934ae9977c27133449b6dd8c6213970e7eece38
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/trace/

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

sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_events_synth.c:436:68: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *unsafe_addr @@     got char *str_val @@
   kernel/trace/trace_events_synth.c:436:68: sparse:     expected void const [noderef] __user *unsafe_addr
   kernel/trace/trace_events_synth.c:436:68: sparse:     got char *str_val

vim +436 kernel/trace/trace_events_synth.c

   404	
   405	static unsigned int trace_string(struct synth_trace_event *entry,
   406					 struct synth_event *event,
   407					 char *str_val,
   408					 bool is_dynamic,
   409					 unsigned int data_size,
   410					 unsigned int *n_u64)
   411	{
   412		unsigned int len = 0;
   413		char *str_field;
   414		int ret;
   415	
   416		if (is_dynamic) {
   417			u32 data_offset;
   418	
   419			data_offset = offsetof(typeof(*entry), fields);
   420			data_offset += event->n_u64 * sizeof(u64);
   421			data_offset += data_size;
   422	
   423			len = kern_fetch_store_strlen((unsigned long)str_val);
   424	
   425			data_offset |= len << 16;
   426			*(u32 *)&entry->fields[*n_u64] = data_offset;
   427	
   428			ret = kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry);
   429	
   430			(*n_u64)++;
   431		} else {
   432			str_field = (char *)&entry->fields[*n_u64];
   433	
   434	#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
   435			if ((unsigned long)str_val < TASK_SIZE)
 > 436				ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX);
   437			else
   438	#endif
   439				ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX);
   440	
   441			if (ret < 0)
   442				strcpy(str_field, FAULT_STRING);
   443	
   444			(*n_u64) += STR_VAR_LEN_MAX / sizeof(u64);
   445		}
   446	
   447		return len;
   448	}
   449	

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

View attachment "config" of type "text/plain" (144733 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ