Commit 5a211a5deabcafdc764817d5b4510c767d317ddc
Committed by
James Morris
1 parent
7cd94146cd
Exists in
master
and in
4 other branches
VM/Security: add security hook to do_brk
Given a specifically crafted binary do_brk() can be used to get low pages available in userspace virtually memory and can thus be used to circumvent the mmap_min_addr low memory protection. Add security checks in do_brk(). Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
mm/mmap.c
... | ... | @@ -1941,6 +1941,10 @@ |
1941 | 1941 | if (is_hugepage_only_range(mm, addr, len)) |
1942 | 1942 | return -EINVAL; |
1943 | 1943 | |
1944 | + error = security_file_mmap(0, 0, 0, 0, addr, 1); | |
1945 | + if (error) | |
1946 | + return error; | |
1947 | + | |
1944 | 1948 | flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; |
1945 | 1949 | |
1946 | 1950 | error = arch_mmap_check(addr, len, flags); |