Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1449156 > unrolled thread

[PATCH v5 03/15] binfmt_flat: prevent kernel dammage from corrupted executable headers

Started byNicolas Pitre <nicolas.pitre@linaro.org>
First post2016-07-24 17:40 +0200
Last post2016-07-24 17:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v5 03/15] binfmt_flat: prevent kernel dammage from corrupted executable headers Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-07-24 17:40 +0200

#1449156 — [PATCH v5 03/15] binfmt_flat: prevent kernel dammage from corrupted executable headers

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2016-07-24 17:40 +0200
Subject[PATCH v5 03/15] binfmt_flat: prevent kernel dammage from corrupted executable headers
Message-ID<rYtFw-19R-7@gated-at.bofh.it>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
 fs/binfmt_flat.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index c3ccdefdea..03301bad1f 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -466,6 +466,17 @@ static int load_flat_file(struct linux_binprm *bprm,
 	}
 
 	/*
+	 * 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
 	 */
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web