diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 7bb0deb5bf3b23238d06aefe97a033bcc07e10f1..59013f319f5411aaf59d38828bcb57a1bceeaa66 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -999,7 +999,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			}
 		}
 		k = elf_ppnt->p_vaddr;
-		if (k < start_code)
+		if ((elf_ppnt->p_flags & PF_X) && k < start_code)
 			start_code = k;
 		if (start_data < k)
 			start_data = k;