[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210212221.mibJeLyk-lkp@intel.com>
Date: Fri, 21 Oct 2022 22:47:43 +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: llvm@...ts.linux.dev, 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: hexagon-randconfig-r021-20221019
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> lib/ubsan.c:149:1: error: expected 'while' in do/while loop
static void ubsan_epilogue(void)
^
lib/ubsan.c:146:2: note: to match this 'do'
kunit_fail_current_test("%s in %s", reason, loc->file_name);
^
include/kunit/test-bug.h:19:43: note: expanded from macro 'kunit_fail_current_test'
#define kunit_fail_current_test(fmt, ...) do { \
^
>> lib/ubsan.c:181:15: error: use of undeclared identifier '__ubsan_handle_divrem_overflow'
EXPORT_SYMBOL(__ubsan_handle_divrem_overflow);
^
>> lib/ubsan.c:184:1: error: function definition is not allowed here
{
^
lib/ubsan.c:199:1: error: function definition is not allowed here
{
^
lib/ubsan.c:215:1: error: function definition is not allowed here
{
^
lib/ubsan.c:229:1: error: function definition is not allowed here
{
^
lib/ubsan.c:244:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:254:15: error: use of undeclared identifier '__ubsan_handle_type_mismatch'
EXPORT_SYMBOL(__ubsan_handle_type_mismatch);
^
lib/ubsan.c:257:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:268:15: error: use of undeclared identifier '__ubsan_handle_type_mismatch_v1'
EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1);
^
lib/ubsan.c:271:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:285:15: error: use of undeclared identifier '__ubsan_handle_out_of_bounds'
EXPORT_SYMBOL(__ubsan_handle_out_of_bounds);
^
lib/ubsan.c:288:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:326:15: error: use of undeclared identifier '__ubsan_handle_shift_out_of_bounds'
EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds);
^
lib/ubsan.c:330:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:337:15: error: use of undeclared identifier '__ubsan_handle_builtin_unreachable'
EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable);
^
lib/ubsan.c:340:1: error: function definition is not allowed here
{
^
>> lib/ubsan.c:356:15: error: use of undeclared identifier '__ubsan_handle_load_invalid_value'
EXPORT_SYMBOL(__ubsan_handle_load_invalid_value);
^
lib/ubsan.c:364:1: error: function definition is not allowed here
{
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
vim +/while +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
42440c1f9911b4 Andrey Ryabinin 2018-02-06 242 void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
f0996bc2978e02 Andrey Ryabinin 2019-05-06 243 void *ptr)
42440c1f9911b4 Andrey Ryabinin 2018-02-06 244 {
42440c1f9911b4 Andrey Ryabinin 2018-02-06 245 struct type_mismatch_data_common common_data = {
42440c1f9911b4 Andrey Ryabinin 2018-02-06 246 .location = &data->location,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 247 .type = data->type,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 248 .alignment = data->alignment,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 249 .type_check_kind = data->type_check_kind
42440c1f9911b4 Andrey Ryabinin 2018-02-06 250 };
42440c1f9911b4 Andrey Ryabinin 2018-02-06 251
f0996bc2978e02 Andrey Ryabinin 2019-05-06 252 ubsan_type_mismatch_common(&common_data, (unsigned long)ptr);
42440c1f9911b4 Andrey Ryabinin 2018-02-06 253 }
c6d308534aef6c Andrey Ryabinin 2016-01-20 @254 EXPORT_SYMBOL(__ubsan_handle_type_mismatch);
c6d308534aef6c Andrey Ryabinin 2016-01-20 255
469cbd016157d2 Arnd Bergmann 2020-06-04 256 void __ubsan_handle_type_mismatch_v1(void *_data, void *ptr)
42440c1f9911b4 Andrey Ryabinin 2018-02-06 257 {
469cbd016157d2 Arnd Bergmann 2020-06-04 258 struct type_mismatch_data_v1 *data = _data;
42440c1f9911b4 Andrey Ryabinin 2018-02-06 259 struct type_mismatch_data_common common_data = {
42440c1f9911b4 Andrey Ryabinin 2018-02-06 260 .location = &data->location,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 261 .type = data->type,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 262 .alignment = 1UL << data->log_alignment,
42440c1f9911b4 Andrey Ryabinin 2018-02-06 263 .type_check_kind = data->type_check_kind
42440c1f9911b4 Andrey Ryabinin 2018-02-06 264 };
42440c1f9911b4 Andrey Ryabinin 2018-02-06 265
f0996bc2978e02 Andrey Ryabinin 2019-05-06 266 ubsan_type_mismatch_common(&common_data, (unsigned long)ptr);
42440c1f9911b4 Andrey Ryabinin 2018-02-06 267 }
42440c1f9911b4 Andrey Ryabinin 2018-02-06 @268 EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1);
42440c1f9911b4 Andrey Ryabinin 2018-02-06 269
469cbd016157d2 Arnd Bergmann 2020-06-04 270 void __ubsan_handle_out_of_bounds(void *_data, void *index)
c6d308534aef6c Andrey Ryabinin 2016-01-20 271 {
469cbd016157d2 Arnd Bergmann 2020-06-04 272 struct out_of_bounds_data *data = _data;
c6d308534aef6c Andrey Ryabinin 2016-01-20 273 char index_str[VALUE_LENGTH];
c6d308534aef6c Andrey Ryabinin 2016-01-20 274
c6d308534aef6c Andrey Ryabinin 2016-01-20 275 if (suppress_report(&data->location))
c6d308534aef6c Andrey Ryabinin 2016-01-20 276 return;
c6d308534aef6c Andrey Ryabinin 2016-01-20 277
ef065653e526a0 Kees Cook 2020-04-06 278 ubsan_prologue(&data->location, "array-index-out-of-bounds");
c6d308534aef6c Andrey Ryabinin 2016-01-20 279
c6d308534aef6c Andrey Ryabinin 2016-01-20 280 val_to_string(index_str, sizeof(index_str), data->index_type, index);
c6d308534aef6c Andrey Ryabinin 2016-01-20 281 pr_err("index %s is out of range for type %s\n", index_str,
c6d308534aef6c Andrey Ryabinin 2016-01-20 282 data->array_type->type_name);
ce5c31db3645b6 Julien Grall 2019-12-04 283 ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20 284 }
c6d308534aef6c Andrey Ryabinin 2016-01-20 @285 EXPORT_SYMBOL(__ubsan_handle_out_of_bounds);
c6d308534aef6c Andrey Ryabinin 2016-01-20 286
469cbd016157d2 Arnd Bergmann 2020-06-04 287 void __ubsan_handle_shift_out_of_bounds(void *_data, void *lhs, void *rhs)
c6d308534aef6c Andrey Ryabinin 2016-01-20 288 {
469cbd016157d2 Arnd Bergmann 2020-06-04 289 struct shift_out_of_bounds_data *data = _data;
c6d308534aef6c Andrey Ryabinin 2016-01-20 290 struct type_descriptor *rhs_type = data->rhs_type;
c6d308534aef6c Andrey Ryabinin 2016-01-20 291 struct type_descriptor *lhs_type = data->lhs_type;
c6d308534aef6c Andrey Ryabinin 2016-01-20 292 char rhs_str[VALUE_LENGTH];
c6d308534aef6c Andrey Ryabinin 2016-01-20 293 char lhs_str[VALUE_LENGTH];
9a50dcaf0416a4 Peter Zijlstra 2019-10-21 294 unsigned long ua_flags = user_access_save();
c6d308534aef6c Andrey Ryabinin 2016-01-20 295
c6d308534aef6c Andrey Ryabinin 2016-01-20 296 if (suppress_report(&data->location))
9a50dcaf0416a4 Peter Zijlstra 2019-10-21 297 goto out;
c6d308534aef6c Andrey Ryabinin 2016-01-20 298
ef065653e526a0 Kees Cook 2020-04-06 299 ubsan_prologue(&data->location, "shift-out-of-bounds");
c6d308534aef6c Andrey Ryabinin 2016-01-20 300
c6d308534aef6c Andrey Ryabinin 2016-01-20 301 val_to_string(rhs_str, sizeof(rhs_str), rhs_type, rhs);
c6d308534aef6c Andrey Ryabinin 2016-01-20 302 val_to_string(lhs_str, sizeof(lhs_str), lhs_type, lhs);
c6d308534aef6c Andrey Ryabinin 2016-01-20 303
c6d308534aef6c Andrey Ryabinin 2016-01-20 304 if (val_is_negative(rhs_type, rhs))
c6d308534aef6c Andrey Ryabinin 2016-01-20 305 pr_err("shift exponent %s is negative\n", rhs_str);
c6d308534aef6c Andrey Ryabinin 2016-01-20 306
c6d308534aef6c Andrey Ryabinin 2016-01-20 307 else if (get_unsigned_val(rhs_type, rhs) >=
c6d308534aef6c Andrey Ryabinin 2016-01-20 308 type_bit_width(lhs_type))
c6d308534aef6c Andrey Ryabinin 2016-01-20 309 pr_err("shift exponent %s is too large for %u-bit type %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20 310 rhs_str,
c6d308534aef6c Andrey Ryabinin 2016-01-20 311 type_bit_width(lhs_type),
c6d308534aef6c Andrey Ryabinin 2016-01-20 312 lhs_type->type_name);
c6d308534aef6c Andrey Ryabinin 2016-01-20 313 else if (val_is_negative(lhs_type, lhs))
c6d308534aef6c Andrey Ryabinin 2016-01-20 314 pr_err("left shift of negative value %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20 315 lhs_str);
c6d308534aef6c Andrey Ryabinin 2016-01-20 316 else
c6d308534aef6c Andrey Ryabinin 2016-01-20 317 pr_err("left shift of %s by %s places cannot be"
c6d308534aef6c Andrey Ryabinin 2016-01-20 318 " represented in type %s\n",
c6d308534aef6c Andrey Ryabinin 2016-01-20 319 lhs_str, rhs_str,
c6d308534aef6c Andrey Ryabinin 2016-01-20 320 lhs_type->type_name);
c6d308534aef6c Andrey Ryabinin 2016-01-20 321
ce5c31db3645b6 Julien Grall 2019-12-04 322 ubsan_epilogue();
9a50dcaf0416a4 Peter Zijlstra 2019-10-21 323 out:
9a50dcaf0416a4 Peter Zijlstra 2019-10-21 324 user_access_restore(ua_flags);
c6d308534aef6c Andrey Ryabinin 2016-01-20 325 }
c6d308534aef6c Andrey Ryabinin 2016-01-20 @326 EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds);
c6d308534aef6c Andrey Ryabinin 2016-01-20 327
c6d308534aef6c Andrey Ryabinin 2016-01-20 328
469cbd016157d2 Arnd Bergmann 2020-06-04 329 void __ubsan_handle_builtin_unreachable(void *_data)
c6d308534aef6c Andrey Ryabinin 2016-01-20 330 {
469cbd016157d2 Arnd Bergmann 2020-06-04 331 struct unreachable_data *data = _data;
ef065653e526a0 Kees Cook 2020-04-06 332 ubsan_prologue(&data->location, "unreachable");
c6d308534aef6c Andrey Ryabinin 2016-01-20 333 pr_err("calling __builtin_unreachable()\n");
ce5c31db3645b6 Julien Grall 2019-12-04 334 ubsan_epilogue();
c6d308534aef6c Andrey Ryabinin 2016-01-20 335 panic("can't return from __builtin_unreachable()");
c6d308534aef6c Andrey Ryabinin 2016-01-20 336 }
c6d308534aef6c Andrey Ryabinin 2016-01-20 @337 EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable);
c6d308534aef6c Andrey Ryabinin 2016-01-20 338
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (145341 bytes)
Powered by blists - more mailing lists