[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250919130620.56518-5-linyongting@bytedance.com>
Date: Fri, 19 Sep 2025 21:06:17 +0800
From: Yongting Lin <linyongting@...edance.com>
To: anthony.yznaga@...cle.com,
khalid@...nel.org,
shuah@...nel.org
Cc: linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
akpm@...ux-foundation.org,
linux-mm@...ck.org,
libo.gcs85@...edance.com,
Yongting Lin <linyongting@...edance.com>
Subject: [PATCH V2 5/8] mshare: selftests: Add test case ioctl unmap
This test case aims to verify whether the guest VMA will vanish
when corresponding VMA of host mm got ioctl unmap.
Signed-off-by: Yongting Lin <linyongting@...edance.com>
---
tools/testing/selftests/mshare/basic.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/testing/selftests/mshare/basic.c b/tools/testing/selftests/mshare/basic.c
index 54a132a8116c..043d1f3e1e3e 100644
--- a/tools/testing/selftests/mshare/basic.c
+++ b/tools/testing/selftests/mshare/basic.c
@@ -86,4 +86,24 @@ TEST_F(basic, shared_mem)
ASSERT_EQ(memcmp(addr, STRING, sizeof(STRING)), 0);
}
+TEST_F_SIGNAL(basic, ioctl_unmap, SIGSEGV)
+{
+ char *addr;
+ int fd;
+
+ fd = open(self->filename, O_RDWR, 0600);
+ addr = mmap(NULL, self->align_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, 0);
+ ASSERT_NE(addr, MAP_FAILED);
+ addr[0] = 'M';
+
+ /* munmap vma for host mm */
+ mshare_ioctl_munmap(fd, variant->allocate_size);
+ /*
+ * Will generate SIGSEGV signal as ioctl has already cleaned
+ * shared page table
+ */
+ addr[0] = 'D';
+}
+
TEST_HARNESS_MAIN
--
2.20.1
Powered by blists - more mailing lists