Commit b2325bf
kunit: kasan_test: disable fortify string checker on kmalloc_oob_memset
Similar to commit 09c6304 ("kasan: test: fix compatibility with
FORTIFY_SOURCE") the kernel is panicing in kmalloc_oob_memset_*.
This is due to the `ptr` not being hidden from the optimizer which would
disable the runtime fortify string checker.
kernel BUG at lib/string_helpers.c:1048!
Call Trace:
[<00000000272502e2>] fortify_panic+0x2a/0x30
([<00000000272502de>] fortify_panic+0x26/0x30)
[<001bffff817045c4>] kmalloc_oob_memset_2+0x22c/0x230 [kasan_test]
Hide the `ptr` variable from the optimizer to fix the kernel panic. Also
define a memset_size variable and hide that as well. This cleans up the
code and follows the same convention as other tests.
[npache@redhat.com: address review comments from Andrey]
Link: https://lkml.kernel.org/r/20231214164423.6202-1-npache@redhat.com
Link: https://lkml.kernel.org/r/20231212232659.18839-1-npache@redhat.com
Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent e63bde3 commit b2325bf
1 file changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
496 | 497 | | |
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
| 503 | + | |
502 | 504 | | |
503 | | - | |
| 505 | + | |
| 506 | + | |
504 | 507 | | |
505 | 508 | | |
506 | 509 | | |
507 | 510 | | |
508 | 511 | | |
509 | 512 | | |
510 | 513 | | |
| 514 | + | |
511 | 515 | | |
512 | 516 | | |
513 | 517 | | |
514 | 518 | | |
515 | 519 | | |
516 | 520 | | |
| 521 | + | |
517 | 522 | | |
518 | | - | |
| 523 | + | |
| 524 | + | |
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
522 | 528 | | |
523 | 529 | | |
524 | 530 | | |
525 | 531 | | |
| 532 | + | |
526 | 533 | | |
527 | 534 | | |
528 | 535 | | |
529 | 536 | | |
530 | 537 | | |
531 | 538 | | |
| 539 | + | |
532 | 540 | | |
533 | | - | |
| 541 | + | |
| 542 | + | |
534 | 543 | | |
535 | 544 | | |
536 | 545 | | |
537 | 546 | | |
538 | 547 | | |
539 | 548 | | |
540 | 549 | | |
| 550 | + | |
541 | 551 | | |
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
545 | 555 | | |
546 | 556 | | |
| 557 | + | |
547 | 558 | | |
548 | | - | |
| 559 | + | |
| 560 | + | |
549 | 561 | | |
550 | 562 | | |
551 | 563 | | |
| |||
0 commit comments