提交 c995ee28 编写于 作者: N Nicolas Pitre 提交者: Greg Ungerer

binfmt_flat: prevent kernel dammage from corrupted executable headers

Signed-off-by: NNicolas Pitre <nico@linaro.org>
Signed-off-by: NGreg Ungerer <gerg@linux-m68k.org>
上级 4adbb6ac
......@@ -465,6 +465,17 @@ static int load_flat_file(struct linux_binprm *bprm,
goto err;
}
/*
* Make sure the header params are sane.
* 28 bits (256 MB) is way more than reasonable in this case.
* If some top bits are set we have probable binary corruption.
*/
if ((text_len | data_len | bss_len | stack_len | full_data) >> 28) {
pr_err("bad header\n");
ret = -ENOEXEC;
goto err;
}
/*
* fix up the flags for the older format, there were all kinds
* of endian hacks, this only works for the simple cases
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册