forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit70d067c
committed
Exclude parallel workers from connection privilege/limit checks.
Cause parallel workers to not check datallowconn, rolcanlogin, andACL_CONNECT privileges. The leader already checked these things(except for rolcanlogin which might have been checked for a differentrole). Re-checking can accomplish little except to induce unexpectedfailures in applications that might not even be aware that their queryhas been parallelized. We already had the principle that parallelworkers rely on their leader to pass a valid set of authorizationinformation, so this change just extends that a bit further.Also, modify the ReservedConnections, datconnlimit and rolconnlimitlogic so that these limits are only enforced against regular backends,and only regular backends are counted while checking if the limitswere already reached. Previously, background processes that had anassigned database or role were subject to these limits (with ratherrandom exclusions for autovac workers and walsenders), and the set ofexisting processes that counted against each limit was quite haphazardas well. The point of these limits, AFAICS, is to ensure theavailability of PGPROC slots for regular backends. Since all othertypes of processes have their own separate pools of PGPROC slots, itmakes no sense either to enforce these limits against them or to countthem while enforcing the limit.While edge-case failures of these sorts have been possible for along time, the problem got a good deal worse with commit5a2fed9(CVE-2024-10978), which caused parallel workers to make some of thesechecks using the leader's current role where before we had used itsAuthenticatedUserId, thus allowing parallel queries to fail afterSET ROLE. The previous behavior was fairly accidental and I haveno desire to return to it.This patch includes reverting73c9f91, which was an emergency hackto suppress these same checks in some cases. It wasn't complete,as shown by a recent bug report from Laurenz Albe. We can also revertfd4d93d and4922173, which hacked around the same problems in oneregression test.In passing, remove the special case for autovac workers inCheckMyDatabase; it seems cleaner to have AutoVacWorkerMain passthe INIT_PG_OVERRIDE_ALLOW_CONNS flag, now that that does what'sneeded.Like5a2fed9, back-patch to supported branches (which sadly nolonger includes v12).Discussion:https://postgr.es/m/1808397.1735156190@sss.pgh.pa.us1 parent1025463 commit70d067c
File tree
9 files changed
+68
-76
lines changed- src
- backend
- access/transam
- postmaster
- storage
- ipc
- lmgr
- utils/init
- include
- storage
9 files changed
+68
-76
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1413 | 1413 |
| |
1414 | 1414 |
| |
1415 | 1415 |
| |
1416 |
| - | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
1417 | 1422 |
| |
1418 | 1423 |
| |
1419 |
| - | |
| 1424 | + | |
1420 | 1425 |
| |
1421 | 1426 |
| |
1422 | 1427 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
483 | 483 |
| |
484 | 484 |
| |
485 | 485 |
| |
486 |
| - | |
| 486 | + | |
487 | 487 |
| |
488 | 488 |
| |
489 | 489 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1675 | 1675 |
| |
1676 | 1676 |
| |
1677 | 1677 |
| |
1678 |
| - | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1679 | 1681 |
| |
1680 | 1682 |
| |
1681 | 1683 |
| |
1682 | 1684 |
| |
1683 |
| - | |
| 1685 | + | |
1684 | 1686 |
| |
1685 | 1687 |
| |
1686 | 1688 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2902 | 2902 |
| |
2903 | 2903 |
| |
2904 | 2904 |
| |
2905 |
| - | |
2906 |
| - | |
| 2905 | + | |
2907 | 2906 |
| |
2908 | 2907 |
| |
2909 | 2908 |
| |
| |||
2975 | 2974 |
| |
2976 | 2975 |
| |
2977 | 2976 |
| |
| 2977 | + | |
2978 | 2978 |
| |
2979 | 2979 |
| |
2980 | 2980 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
395 | 395 |
| |
396 | 396 |
| |
397 | 397 |
| |
398 |
| - | |
| 398 | + | |
399 | 399 |
| |
400 | 400 |
| |
401 | 401 |
| |
| |||
578 | 578 |
| |
579 | 579 |
| |
580 | 580 |
| |
581 |
| - | |
| 581 | + | |
582 | 582 |
| |
583 | 583 |
| |
584 | 584 |
| |
|
Lines changed: 36 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
690 | 690 |
| |
691 | 691 |
| |
692 | 692 |
| |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
693 | 703 |
| |
694 | 704 |
| |
695 | 705 |
| |
| |||
705 | 715 |
| |
706 | 716 |
| |
707 | 717 |
| |
708 |
| - | |
709 |
| - | |
710 |
| - | |
711 |
| - | |
712 | 718 |
| |
713 | 719 |
| |
714 | 720 |
| |
715 | 721 |
| |
716 | 722 |
| |
717 |
| - | |
718 |
| - | |
719 |
| - | |
720 | 723 |
| |
721 | 724 |
| |
722 | 725 |
| |
723 |
| - | |
724 | 726 |
| |
725 | 727 |
| |
726 | 728 |
| |
727 | 729 |
| |
728 | 730 |
| |
729 |
| - | |
730 |
| - | |
731 |
| - | |
732 | 731 |
| |
733 | 732 |
| |
734 | 733 |
| |
735 |
| - | |
736 | 734 |
| |
737 | 735 |
| |
738 | 736 |
| |
739 | 737 |
| |
740 | 738 |
| |
741 | 739 |
| |
742 | 740 |
| |
743 |
| - | |
744 |
| - | |
745 |
| - | |
746 |
| - | |
| 741 | + | |
747 | 742 |
| |
748 |
| - | |
749 |
| - | |
750 |
| - | |
751 |
| - | |
752 |
| - | |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
757 |
| - | |
758 |
| - | |
759 |
| - | |
760 |
| - | |
761 |
| - | |
762 |
| - | |
763 |
| - | |
764 |
| - | |
765 |
| - | |
766 |
| - | |
767 |
| - | |
768 |
| - | |
769 |
| - | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
770 | 764 |
| |
771 | 765 |
| |
772 | 766 |
| |
| |||
785 | 779 |
| |
786 | 780 |
| |
787 | 781 |
| |
788 |
| - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
789 | 785 |
| |
790 | 786 |
| |
791 | 787 |
| |
| |||
795 | 791 |
| |
796 | 792 |
| |
797 | 793 |
| |
| 794 | + | |
798 | 795 |
| |
799 | 796 |
| |
800 | 797 |
| |
|
Lines changed: 13 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
26 | 25 |
| |
27 | 26 |
| |
28 | 27 |
| |
| |||
332 | 331 |
| |
333 | 332 |
| |
334 | 333 |
| |
335 |
| - | |
336 |
| - | |
337 | 334 |
| |
338 |
| - | |
| 335 | + | |
339 | 336 |
| |
340 | 337 |
| |
341 | 338 |
| |
| 339 | + | |
| 340 | + | |
342 | 341 |
| |
343 | 342 |
| |
344 | 343 |
| |
| |||
351 | 350 |
| |
352 | 351 |
| |
353 | 352 |
| |
354 |
| - | |
| 353 | + | |
355 | 354 |
| |
356 | 355 |
| |
357 | 356 |
| |
| |||
360 | 359 |
| |
361 | 360 |
| |
362 | 361 |
| |
363 |
| - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
364 | 365 |
| |
365 | 366 |
| |
366 | 367 |
| |
| |||
370 | 371 |
| |
371 | 372 |
| |
372 | 373 |
| |
| 374 | + | |
373 | 375 |
| |
374 | 376 |
| |
375 | 377 |
| |
| |||
763 | 765 |
| |
764 | 766 |
| |
765 | 767 |
| |
766 |
| - | |
767 |
| - | |
768 |
| - | |
769 |
| - | |
770 |
| - | |
771 |
| - | |
772 |
| - | |
773 |
| - | |
774 |
| - | |
775 |
| - | |
776 |
| - | |
777 |
| - | |
778 |
| - | |
779 |
| - | |
780 |
| - | |
781 |
| - | |
782 |
| - | |
| 768 | + | |
783 | 769 |
| |
784 | 770 |
| |
785 | 771 |
| |
| |||
820 | 806 |
| |
821 | 807 |
| |
822 | 808 |
| |
823 |
| - | |
824 |
| - | |
825 |
| - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
826 | 812 |
| |
827 |
| - | |
| 813 | + | |
828 | 814 |
| |
829 | 815 |
| |
830 | 816 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
| 342 | + | |
| 343 | + | |
342 | 344 |
| |
343 | 345 |
| |
344 | 346 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
130 | 130 |
| |
131 | 131 |
| |
132 | 132 |
| |
133 |
| - | |
| 133 | + | |
134 | 134 |
| |
135 | 135 |
| |
136 | 136 |
| |
|
0 commit comments
Comments
(0)