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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Oct 2022 21:57:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     David Gow <davidgow@...gle.com>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        Daniel Latypov <dlatypov@...gle.com>,
        Shuah Khan <skhan@...uxfoundation.org>
Cc:     kbuild-all@...ts.01.org, David Gow <davidgow@...gle.com>,
        kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH 2/2] kunit: Use the static key in
 kunit_fail_current_test()

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on kees/for-next/pstore]
[also build test ERROR on linus/master v6.1-rc1 next-20221021]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Gow/kunit-Provide-a-static-key-to-check-if-KUnit-is-actively-running-tests/20221021-153225
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
patch link:    https://lore.kernel.org/r/20221021072854.333010-2-davidgow%40google.com
patch subject: [PATCH 2/2] kunit: Use the static key in kunit_fail_current_test()
config: xtensa-randconfig-r034-20221019
compiler: xtensa-linux-gcc (GCC) 12.1.0
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-lab-lkp/linux/commit/6a21df30828089657bb7d56ce48a6188a4468878
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review David-Gow/kunit-Provide-a-static-key-to-check-if-KUnit-is-actively-running-tests/20221021-153225
        git checkout 6a21df30828089657bb7d56ce48a6188a4468878
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=xtensa SHELL=/bin/bash

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

All error/warnings (new ones prefixed by >>):

   lib/ubsan.c: In function 'ubsan_prologue':
>> lib/ubsan.c:149:1: error: expected 'while' before 'static'
     149 | static void ubsan_epilogue(void)
         | ^~~~~~
   lib/ubsan.c: In function '__ubsan_handle_divrem_overflow':
>> lib/ubsan.c:179:9: error: implicit declaration of function 'ubsan_epilogue'; did you mean 'ubsan_prologue'? [-Werror=implicit-function-declaration]
     179 |         ubsan_epilogue();
         |         ^~~~~~~~~~~~~~
         |         ubsan_prologue
   lib/ubsan.c: In function 'ubsan_prologue':
>> lib/ubsan.c:161:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     161 | void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
         | ^~~~
>> lib/ubsan.c:183:13: error: invalid storage class for function 'handle_null_ptr_deref'
     183 | static void handle_null_ptr_deref(struct type_mismatch_data_common *data)
         |             ^~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:183:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     183 | static void handle_null_ptr_deref(struct type_mismatch_data_common *data)
         | ^~~~~~
