提交 8869477a 编写于 作者: E Eric Paris 提交者: James Morris

security: protect from stack expantion into low vm addresses

Add security checks to make sure we are not attempting to expand the
stack into memory protected by mmap_min_addr
Signed-off-by: NEric Paris <eparis@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 ab5a91a8
......@@ -1615,6 +1615,12 @@ static inline int expand_downwards(struct vm_area_struct *vma,
*/
if (unlikely(anon_vma_prepare(vma)))
return -ENOMEM;
address &= PAGE_MASK;
error = security_file_mmap(0, 0, 0, 0, address, 1);
if (error)
return error;
anon_vma_lock(vma);
/*
......@@ -1622,8 +1628,6 @@ static inline int expand_downwards(struct vm_area_struct *vma,
* is required to hold the mmap_sem in read mode. We need the
* anon_vma lock to serialize against concurrent expand_stacks.
*/
address &= PAGE_MASK;
error = 0;
/* Somebody else might have raced and expanded it already */
if (address < vma->vm_start) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册