#23 Disable write-only mmap test case for RISC-V
Opened 2 years ago by xctan. Modified 2 years ago
xctan/libaio fix-mmap-test  into  master

file modified
+10
@@ -37,6 +37,14 @@ 

  	status |= attempt_rw(rwfd, buf, SIZE,  0,  READ, -EFAULT);

  

  	res = munmap(buf, page_size);			assert(res == 0);

+ 

+ 	/* As of  June 28th, 2022,  the RISC-V spec Volume 2 Section 4.3

+ 	 * version "20211203 Privileged Architecture v1.12, Ratified"

+ 	 * reserves the usage of  the PTE permission bit combination  of

+ 	 * "write+!read",   so the next test leads to undefined behavior

+ 	 * and should be disabled. */

+ #ifndef __riscv

+ 

  	buf = mmap(0, page_size, PROT_WRITE, MAP_SHARED, rwfd, 0);

  	assert(buf != (char *)-1);

  
@@ -48,6 +56,8 @@ 

  	status |= attempt_rw(rwfd, buf, SIZE,  0,  READ, SIZE);

  	status |= attempt_rw(rwfd, buf, SIZE,  0, WRITE, res);

  

+ #endif

+ 

  	return status;

  }

  

As of June 28th, 2022, the RISC-V spec1 reserves the PTE permission bit
combination of "write+!read", and the kernel would have incoherent behavior in
the last test case of "harness/cases/5.t". Since it leads to undefined behavior,
until further spec update, this test case should be disabled for RISC-V.

A patch to disallow such permission in mmap() can be found here2.

Metadata