All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Daniel Kachhap <amit.kachhap@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
	Gabor Kertesz <gabor.kertesz@arm.com>,
	Amit Daniel Kachhap <amit.kachhap@arm.com>
Subject: [PATCH v2 0/6] kselftest: arm64/mte: Tests for user-space MTE
Date: Fri,  2 Oct 2020 17:26:24 +0530	[thread overview]
Message-ID: <20201002115630.24683-1-amit.kachhap@arm.com> (raw)

These patch series adds below kselftests to test the user-space support for the
ARMv8.5 Memory Tagging Extension present in arm64 tree [1]. This patch
series is based on Linux v5.9-rc3.

1) This test-case verifies that the memory allocated by kernel mmap interface
can support tagged memory access. It first checks the presence of tags at
address[56:59] and then proceeds with read and write. The pass criteria for
this test is that tag fault exception should not happen.

2) This test-case crosses the valid memory to the invalid memory. In this
memory area valid tags are not inserted so read and write should not pass. The
pass criteria for this test is that tag fault exception should happen for all
the illegal addresses. This test also verfies that PSTATE.TCO works properly.

3) This test-case verifies that the memory inherited by child process from
parent process should have same tags copied. The pass criteria for this test is
that tag fault exception should not happen.

4) This test checks different mmap flags with PROT_MTE memory protection.

5) This testcase checks that KSM should not merge pages containing different
MTE tag values. However, if the tags are same then the pages may merge. This
testcase uses the generic ksm sysfs interfaces to verify the MTE behaviour, so
this testcase is not fullproof and may be impacted due to other load in the system.

6) Fifth test verifies that syscalls read/write etc works by considering that
user pointer has valid/invalid allocation tags.

Changes since v1 [2]:
* Redefined MTE kernel header definitions to decouple kselftest compilations.
* Removed gmi masking instructions in mte_insert_random_tag assembly
  function. This simplifies the tag inclusion mask test with only GCR
  mask register used.
* Created a new mte_insert_random_tag function with gmi instruction.
  This is useful for the 6th test which reuses the original tag.
