Commit 93dafa9
committed
Merge branch 'Attach a cookie to a tracing program.'
Kui-Feng Lee says:
====================
Allow users to attach a 64-bits cookie to a bpf_link of fentry, fexit,
or fmod_ret.
This patchset includes several major changes.
- Define struct bpf_tramp_links to replace bpf_tramp_prog.
struct bpf_tramp_links collects bpf_links of a trampoline
- Generate a trampoline to call bpf_progs of given bpf_links.
- Trampolines always set/reset bpf_run_ctx before/after
calling/leaving a tracing program.
- Attach a cookie to a bpf_link of fentry/fexit/fmod_ret/lsm. The
value will be available when running the associated bpf_prog.
Th major differences from v6:
- bpf_link_create() can create links of BPF_LSM_MAC attach type.
- Add a test for lsm.
- Add function proto of bpf_get_attach_cookie() for lsm.
- Check BPF_LSM_MAC in bpf_prog_has_trampoline().
- Adapt to the changes of LINK_CREATE made by Andrii.
The major differences from v7:
- Change stack_size instead of pushing/popping run_ctx.
- Move cookie to bpf_tramp_link from bpf_tracing_link..
v1: https://lore.kernel.org/all/20220126214809.3868787-1-kuifeng@fb.com/
v2: https://lore.kernel.org/bpf/20220316004231.1103318-1-kuifeng@fb.com/
v3: https://lore.kernel.org/bpf/20220407192552.2343076-1-kuifeng@fb.com/
v4: https://lore.kernel.org/bpf/20220411173429.4139609-1-kuifeng@fb.com/
v5: https://lore.kernel.org/bpf/20220412165555.4146407-1-kuifeng@fb.com/
v6: https://lore.kernel.org/bpf/20220416042940.656344-1-kuifeng@fb.com/
v7: https://lore.kernel.org/bpf/20220508032117.2783209-1-kuifeng@fb.com/
====================
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>File tree
19 files changed
+468
-138
lines changed- arch/x86/net
- include
- linux
- uapi/linux
- kernel
- bpf
- trace
- net/bpf
- tools
- bpf/bpftool
- include/uapi/linux
- lib/bpf
- testing/selftests/bpf
- prog_tests
- progs
19 files changed
+468
-138
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1762 | 1762 | | |
1763 | 1763 | | |
1764 | 1764 | | |
1765 | | - | |
| 1765 | + | |
| 1766 | + | |
1766 | 1767 | | |
1767 | 1768 | | |
1768 | 1769 | | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1769 | 1785 | | |
1770 | 1786 | | |
1771 | 1787 | | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
1772 | 1791 | | |
1773 | 1792 | | |
1774 | 1793 | | |
| |||
1814 | 1833 | | |
1815 | 1834 | | |
1816 | 1835 | | |
| 1836 | + | |
| 1837 | + | |
1817 | 1838 | | |
1818 | 1839 | | |
1819 | 1840 | | |
| |||
1850 | 1871 | | |
1851 | 1872 | | |
1852 | 1873 | | |
1853 | | - | |
1854 | | - | |
| 1874 | + | |
| 1875 | + | |
1855 | 1876 | | |
1856 | 1877 | | |
1857 | 1878 | | |
1858 | 1879 | | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1862 | 1883 | | |
1863 | 1884 | | |
1864 | 1885 | | |
1865 | 1886 | | |
1866 | 1887 | | |
1867 | 1888 | | |
1868 | 1889 | | |
1869 | | - | |
1870 | | - | |
| 1890 | + | |
| 1891 | + | |
1871 | 1892 | | |
1872 | 1893 | | |
1873 | 1894 | | |
| |||
1877 | 1898 | | |
1878 | 1899 | | |
1879 | 1900 | | |
1880 | | - | |
1881 | | - | |
| 1901 | + | |
| 1902 | + | |
1882 | 1903 | | |
1883 | 1904 | | |
1884 | 1905 | | |
| |||
1980 | 2001 | | |
1981 | 2002 | | |
1982 | 2003 | | |
1983 | | - | |
| 2004 | + | |
1984 | 2005 | | |
1985 | 2006 | | |
1986 | 2007 | | |
1987 | | - | |
1988 | | - | |
1989 | | - | |
1990 | | - | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
1991 | 2012 | | |
1992 | 2013 | | |
1993 | 2014 | | |
| |||
2014 | 2035 | | |
2015 | 2036 | | |
2016 | 2037 | | |
| 2038 | + | |
| 2039 | + | |
2017 | 2040 | | |
2018 | 2041 | | |
2019 | 2042 | | |
| |||
2032 | 2055 | | |
2033 | 2056 | | |
2034 | 2057 | | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
2035 | 2061 | | |
2036 | 2062 | | |
2037 | 2063 | | |
| |||
2078 | 2104 | | |
2079 | 2105 | | |
2080 | 2106 | | |
2081 | | - | |
2082 | | - | |
| 2107 | + | |
| 2108 | + | |
2083 | 2109 | | |
2084 | 2110 | | |
2085 | 2111 | | |
2086 | | - | |
2087 | | - | |
| 2112 | + | |
| 2113 | + | |
2088 | 2114 | | |
2089 | 2115 | | |
2090 | 2116 | | |
2091 | 2117 | | |
2092 | 2118 | | |
2093 | | - | |
| 2119 | + | |
2094 | 2120 | | |
2095 | 2121 | | |
2096 | 2122 | | |
| |||
2111 | 2137 | | |
2112 | 2138 | | |
2113 | 2139 | | |
2114 | | - | |
| 2140 | + | |
2115 | 2141 | | |
2116 | 2142 | | |
2117 | 2143 | | |
| |||
2121 | 2147 | | |
2122 | 2148 | | |
2123 | 2149 | | |
2124 | | - | |
| 2150 | + | |
2125 | 2151 | | |
2126 | 2152 | | |
2127 | 2153 | | |
2128 | 2154 | | |
2129 | | - | |
2130 | | - | |
| 2155 | + | |
| 2156 | + | |
2131 | 2157 | | |
2132 | 2158 | | |
2133 | 2159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
726 | | - | |
| 726 | + | |
727 | 727 | | |
728 | | - | |
729 | | - | |
730 | | - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
731 | 731 | | |
732 | 732 | | |
| 733 | + | |
| 734 | + | |
733 | 735 | | |
734 | 736 | | |
735 | 737 | | |
| |||
753 | 755 | | |
754 | 756 | | |
755 | 757 | | |
756 | | - | |
| 758 | + | |
757 | 759 | | |
758 | 760 | | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
763 | 766 | | |
764 | 767 | | |
765 | 768 | | |
| |||
852 | 855 | | |
853 | 856 | | |
854 | 857 | | |
| 858 | + | |
855 | 859 | | |
856 | | - | |
857 | | - | |
| 860 | + | |
| 861 | + | |
858 | 862 | | |
859 | 863 | | |
860 | 864 | | |
| |||
905 | 909 | | |
906 | 910 | | |
907 | 911 | | |
908 | | - | |
| 912 | + | |
909 | 913 | | |
910 | 914 | | |
911 | 915 | | |
912 | 916 | | |
913 | | - | |
| 917 | + | |
914 | 918 | | |
915 | 919 | | |
916 | 920 | | |
| |||
1009 | 1013 | | |
1010 | 1014 | | |
1011 | 1015 | | |
1012 | | - | |
1013 | 1016 | | |
1014 | 1017 | | |
1015 | 1018 | | |
| |||
1096 | 1099 | | |
1097 | 1100 | | |
1098 | 1101 | | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1099 | 1115 | | |
1100 | 1116 | | |
1101 | 1117 | | |
| |||
1133 | 1149 | | |
1134 | 1150 | | |
1135 | 1151 | | |
1136 | | - | |
1137 | | - | |
| 1152 | + | |
| 1153 | + | |
1138 | 1154 | | |
1139 | 1155 | | |
1140 | 1156 | | |
| |||
1339 | 1355 | | |
1340 | 1356 | | |
1341 | 1357 | | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1342 | 1364 | | |
1343 | 1365 | | |
1344 | 1366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
| 1016 | + | |
1016 | 1017 | | |
1017 | 1018 | | |
1018 | 1019 | | |
| |||
1489 | 1490 | | |
1490 | 1491 | | |
1491 | 1492 | | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1492 | 1502 | | |
1493 | 1503 | | |
1494 | 1504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
120 | 135 | | |
121 | 136 | | |
122 | 137 | | |
| |||
141 | 156 | | |
142 | 157 | | |
143 | 158 | | |
| 159 | + | |
| 160 | + | |
144 | 161 | | |
145 | 162 | | |
146 | 163 | | |
| |||
0 commit comments