lib: detect ARM64 32-bit compat mode as 64-bit kernel
PATCH 1/1 lib: detect ARM64 32-bit compat mode as 64-bit kernel
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
---
Tested on armv8l, aarch64, x86-64 and x86-64 32-bit compat.
lib/tst_kernel.c | 7 +++++++ 1 file changed, 7 insertions(+)
lib/tst_kernel.c +7 -0
@@ -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);
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
PATCH 1/1 lib: detect ARM64 32-bit compat mode as 64-bit kernel
ping
Quoted 38 lines · Steve Muckle
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 failSigned-off-by Steve Muckle <[email protected]>---
Tested on armv8l, aarch64, x86-64 and x86-64 32-bit compat.lib/tst_kernel.c | 7 +++++++ 1 file changed, 7 insertions(+)lib/tst_kernel.c +7
-0@@ -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);
PATCH 1/1 lib: detect ARM64 32-bit compat mode as 64-bit kernel
In reply to Steve MuckleHi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]