Re: [PATCH 2/2] tracing: Add test for user space strings when filtering on string pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Steven,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on linux/master linus/master hnaz-mm/master v5.16-rc8 next-20220107]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Steven-Rostedt/tracing-Fix-filtering-on-string-pointers/20220108-070047
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: openrisc-randconfig-s031-20220107 (https://download.01.org/0day-ci/archive/20220109/202201090343.IKIQqdk4-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/19b8c1c0fee0d7bff07ed0d5862a29ac2bb4adc9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-Fix-filtering-on-string-pointers/20220108-070047
        git checkout 19b8c1c0fee0d7bff07ed0d5862a29ac2bb4adc9
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash kernel/trace/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
>> kernel/trace/trace_events_filter.c:685:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *ustr @@     got char *str @@
   kernel/trace/trace_events_filter.c:685:22: sparse:     expected char [noderef] __user *ustr
   kernel/trace/trace_events_filter.c:685:22: sparse:     got char *str
   kernel/trace/trace_events_filter.c:1066:20: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct event_filter * @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1066:20: sparse:     expected struct event_filter *
   kernel/trace/trace_events_filter.c:1066:20: sparse:     got struct event_filter [noderef] __rcu *filter
   kernel/trace/trace_events_filter.c:1136:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct event_filter *filter @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1136:34: sparse:     expected struct event_filter *filter
   kernel/trace/trace_events_filter.c:1136:34: sparse:     got struct event_filter [noderef] __rcu *filter
   kernel/trace/trace_events_filter.c:1153:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct event_filter *filter @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1153:27: sparse:     expected struct event_filter *filter
   kernel/trace/trace_events_filter.c:1153:27: sparse:     got struct event_filter [noderef] __rcu *filter
   kernel/trace/trace_events_filter.c:1066:20: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct event_filter * @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1066:20: sparse:     expected struct event_filter *
   kernel/trace/trace_events_filter.c:1066:20: sparse:     got struct event_filter [noderef] __rcu *filter
   kernel/trace/trace_events_filter.c:1066:20: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct event_filter * @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1066:20: sparse:     expected struct event_filter *
   kernel/trace/trace_events_filter.c:1066:20: sparse:     got struct event_filter [noderef] __rcu *filter
   kernel/trace/trace_events_filter.c:1066:20: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected struct event_filter * @@     got struct event_filter [noderef] __rcu *filter @@
   kernel/trace/trace_events_filter.c:1066:20: sparse:     expected struct event_filter *
   kernel/trace/trace_events_filter.c:1066:20: sparse:     got struct event_filter [noderef] __rcu *filter

vim +685 kernel/trace/trace_events_filter.c

   666	
   667	static __always_inline char *test_string(char *str)
   668	{
   669		struct ustring_buffer *ubuf;
   670		char __user *ustr;
   671		char *kstr;
   672	
   673		if (!ustring_per_cpu)
   674			return NULL;
   675	
   676		ubuf = this_cpu_ptr(ustring_per_cpu);
   677		kstr = ubuf->buffer;
   678	
   679		if (likely((unsigned long)str >= TASK_SIZE)) {
   680			/* For safety, do not trust the string pointer */
   681			if (!strncpy_from_kernel_nofault(kstr, str, USTRING_BUF_SIZE))
   682				return NULL;
   683		} else {
   684			/* user space address? */
 > 685			ustr = str;
   686			if (!strncpy_from_user_nofault(kstr, ustr, USTRING_BUF_SIZE))
   687				return NULL;
   688		}
   689		return kstr;
   690	}
   691	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux