Add an "EBUSY" check for the "clean-anonymous" sub-test

Currently, kernel can correctly handle/recover a user-space error
page, e.g., set "PG_hwpoison" flag, de-attach the error page from
the address mapping, and kill the related processes if it's a
dirty page. While for some kernel error page, kernel can only set
"PG_hwpoison" flag, and return "-EBUSY" error code for system
request (try to be lucky and not touch the kernel error page in
future). The table below shows the error code mapping from kernel
error code to system call error code of madvise() when handling
an error page.

| Kernel error code | System call error code |
| MF_IGNORE[1]      |       EBUSY            |
| MF_FAILED[2]      |       EBUSY            |
| MF_DELAYED[2]     |       0 (SUCCESS)      |
| MF_RECOVERED[2]   |       0 (SUCCESS)      |
| [1] For reserved/slab kernel error pages.  |
| [2] For other error pages.                 |

There isn't an existing system error code more suitable than
"EBUSY" to map "MF_IGNORE". And from the above table, the "EBUSY"
system call error code could indicate that kernel ignores a
reserved kernel error page (expected failure) or fails to handle
an error page (real failure).

The page for "clean-anonymous" sub-test from system call
"mmap(..., MAP_PRIVATE|MAP_ANONYMOUS,...)" is a reserved kernel
zeroed page with copy-on-write mapping which kernel can't recover.
So the "EBUSY" error code for this sub-test indicates an expected
failure when doing hardware poison test.

Signed-off-by: Qiuxu Zhuo <>
Signed-off-by: Andi Kleen <>
1 file changed