>> lib/ubsan.c:197:13: error: invalid storage class for function 'handle_misaligned_access'
     197 | static void handle_misaligned_access(struct type_mismatch_data_common *data,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~
>> lib/ubsan.c:213:13: error: invalid storage class for function 'handle_object_size_mismatch'
     213 | static void handle_object_size_mismatch(struct type_mismatch_data_common *data,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/ubsan.c:227:13: error: invalid storage class for function 'ubsan_type_mismatch_common'
     227 | static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:256:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     256 | void __ubsan_handle_type_mismatch_v1(void *_data, void *ptr)
         | ^~~~
   lib/ubsan.c:270:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     270 | void __ubsan_handle_out_of_bounds(void *_data, void *index)
         | ^~~~
   lib/ubsan.c:287:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     287 | void __ubsan_handle_shift_out_of_bounds(void *_data, void *lhs, void *rhs)
         | ^~~~
   lib/ubsan.c:329:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     329 | void __ubsan_handle_builtin_unreachable(void *_data)
         | ^~~~
   lib/ubsan.c:339:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     339 | void __ubsan_handle_load_invalid_value(void *_data, void *val)
         | ^~~~
   lib/ubsan.c:358:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     358 | void __ubsan_handle_alignment_assumption(void *_data, unsigned long ptr,
         | ^~~~
>> lib/ubsan.c:361:6: error: static declaration of '__ubsan_handle_alignment_assumption' follows non-static declaration
     361 | void __ubsan_handle_alignment_assumption(void *_data, unsigned long ptr,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:358:6: note: previous declaration of '__ubsan_handle_alignment_assumption' with type 'void(void *, long unsigned int,  long unsigned int,  long unsigned int)'
     358 | void __ubsan_handle_alignment_assumption(void *_data, unsigned long ptr,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/ubsan.c:387:1: error: expected declaration or statement at end of input
     387 | EXPORT_SYMBOL(__ubsan_handle_alignment_assumption);
         | ^~~~~~~~~~~~~
   lib/ubsan.c: At top level:
   lib/ubsan.c:361:6: warning: '__ubsan_handle_alignment_assumption' defined but not used [-Wunused-function]
     361 | void __ubsan_handle_alignment_assumption(void *_data, unsigned long ptr,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:339:6: warning: '__ubsan_handle_load_invalid_value' defined but not used [-Wunused-function]
     339 | void __ubsan_handle_load_invalid_value(void *_data, void *val)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:329:6: warning: '__ubsan_handle_builtin_unreachable' defined but not used [-Wunused-function]
     329 | void __ubsan_handle_builtin_unreachable(void *_data)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:287:6: warning: '__ubsan_handle_shift_out_of_bounds' defined but not used [-Wunused-function]
     287 | void __ubsan_handle_shift_out_of_bounds(void *_data, void *lhs, void *rhs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:270:6: warning: '__ubsan_handle_out_of_bounds' defined but not used [-Wunused-function]
     270 | void __ubsan_handle_out_of_bounds(void *_data, void *index)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:256:6: warning: '__ubsan_handle_type_mismatch_v1' defined but not used [-Wunused-function]
     256 | void __ubsan_handle_type_mismatch_v1(void *_data, void *ptr)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:242:6: warning: '__ubsan_handle_type_mismatch' defined but not used [-Wunused-function]
     242 | void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:161:6: warning: '__ubsan_handle_divrem_overflow' defined but not used [-Wunused-function]
     161 | void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +149 lib/ubsan.c

c6d308534aef6c Andrey Ryabinin 2016-01-20  148  
ce5c31db3645b6 Julien Grall    2019-12-04 @149  static void ubsan_epilogue(void)
c6d308534aef6c Andrey Ryabinin 2016-01-20  150  {
c6d308534aef6c Andrey Ryabinin 2016-01-20  151  	dump_stack();
c6d308534aef6c Andrey Ryabinin 2016-01-20  152  	pr_err("========================================"
c6d308534aef6c Andrey Ryabinin 2016-01-20  153  		"========================================\n");
ce5c31db3645b6 Julien Grall    2019-12-04  154  
c6d308534aef6c Andrey Ryabinin 2016-01-20  155  	current->in_ubsan--;
1d28c8d6d076ef Kees Cook       2020-04-06  156  
d83ce027a54068 Tiezhu Yang     2022-03-23  157  	if (panic_on_warn)
1d28c8d6d076ef Kees Cook       2020-04-06  158  		panic("panic_on_warn set ...\n");
1d28c8d6d076ef Kees Cook       2020-04-06  159  }
c6d308534aef6c Andrey Ryabinin 2016-01-20  160  
469cbd016157d2 Arnd Bergmann   2020-06-04 @161  void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
c6d308534aef6c Andrey Ryabinin 2016-01-20  162  {
469cbd016157d2 Arnd Bergmann   2020-06-04  163  	struct overflow_data *data = _data;
c6d308534aef6c Andrey Ryabinin 2016-01-20  164  	char rhs_val_str[VALUE_LENGTH];
c6d308534aef6c Andrey Ryabinin 2016-01-20  165  
c6d308534aef6c Andrey Ryabinin 2016-01-20  166  	if (suppress_report(&data->location))
c6d308534aef6c Andrey Ryabinin 2016-01-20  167  		return;
c6d308534aef6c Andrey Ryabinin 2016-01-20  168  
ef065653e526a0 Kees Cook       2020-04-06  169  	ubsan_prologue(&data->location, "division-overflow");
c6d308534aef6c Andrey Ryabinin 2016-01-20  170  
c6d308534aef6c Andrey Ryabinin 2016-01-20  171  	val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs);
c6d308534aef6c Andrey Ryabinin 2016-01-20  172  
c6d308534aef6c Andrey Ryabinin 2016-01-20  173  	if (type_is_signed(data->type) && get_signed_val(data->type, rhs) == -1)
c6d308534aef6c Andrey Ryabinin 2016-01-20  174  		pr_err("division of %s by -1 cannot be represented in type %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20  175  			rhs_val_str, data->type->type_name);
c6d308534aef6c Andrey Ryabinin 2016-01-20  176  	else
c6d308534aef6c Andrey Ryabinin 2016-01-20  177  		pr_err("division by zero\n");
c6d308534aef6c Andrey Ryabinin 2016-01-20  178  
ce5c31db3645b6 Julien Grall    2019-12-04 @179  	ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20  180  }
c6d308534aef6c Andrey Ryabinin 2016-01-20  181  EXPORT_SYMBOL(__ubsan_handle_divrem_overflow);
c6d308534aef6c Andrey Ryabinin 2016-01-20  182  
42440c1f9911b4 Andrey Ryabinin 2018-02-06 @183  static void handle_null_ptr_deref(struct type_mismatch_data_common *data)
c6d308534aef6c Andrey Ryabinin 2016-01-20  184  {
42440c1f9911b4 Andrey Ryabinin 2018-02-06  185  	if (suppress_report(data->location))
c6d308534aef6c Andrey Ryabinin 2016-01-20  186  		return;
c6d308534aef6c Andrey Ryabinin 2016-01-20  187  
ef065653e526a0 Kees Cook       2020-04-06  188  	ubsan_prologue(data->location, "null-ptr-deref");
c6d308534aef6c Andrey Ryabinin 2016-01-20  189  
c6d308534aef6c Andrey Ryabinin 2016-01-20  190  	pr_err("%s null pointer of type %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20  191  		type_check_kinds[data->type_check_kind],
c6d308534aef6c Andrey Ryabinin 2016-01-20  192  		data->type->type_name);
c6d308534aef6c Andrey Ryabinin 2016-01-20  193  
ce5c31db3645b6 Julien Grall    2019-12-04  194  	ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20  195  }
c6d308534aef6c Andrey Ryabinin 2016-01-20  196  
42440c1f9911b4 Andrey Ryabinin 2018-02-06 @197  static void handle_misaligned_access(struct type_mismatch_data_common *data,
c6d308534aef6c Andrey Ryabinin 2016-01-20  198  				unsigned long ptr)
c6d308534aef6c Andrey Ryabinin 2016-01-20  199  {
42440c1f9911b4 Andrey Ryabinin 2018-02-06  200  	if (suppress_report(data->location))
c6d308534aef6c Andrey Ryabinin 2016-01-20  201  		return;
c6d308534aef6c Andrey Ryabinin 2016-01-20  202  
ef065653e526a0 Kees Cook       2020-04-06  203  	ubsan_prologue(data->location, "misaligned-access");
c6d308534aef6c Andrey Ryabinin 2016-01-20  204  
c6d308534aef6c Andrey Ryabinin 2016-01-20  205  	pr_err("%s misaligned address %p for type %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20  206  		type_check_kinds[data->type_check_kind],
c6d308534aef6c Andrey Ryabinin 2016-01-20  207  		(void *)ptr, data->type->type_name);
c6d308534aef6c Andrey Ryabinin 2016-01-20  208  	pr_err("which requires %ld byte alignment\n", data->alignment);
c6d308534aef6c Andrey Ryabinin 2016-01-20  209  
ce5c31db3645b6 Julien Grall    2019-12-04  210  	ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20  211  }
c6d308534aef6c Andrey Ryabinin 2016-01-20  212  
42440c1f9911b4 Andrey Ryabinin 2018-02-06 @213  static void handle_object_size_mismatch(struct type_mismatch_data_common *data,
c6d308534aef6c Andrey Ryabinin 2016-01-20  214  					unsigned long ptr)
c6d308534aef6c Andrey Ryabinin 2016-01-20  215  {
42440c1f9911b4 Andrey Ryabinin 2018-02-06  216  	if (suppress_report(data->location))
c6d308534aef6c Andrey Ryabinin 2016-01-20  217  		return;
c6d308534aef6c Andrey Ryabinin 2016-01-20  218  
ef065653e526a0 Kees Cook       2020-04-06  219  	ubsan_prologue(data->location, "object-size-mismatch");
901d805c33fc4c Nicolas Iooss   2016-08-02  220  	pr_err("%s address %p with insufficient space\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20  221  		type_check_kinds[data->type_check_kind],
c6d308534aef6c Andrey Ryabinin 2016-01-20  222  		(void *) ptr);
c6d308534aef6c Andrey Ryabinin 2016-01-20  223  	pr_err("for an object of type %s\n", data->type->type_name);
ce5c31db3645b6 Julien Grall    2019-12-04  224  	ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20  225  }
c6d308534aef6c Andrey Ryabinin 2016-01-20  226  
42440c1f9911b4 Andrey Ryabinin 2018-02-06 @227  static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data,
c6d308534aef6c Andrey Ryabinin 2016-01-20  228  				unsigned long ptr)
c6d308534aef6c Andrey Ryabinin 2016-01-20  229  {
d08965a27e84ca Peter Zijlstra  2019-04-03  230  	unsigned long flags = user_access_save();
c6d308534aef6c Andrey Ryabinin 2016-01-20  231  
c6d308534aef6c Andrey Ryabinin 2016-01-20  232  	if (!ptr)
c6d308534aef6c Andrey Ryabinin 2016-01-20  233  		handle_null_ptr_deref(data);
c6d308534aef6c Andrey Ryabinin 2016-01-20  234  	else if (data->alignment && !IS_ALIGNED(ptr, data->alignment))
b8fe1120b4ba34 Andrew Morton   2018-02-06  235  		handle_misaligned_access(data, ptr);
c6d308534aef6c Andrey Ryabinin 2016-01-20  236  	else
c6d308534aef6c Andrey Ryabinin 2016-01-20  237  		handle_object_size_mismatch(data, ptr);
d08965a27e84ca Peter Zijlstra  2019-04-03  238  
d08965a27e84ca Peter Zijlstra  2019-04-03  239  	user_access_restore(flags);
c6d308534aef6c Andrey Ryabinin 2016-01-20  240  }
42440c1f9911b4 Andrey Ryabinin 2018-02-06  241  

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