From patchwork Fri Apr 5 08:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dev Jain X-Patchwork-Id: 13618697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FDAAC67861 for ; Fri, 5 Apr 2024 08:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BeyPo+t9Dp0DhugPXnw5ONCmS2aDSXJQailcz4RnwuE=; b=I1UZUGHCZN+HfG nkOo83nHy2EdsXOjgIxRxDoeUtv82v0QrtBb4SOvu0jTDrI/Re6qz1G0WuJWbQ53DnxbJQgK6BMfh qiSfwr8RuB5Ik4TryBAY1gYXynG79JQ74bj88Cnga4hg2OLJ4qraag8gw5hp79FidvRuyk6b8F2Fs f1Ydf/85j9/ldMiA/j7ZEkeJ4jlUjFeFhp4PfbkKCbgYxkBdSr2SpLMz4/Y06dwHjzfLbCjH9iDEL D7+1xMUvt4o4EoBx1GrJ1Hq0Ufr/Qzww5iqBS4XwofWaxn8aW8eQQYVqPgYCMu7388YzIGCleoYHc SQD/6D6Me8Nzseu5JJZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsfGk-000000061G0-1WSp; Fri, 05 Apr 2024 08:49:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsfGg-000000061Bb-0l6u for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 08:49:52 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5817BFEC; Fri, 5 Apr 2024 01:50:16 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.43.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 34A6F3F64C; Fri, 5 Apr 2024 01:49:40 -0700 (PDT) From: Dev Jain To: shuah@kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com, suzuki.poulose@arm.com, ryan.roberts@arm.com, rob.herring@arm.com, Catalin.Marinas@arm.com, broonie@kernel.org, will@kernel.org, mark.rutland@arm.com, Dev Jain Subject: [PATCH 0/4] A new selftests/ directory for arm compatibility testing Date: Fri, 5 Apr 2024 14:14:06 +0530 Message-Id: <20240405084410.256788-1-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_014950_336713_88724DC7 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series introduces the selftests/arm directory, which tests 32 and 64-bit kernel compatibility with 32-bit ELFs running on the Aarch platform. The need for this bucket of tests is that 32 bit applications built on legacy ARM architecture must not break on the new Aarch64 platforms and the 64-bit kernel. The kernel must emulate the data structures, system calls and the registers according to Aarch32, when running a 32-bit process; this directory fills that testing requirement. One may find similarity between this directory and selftests/arm64; it is advisable to refer to that since a lot has been copied from there itself. The mm directory includes a test for checking 4GB limit of the virtual address space of a process. The signal directory contains two tests, following a common theme: mangle with arm_cpsr, dumped by the kernel to user space while invoking the signal handler; kernel must spot this illegal attempt and terminate the program by SEGV. The elf directory includes a test for checking the 32-bit status of the ELF. The series has been tested on 6.9.0-rc2, on Aarch64 platform. Testing remains to be done on Aaarch32. Dev Jain (4): selftests/arm: Add mm test selftests/arm: Add signal tests selftests/arm: Add elf test selftests: Add build infrastructure along with README tools/testing/selftests/Makefile | 1 + tools/testing/selftests/arm/Makefile | 57 ++++ tools/testing/selftests/arm/README | 31 +++ tools/testing/selftests/arm/elf/Makefile | 6 + tools/testing/selftests/arm/elf/parse_elf.c | 75 +++++ tools/testing/selftests/arm/mm/Makefile | 6 + tools/testing/selftests/arm/mm/compat_va.c | 94 +++++++ tools/testing/selftests/arm/signal/Makefile | 30 ++ .../selftests/arm/signal/test_signals.c | 27 ++ .../selftests/arm/signal/test_signals.h | 74 +++++ .../selftests/arm/signal/test_signals_utils.c | 257 ++++++++++++++++++ .../selftests/arm/signal/test_signals_utils.h | 128 +++++++++ .../signal/testcases/mangle_cpsr_aif_bits.c | 33 +++ .../mangle_cpsr_invalid_compat_toggle.c | 29 ++ 14 files changed, 848 insertions(+) create mode 100644 tools/testing/selftests/arm/Makefile create mode 100644 tools/testing/selftests/arm/README create mode 100644 tools/testing/selftests/arm/elf/Makefile create mode 100644 tools/testing/selftests/arm/elf/parse_elf.c create mode 100644 tools/testing/selftests/arm/mm/Makefile create mode 100644 tools/testing/selftests/arm/mm/compat_va.c create mode 100644 tools/testing/selftests/arm/signal/Makefile create mode 100644 tools/testing/selftests/arm/signal/test_signals.c create mode 100644 tools/testing/selftests/arm/signal/test_signals.h create mode 100644 tools/testing/selftests/arm/signal/test_signals_utils.c create mode 100644 tools/testing/selftests/arm/signal/test_signals_utils.h create mode 100644 tools/testing/selftests/arm/signal/testcases/mangle_cpsr_aif_bits.c create mode 100644 tools/testing/selftests/arm/signal/testcases/mangle_cpsr_invalid_compat_toggle.c