All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Muckle <smuckle.linux@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lib: detect ARM64 32-bit compat mode as 64-bit kernel
Date: Tue,  8 Aug 2017 14:14:30 -0700	[thread overview]
Message-ID: <20170808211430.90017-1-smuckle.linux@gmail.com> (raw)

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


             reply	other threads:[~2017-08-08 21:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 21:14 Steve Muckle [this message]
2017-08-14 16:13 ` [LTP] [PATCH] lib: detect ARM64 32-bit compat mode as 64-bit kernel Steve Muckle
2017-08-15 15:08 ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170808211430.90017-1-smuckle.linux@gmail.com \
    --to=smuckle.linux@gmail.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.