Commit b1d9dae
committed
ASAN: heap-use-after-free with concurrent create/drop system trigger
In case there are 'on shutdown' triggers it could result in abnormal
server termination if at the moment server shutdown is in progress
the server received the DROP TRIGGER statement for one of 'ON SHUTDOWN'
system triggers being already executed as part shutdown process. Another
words, there is the race condition between running triggers on shutdown
and execution of DROP TRIGGER for system triggers ON SHUTDOWN event.
To fix the issue protect running on shutdown triggers and drop/create
of system triggers under the lock to avoid race condition.
Check under the new lock for the flag that shutdown is in progress and
don't add/remove a trigger instance into/from internal array as part of
handling CREATE/DROP TRIGGER for ON SHUTDOWN event. That is, add/drop
metadata about the trigger but don't modify the internal runtime data
structures.1 parent 37dbfa4 commit b1d9dae
3 files changed
Lines changed: 101 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| 2049 | + | |
2049 | 2050 | | |
2050 | 2051 | | |
2051 | 2052 | | |
| |||
4572 | 4573 | | |
4573 | 4574 | | |
4574 | 4575 | | |
| 4576 | + | |
| 4577 | + | |
4575 | 4578 | | |
4576 | 4579 | | |
4577 | 4580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
35 | 83 | | |
36 | 84 | | |
37 | 85 | | |
| |||
456 | 504 | | |
457 | 505 | | |
458 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
459 | 519 | | |
460 | 520 | | |
461 | 521 | | |
| |||
473 | 533 | | |
474 | 534 | | |
475 | 535 | | |
| 536 | + | |
476 | 537 | | |
477 | 538 | | |
478 | 539 | | |
479 | 540 | | |
480 | 541 | | |
481 | 542 | | |
482 | 543 | | |
| 544 | + | |
483 | 545 | | |
484 | 546 | | |
485 | 547 | | |
| |||
625 | 687 | | |
626 | 688 | | |
627 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
628 | 704 | | |
629 | 705 | | |
630 | 706 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | 707 | | |
635 | 708 | | |
636 | 709 | | |
| |||
639 | 712 | | |
640 | 713 | | |
641 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
642 | 722 | | |
643 | 723 | | |
644 | 724 | | |
| |||
1566 | 1646 | | |
1567 | 1647 | | |
1568 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
1569 | 1657 | | |
1570 | 1658 | | |
1571 | 1659 | | |
| |||
1584 | 1672 | | |
1585 | 1673 | | |
1586 | 1674 | | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1587 | 1679 | | |
1588 | 1680 | | |
1589 | 1681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
117 | 120 | | |
0 commit comments