public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib: detect ARM64 32-bit compat mode as 64-bit kernel
@ 2017-08-08 21:14 Steve Muckle
  2017-08-14 16:13 ` Steve Muckle
  2017-08-15 15:08 ` Cyril Hrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Muckle @ 2017-08-08 21:14 UTC (permalink / raw)
  To: ltp

ARM64 (aarch64) identifies itself in 32-bit compatibility mode as armv8l
or armv8b depending on endianness. Detect these modes as a 64-bit
kernel.

This fixes the following issues on ARM64:
 - mmapstress03 segfaults in 32-bit compat mode due to a larger than expected
   address space
 - cve-2016-4997 which was a vulnerability in a 32-bit compat syscall, but the
   test does not correctly identify 32-bit compat and wouldn't run
 - vma03 which only runs on 32-bit arches, it would incorrectly be run
   on arm64 32-bit mode and fail

Signed-off-by: Steve Muckle <smuckle.linux@gmail.com>
---
Tested on armv8l, aarch64, x86-64 and x86-64 32-bit compat.

 lib/tst_kernel.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index 71303fc36..fd648b1f2 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -31,6 +31,13 @@ int tst_kernel_bits(void)
 
 	kernel_bits = strstr(buf.machine, "64") ? 64 : 32;
 
+	/*
+	 * ARM64 (aarch64) defines 32-bit compatibility modes as
+	 * armv8l and armv8b (little and big endian).
+	 */
+	if (!strcmp(buf.machine, "armv8l") || !strcmp(buf.machine, "armv8b"))
+		kernel_bits = 64;
+
 	tst_resm(TINFO, "uname.machine=%s kernel is %ibit",
 	         buf.machine, kernel_bits);
 
-- 
2.14.0.rc1.383.gd1ce394fe2-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-15 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 21:14 [LTP] [PATCH] lib: detect ARM64 32-bit compat mode as 64-bit kernel Steve Muckle
2017-08-14 16:13 ` Steve Muckle
2017-08-15 15:08 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox