Repository navigation
Commit 314beb9
x86: bpf_jit_comp: secure bpf jit against spraying attacks
hpa bringed into my attention some security related issues
with BPF JIT on x86.
This patch makes sure the bpf generated code is marked read only,
as other kernel text sections.
It also splits the unused space (we vmalloc() and only use a fraction of
the page) in two parts, so that the generated bpf code not starts at a
known offset in the page, but a pseudo random one.
Refs:
http://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-linux-systems-with.html
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 3e59cb0 commit 314beb9
1 file changed
Lines changed: 47 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
147 | 181 | | |
148 | 182 | | |
149 | 183 | | |
| |||
153 | 187 | | |
154 | 188 | | |
155 | 189 | | |
| 190 | + | |
156 | 191 | | |
157 | 192 | | |
158 | 193 | | |
| |||
693 | 728 | | |
694 | 729 | | |
695 | 730 | | |
696 | | - | |
| 731 | + | |
697 | 732 | | |
698 | 733 | | |
699 | 734 | | |
| |||
717 | 752 | | |
718 | 753 | | |
719 | 754 | | |
720 | | - | |
721 | | - | |
| 755 | + | |
| 756 | + | |
722 | 757 | | |
723 | 758 | | |
724 | 759 | | |
| |||
728 | 763 | | |
729 | 764 | | |
730 | 765 | | |
731 | | - | |
| 766 | + | |
| 767 | + | |
732 | 768 | | |
733 | 769 | | |
734 | 770 | | |
| |||
738 | 774 | | |
739 | 775 | | |
740 | 776 | | |
741 | | - | |
742 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
743 | 784 | | |
0 commit comments