* Now use /dev/shm/* to hold temporary files.
* Updated the 6th test to handle the error properly in case of failure
  in accessing memory with invalid tag in kernel.
* Code and comment clean-ups.

Thanks,
Amit Daniel

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte
[2]: https://patchwork.kernel.org/patch/11747791/

Amit Daniel Kachhap (6):
  kselftest/arm64: Add utilities and a test to validate mte memory
  kselftest/arm64: Verify mte tag inclusion via prctl
  kselftest/arm64: Check forked child mte memory accessibility
  kselftest/arm64: Verify all different mmap MTE options
  kselftest/arm64: Verify KSM page merge for MTE pages
  kselftest/arm64: Check mte tagged user address in kernel

 tools/testing/selftests/arm64/Makefile        |   2 +-
 tools/testing/selftests/arm64/mte/.gitignore  |   6 +
 tools/testing/selftests/arm64/mte/Makefile    |  29 ++
 .../selftests/arm64/mte/check_buffer_fill.c   | 475 ++++++++++++++++++
 .../selftests/arm64/mte/check_child_memory.c  | 195 +++++++
 .../selftests/arm64/mte/check_ksm_options.c   | 159 ++++++
 .../selftests/arm64/mte/check_mmap_options.c  | 262 ++++++++++
 .../arm64/mte/check_tags_inclusion.c          | 185 +++++++
 .../selftests/arm64/mte/check_user_mem.c      | 111 ++++
 .../selftests/arm64/mte/mte_common_util.c     | 341 +++++++++++++
 .../selftests/arm64/mte/mte_common_util.h     | 118 +++++
 tools/testing/selftests/arm64/mte/mte_def.h   |  60 +++
 .../testing/selftests/arm64/mte/mte_helper.S  | 128 +++++
 13 files changed, 2070 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/arm64/mte/.gitignore
 create mode 100644 tools/testing/selftests/arm64/mte/Makefile
 create mode 100644 tools/testing/selftests/arm64/mte/check_buffer_fill.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_child_memory.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_ksm_options.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_mmap_options.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_tags_inclusion.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_user_mem.c
 create mode 100644 tools/testing/selftests/arm64/mte/mte_common_util.c
 create mode 100644 tools/testing/selftests/arm64/mte/mte_common_util.h
 create mode 100644 tools/testing/selftests/arm64/mte/mte_def.h
 create mode 100644 tools/testing/selftests/arm64/mte/mte_helper.S

-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Amit Daniel Kachhap <amit.kachhap@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org
Cc: Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org,
	Gabor Kertesz <gabor.kertesz@arm.com>,
	Amit Daniel Kachhap <amit.kachhap@arm.com>,
	Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
	Shuah Khan <shuah@kernel.org>
Subject: [PATCH v2 0/6] kselftest: arm64/mte: Tests for user-space MTE
Date: Fri,  2 Oct 2020 17:26:24 +0530	[thread overview]
Message-ID: <20201002115630.24683-1-amit.kachhap@arm.com> (raw)

These patch series adds below kselftests to test the user-space support for the
ARMv8.5 Memory Tagging Extension present in arm64 tree [1]. This patch
series is based on Linux v5.9-rc3.

1) This test-case verifies that the memory allocated by kernel mmap interface
can support tagged memory access. It first checks the presence of tags at
address[56:59] and then proceeds with read and write. The pass criteria for
this test is that tag fault exception should not happen.

2) This test-case crosses the valid memory to the invalid memory. In this
memory area valid tags are not inserted so read and write should not pass. The
pass criteria for this test is that tag fault exception should happen for all
the illegal addresses. This test also verfies that PSTATE.TCO works properly.

3) This test-case verifies that the memory inherited by child process from
parent process should have same tags copied. The pass criteria for this test is
that tag fault exception should not happen.

4) This test checks different mmap flags with PROT_MTE memory protection.

5) This testcase checks that KSM should not merge pages containing different
MTE tag values. However, if the tags are same then the pages may merge. This
testcase uses the generic ksm sysfs interfaces to verify the MTE behaviour, so
this testcase is not fullproof and may be impacted due to other load in the system.

6) Fifth test verifies that syscalls read/write etc works by considering that
user pointer has valid/invalid allocation tags.

Changes since v1 [2]:
* Redefined MTE kernel header definitions to decouple kselftest compilations.
* Removed gmi masking instructions in mte_insert_random_tag assembly
  function. This simplifies the tag inclusion mask test with only GCR
  mask register used.
* Created a new mte_insert_random_tag function with gmi instruction.
  This is useful for the 6th test which reuses the original tag.
* Now use /dev/shm/* to hold temporary files.
* Updated the 6th test to handle the error properly in case of failure
  in accessing memory with invalid tag in kernel.
* Code and comment clean-ups.

Thanks,
Amit Daniel

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte
[2]: https://patchwork.kernel.org/patch/11747791/

Amit Daniel Kachhap (6):
  kselftest/arm64: Add utilities and a test to validate mte memory
  kselftest/arm64: Verify mte tag inclusion via prctl
  kselftest/arm64: Check forked child mte memory accessibility
  kselftest/arm64: Verify all different mmap MTE options
  kselftest/arm64: Verify KSM page merge for MTE pages
  kselftest/arm64: Check mte tagged user address in kernel

 tools/testing/selftests/arm64/Makefile        |   2 +-
 tools/testing/selftests/arm64/mte/.gitignore  |   6 +
 tools/testing/selftests/arm64/mte/Makefile    |  29 ++
 .../selftests/arm64/mte/check_buffer_fill.c   | 475 ++++++++++++++++++
 .../selftests/arm64/mte/check_child_memory.c  | 195 +++++++
 .../selftests/arm64/mte/check_ksm_options.c   | 159 ++++++
 .../selftests/arm64/mte/check_mmap_options.c  | 262 ++++++++++
 .../arm64/mte/check_tags_inclusion.c          | 185 +++++++
 .../selftests/arm64/mte/check_user_mem.c      | 111 ++++
 .../selftests/arm64/mte/mte_common_util.c     | 341 +++++++++++++
 .../selftests/arm64/mte/mte_common_util.h     | 118 +++++
 tools/testing/selftests/arm64/mte/mte_def.h   |  60 +++
 .../testing/selftests/arm64/mte/mte_helper.S  | 128 +++++
 13 files changed, 2070 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/arm64/mte/.gitignore
 create mode 100644 tools/testing/selftests/arm64/mte/Makefile
 create mode 100644 tools/testing/selftests/arm64/mte/check_buffer_fill.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_child_memory.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_ksm_options.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_mmap_options.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_tags_inclusion.c
 create mode 100644 tools/testing/selftests/arm64/mte/check_user_mem.c
 create mode 100644 tools/testing/selftests/arm64/mte/mte_common_util.c
 create mode 100644 tools/testing/selftests/arm64/mte/mte_common_util.h
 create mode 100644 tools/testing/selftests/arm64/mte/mte_def.h
 create mode 100644 tools/testing/selftests/arm64/mte/mte_helper.S

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-10-02 11:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 11:56 Amit Daniel Kachhap [this message]
2020-10-02 11:56 ` [PATCH v2 0/6] kselftest: arm64/mte: Tests for user-space MTE Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 1/6] kselftest/arm64: Add utilities and a test to validate mte memory Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 2/6] kselftest/arm64: Verify mte tag inclusion via prctl Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 3/6] kselftest/arm64: Check forked child mte memory accessibility Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 4/6] kselftest/arm64: Verify all different mmap MTE options Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 5/6] kselftest/arm64: Verify KSM page merge for MTE pages Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 11:56 ` [PATCH v2 6/6] kselftest/arm64: Check mte tagged user address in kernel Amit Daniel Kachhap
2020-10-02 11:56   ` Amit Daniel Kachhap
2020-10-02 18:00 ` [PATCH v2 0/6] kselftest: arm64/mte: Tests for user-space MTE Catalin Marinas
2020-10-02 18:00   ` Catalin Marinas
2020-10-05 18:08 ` Will Deacon
2020-10-05 18:08   ` Will Deacon

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=20201002115630.24683-1-amit.kachhap@arm.com \
    --to=amit.kachhap@arm.com \
    --cc=Vincenzo.Frascino@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=gabor.kertesz@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=will@kernel.org \
    /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.