2024-05-10 06:26:55

by Jane Chu

[permalink] [raw]
Subject: [PATCH v2 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON)

The soft hwpoison injector via madvise(MADV_HWPOISON) operates in
a synchrous way in a sense, the injector is also a process under
test, and should it have the poisoned page mapped in its address
space, it should legitimately get killed as much as in a real UE
situation.

Signed-off-by: Jane Chu <[email protected]>
---
mm/madvise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index c8ba3f3eb54d..d8a01d7b2860 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -1147,7 +1147,7 @@ static int madvise_inject_error(int behavior,
} else {
pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n",
pfn, start);
- ret = memory_failure(pfn, MF_COUNT_INCREASED | MF_SW_SIMULATED);
+ ret = memory_failure(pfn, MF_ACTION_REQUIRED | MF_COUNT_INCREASED | MF_SW_SIMULATED);
if (ret == -EOPNOTSUPP)
ret = 0;
}
--
2.39.3



2024-05-15 11:44:46

by Oscar Salvador

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON)

On Fri, May 10, 2024 at 12:25:59AM -0600, Jane Chu wrote:
> The soft hwpoison injector via madvise(MADV_HWPOISON) operates in
> a synchrous way in a sense, the injector is also a process under
> test, and should it have the poisoned page mapped in its address
> space, it should legitimately get killed as much as in a real UE
> situation.
>
> Signed-off-by: Jane Chu <[email protected]>

You should also mention that this aligns with what the madvise man page
mentions:

"... This operation may result in the calling process receiving a SIGBUS
and the page being unmapped..."

Reviewed-by: Oscar Salvador <[email protected]>

> ---
> mm/madvise.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index c8ba3f3eb54d..d8a01d7b2860 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1147,7 +1147,7 @@ static int madvise_inject_error(int behavior,
> } else {
> pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n",
> pfn, start);
> - ret = memory_failure(pfn, MF_COUNT_INCREASED | MF_SW_SIMULATED);
> + ret = memory_failure(pfn, MF_ACTION_REQUIRED | MF_COUNT_INCREASED | MF_SW_SIMULATED);
> if (ret == -EOPNOTSUPP)
> ret = 0;
> }
> --
> 2.39.3
>

--
Oscar Salvador
SUSE Labs