mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-16 15:57:19 +00:00
arm-gcs: add test for GCS CHKFEAT
Add a new recipes-test layer and GCS test. The test checks that CHKFEAT reports GCS as enabled. Signed-off-by: Ross Burton <ross.burton@arm.com>
This commit is contained in:
committed by
Ross Burton
parent
fe553984a9
commit
a9fde75f5f
@@ -53,7 +53,7 @@ local_conf_header:
|
||||
IMAGE_CLASSES += "testimage"
|
||||
TEST_SUITES = "ping ssh gcs"
|
||||
IMAGE_FEATURES += "ssh-server-dropbear"
|
||||
CORE_IMAGE_EXTRA_INSTALL += "ssh-pregen-hostkeys binutils kselftest"
|
||||
CORE_IMAGE_EXTRA_INSTALL += "ssh-pregen-hostkeys binutils kselftest gcs-test"
|
||||
|
||||
target:
|
||||
- core-image-full-cmdline
|
||||
|
||||
@@ -47,6 +47,21 @@ class GCSTests(OERuntimeTestCase):
|
||||
self.assertEqual(status, 0, f"ls failed: {output}")
|
||||
self.assertEqual(output, "/usr")
|
||||
|
||||
def test_chkfeat(self):
|
||||
"""
|
||||
Verify that CHKFEAT reports GCS as enabled when running with the tunables.
|
||||
|
||||
If this fails then GCS is not being properly enabled at runtime glibc. The kernel
|
||||
and glibc patches may be out of sync.
|
||||
"""
|
||||
cmd = "GLIBC_TUNABLES=glibc.cpu.aarch64_gcs=1:glibc.cpu.aarch64_gcs_policy=2 gcs-test"
|
||||
status, output = self.target.run(cmd)
|
||||
self.assertEqual(status, 0, f"gcs-test failed: {output}")
|
||||
|
||||
# gcs-test should return 1 if GCS is not enabled via the tunables
|
||||
cmd = "gcs-test"
|
||||
status, output = self.target.run(cmd)
|
||||
self.assertEqual(status, 1, f"gcs-test failed: {output}")
|
||||
|
||||
@OEHasPackage(['kselftest'])
|
||||
@unittest.expectedFailure
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) 2024 Arm Ltd */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
.global gcs_enabled
|
||||
.type gcs_enabled,@function
|
||||
gcs_enabled:
|
||||
mov x16, #0x1
|
||||
hint 40
|
||||
eor x0, x16, #0x1
|
||||
ret
|
||||
|
||||
.pushsection .note.gnu.property, "a"
|
||||
.balign 8
|
||||
.long 4
|
||||
.long 0x10
|
||||
.long 0x5
|
||||
.asciz "GNU"
|
||||
.long 0xc0000000
|
||||
.long 4
|
||||
.long 4
|
||||
.long 0
|
||||
.popsection
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright (C) 2024 Arm Ltd
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
extern int gcs_enabled(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return gcs_enabled() ? 0 : 1;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
SUMMARY = "test"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||
|
||||
SRC_URI = "file://chkfeat.s file://gcs_enabled.c"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
LDFLAGS:append = " -z experimental-gcs=always"
|
||||
|
||||
do_compile() {
|
||||
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/gcs_enabled.c ${WORKDIR}/chkfeat.s -o gcs-test
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 gcs-test ${D}${bindir}
|
||||
}
|
||||
Reference in New Issue
Block a user