From: Jiri Kosina <jkosina@suse.cz>
Date: Tue, 30 Apr 2013 22:27:45 +0000 (-0700)
Subject: binfmt_elf: PIE: make PF_RANDOMIZE check comment more accurate
X-Git-Tag: firefly_0821_release~3680^2~625^2~63
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c1d025e22e0ef167a4589cf5a6b2a32bfef0472c;p=firefly-linux-kernel-4.4.55.git

binfmt_elf: PIE: make PF_RANDOMIZE check comment more accurate

The comment I originally added in commit a3defbe5c337 ("binfmt_elf: fix
PIE execution with randomization disabled") is not really 100% accurate
-- sysctl is not the only way how PF_RANDOMIZE could be forcibly unset
in runtime.

Another option of course is direct modification of personality flags
(i.e.  running through setarch wrapper).

Make the comment more explicit and accurate.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 86af964c2425..e32344bdfab1 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -803,7 +803,8 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			 * follow the loader, and is not movable.  */
 #ifdef CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE
 			/* Memory randomization might have been switched off
-			 * in runtime via sysctl.
+			 * in runtime via sysctl or explicit setting of
+			 * personality flags.
 			 * If that is the case, retain the original non-zero
 			 * load_bias value in order to establish proper
 			 * non-randomized mappings.