Repository navigation
Commit a3ea269
net: filter: keep original BPF program around
In order to open up the possibility to internally transform a BPF program
into an alternative and possibly non-trivial reversible representation, we
need to keep the original BPF program around, so that it can be passed back
to user space w/o the need of a complex decoder.
The reason for that use case resides in commit a8fc927 ("sk-filter:
Add ability to get socket filter program (v2)"), that is, the ability
to retrieve the currently attached BPF filter from a given socket used
mainly by the checkpoint-restore project, for example.
Therefore, we add two helpers sk_{store,release}_orig_filter for taking
care of that. In the sk_unattached_filter_create() case, there's no such
possibility/requirement to retrieve a loaded BPF program. Therefore, we
can spare us the work in that case.
This approach will simplify and slightly speed up both, sk_get_filter()
and sock_diag_put_filterinfo() handlers as we won't need to successively
decode filters anymore through sk_decode_filter(). As we still need
sk_decode_filter() later on, we're keeping it around.
Joint work with Alexei Starovoitov.
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent f8bbbfc commit a3ea269
3 files changed
Lines changed: 93 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
25 | | - | |
26 | | - | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| 60 | + | |
51 | 61 | | |
52 | 62 | | |
| 63 | + | |
53 | 64 | | |
54 | 65 | | |
55 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
632 | 663 | | |
633 | 664 | | |
634 | 665 | | |
| |||
637 | 668 | | |
638 | 669 | | |
639 | 670 | | |
| 671 | + | |
640 | 672 | | |
641 | 673 | | |
642 | 674 | | |
| |||
669 | 701 | | |
670 | 702 | | |
671 | 703 | | |
| 704 | + | |
672 | 705 | | |
673 | | - | |
674 | 706 | | |
675 | 707 | | |
676 | 708 | | |
| |||
680 | 712 | | |
681 | 713 | | |
682 | 714 | | |
| 715 | + | |
683 | 716 | | |
684 | 717 | | |
685 | 718 | | |
686 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
687 | 725 | | |
688 | 726 | | |
689 | 727 | | |
| |||
716 | 754 | | |
717 | 755 | | |
718 | 756 | | |
719 | | - | |
| 757 | + | |
720 | 758 | | |
721 | 759 | | |
722 | 760 | | |
| |||
730 | 768 | | |
731 | 769 | | |
732 | 770 | | |
| 771 | + | |
733 | 772 | | |
734 | 773 | | |
735 | 774 | | |
| |||
738 | 777 | | |
739 | 778 | | |
740 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
741 | 786 | | |
742 | 787 | | |
743 | 788 | | |
| |||
750 | 795 | | |
751 | 796 | | |
752 | 797 | | |
| 798 | + | |
753 | 799 | | |
754 | 800 | | |
755 | 801 | | |
| |||
769 | 815 | | |
770 | 816 | | |
771 | 817 | | |
| 818 | + | |
772 | 819 | | |
773 | 820 | | |
774 | 821 | | |
| |||
851 | 898 | | |
852 | 899 | | |
853 | 900 | | |
854 | | - | |
| 901 | + | |
| 902 | + | |
855 | 903 | | |
| 904 | + | |
856 | 905 | | |
857 | | - | |
| 906 | + | |
858 | 907 | | |
859 | 908 | | |
860 | 909 | | |
861 | | - | |
862 | | - | |
| 910 | + | |
863 | 911 | | |
864 | 912 | | |
865 | | - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
866 | 920 | | |
| 921 | + | |
867 | 922 | | |
| 923 | + | |
868 | 924 | | |
869 | | - | |
| 925 | + | |
870 | 926 | | |
871 | 927 | | |
872 | 928 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
| 929 | + | |
| 930 | + | |
880 | 931 | | |
881 | | - | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
882 | 936 | | |
883 | 937 | | |
884 | 938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 80 | + | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
| |||
0 commit comments