Repository navigation
Commit 55309dd
net: bpf: arm: address randomize and write protect JIT code
This is the ARM variant for 314beb9 ("x86: bpf_jit_comp: secure bpf
jit against spraying attacks").
It is now possible to implement it due to commits 75374ad ("ARM: mm:
Define set_memory_* functions for ARM") and dca9aa9 ("ARM: add
DEBUG_SET_MODULE_RONX option to Kconfig") which added infrastructure for
this facility.
Thus, this patch makes sure the BPF generated JIT code is marked RO, as
other kernel text sections, and also lets the generated JIT code start
at a pseudo random offset instead on a page boundary. The holes are filled
with illegal instructions.
JIT tested on armv7hl with BPF test suite.
Reference: http://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-linux-systems-with.html
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Mircea Gherzan <mgherzan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 738cbe7 commit 55309dd
1 file changed
Lines changed: 26 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
174 | 173 | | |
175 | 174 | | |
176 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
177 | 185 | | |
178 | 186 | | |
179 | 187 | | |
| |||
859 | 867 | | |
860 | 868 | | |
861 | 869 | | |
| 870 | + | |
862 | 871 | | |
863 | 872 | | |
864 | 873 | | |
| 874 | + | |
865 | 875 | | |
866 | 876 | | |
867 | 877 | | |
| |||
897 | 907 | | |
898 | 908 | | |
899 | 909 | | |
900 | | - | |
901 | 910 | | |
902 | | - | |
903 | | - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
904 | 914 | | |
905 | 915 | | |
| 916 | + | |
906 | 917 | | |
| 918 | + | |
907 | 919 | | |
908 | 920 | | |
909 | 921 | | |
| |||
919 | 931 | | |
920 | 932 | | |
921 | 933 | | |
| 934 | + | |
922 | 935 | | |
923 | 936 | | |
924 | 937 | | |
| |||
928 | 941 | | |
929 | 942 | | |
930 | 943 | | |
931 | | - | |
932 | | - | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
933 | 952 | | |
| 953 | + | |
934 | 954 | | |
935 | 955 | | |
0 commit comments