2023-01-25 21:26:38

by Janis Schoetterl-Glausch

[permalink] [raw]
Subject: [PATCH v6 04/14] KVM: s390: selftest: memop: Add bad address test

Add test that tries to access, instead of CHECK_ONLY.

Signed-off-by: Janis Schoetterl-Glausch <[email protected]>
Reviewed-by: Nico Boehr <[email protected]>
---
tools/testing/selftests/kvm/s390x/memop.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c
index bbc191a13760..5aae27549437 100644
--- a/tools/testing/selftests/kvm/s390x/memop.c
+++ b/tools/testing/selftests/kvm/s390x/memop.c
@@ -641,7 +641,9 @@ static void _test_errors_common(struct test_info info, enum mop_target target, i

/* Bad guest address: */
rv = ERR_MOP(info, target, WRITE, mem1, size, GADDR((void *)~0xfffUL), CHECK_ONLY);
- TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory access");
+ TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory address");
+ rv = ERR_MOP(info, target, WRITE, mem1, size, GADDR((void *)~0xfffUL));
+ TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory address");

/* Bad host address: */
rv = ERR_MOP(info, target, WRITE, 0, size, GADDR_V(mem1));
--
2.34.1



2023-01-26 15:24:27

by Janosch Frank

[permalink] [raw]
Subject: Re: [PATCH v6 04/14] KVM: s390: selftest: memop: Add bad address test

On 1/25/23 22:25, Janis Schoetterl-Glausch wrote:
> Add test that tries to access, instead of CHECK_ONLY.
""
Add a test that tries a real write to a bad address.
A CHECK_ONLY test doesn't cover all paths.
""

At first I thought you were replacing a test.

>
> Signed-off-by: Janis Schoetterl-Glausch <[email protected]>
> Reviewed-by: Nico Boehr <[email protected]>
> ---
> tools/testing/selftests/kvm/s390x/memop.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c
> index bbc191a13760..5aae27549437 100644
> --- a/tools/testing/selftests/kvm/s390x/memop.c
> +++ b/tools/testing/selftests/kvm/s390x/memop.c
> @@ -641,7 +641,9 @@ static void _test_errors_common(struct test_info info, enum mop_target target, i
>
> /* Bad guest address: */
> rv = ERR_MOP(info, target, WRITE, mem1, size, GADDR((void *)~0xfffUL), CHECK_ONLY);
> - TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory access");
> + TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory address");

"ioctl does not report bad guest memory address on CHECK_ONLY write" ?

> + rv = ERR_MOP(info, target, WRITE, mem1, size, GADDR((void *)~0xfffUL));
> + TEST_ASSERT(rv > 0, "ioctl does not report bad guest memory address");

"ioctl does not report bad guest memory address on write" ?

Not really necessary in this case, it just needs to be different from
the one on top.

>
> /* Bad host address: */
> rv = ERR_MOP(info, target, WRITE, 0, size, GADDR_V(mem1));