lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 14 May 2014 14:57:21 -0400
From:	Kyle McMartin <kyle@...hat.com>
To:	linux-arm-kernel@...ts.infradead.org
Cc:	linux-kernel@...r.kernel.org, catalin.marinas@....com,
	will.deacon@....com
Subject: [PATCH] arm64: don't set READ_IMPLIES_EXEC for EM_AARCH64

current->personality & READ_IMPLIES_EXEC is currently being set for
AArch64 binaries, resulting in an executable stack, when no explicit
PT_GNU_STACK header is present.

[kmcmarti@...ition ~]$ uname -p
aarch64
[kmcmarti@...ition ~]$ cat /proc/$$/personality 
00400000

The reason for this is, without an explicit PT_GNU_STACK entry in the
binary, stk is still set to EXSTACK_DEFAULT (which should be
non-executable on AArch64.) As a result, elf_read_implies_exec is true,
and we set READ_IMPLIES_EXEC in binfmt_elf.c:load_elf_binary.

Fix this to return 0 in the native case, and parrot the logic from
arch/arm/kernel/elf.c otherwise. With this patch, binaries correctly
don't have READ_IMPLIES_EXEC set, and we can let PT_GNU_STACK change
things if it's explicitly requested.

Signed-off-by: Kyle McMartin <kyle@...hat.com>

--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -114,7 +114,8 @@ typedef struct user_fpsimd_state elf_fpregset_t;
  */
 #define elf_check_arch(x)		((x)->e_machine == EM_AARCH64)
 
-#define elf_read_implies_exec(ex,stk)	(stk != EXSTACK_DISABLE_X)
+#define elf_read_implies_exec(ex,stk)	(test_thread_flag(TIF_32BIT) \
+					 ? (stk == EXSTACK_ENABLE_X) : 0)
 
 #define CORE_DUMP_USE_REGSET
 #define ELF_EXEC_PAGESIZE	PAGE_SIZE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