* [PATCH] ACPI, APEI, EINJ: Refuse to inject into the zero page
@ 2022-04-19 21:19 Tony Luck
2022-04-22 14:53 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Tony Luck @ 2022-04-19 21:19 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Len Brown, James Morse, Borislav Petkov, linux-acpi,
linux-kernel, patches, Tony Luck
Some validation tests dynamically inject errors into memory used by
applications to check that the system can recover from a variety of
poison consumption sceenarios.
But sometimes the virtual address picked by these tests is mapped to
the zero page.
This causes additional unexpected machine checks as other processes that
map the zero page also consume the poison.
Disallow injection to the zero page.
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
I picked -EADDRINUSE as a somewhat descriptive error code distinct
fromm -EINVAL used elsewhere in EINJ, but I'm not strongly attached
to it. Any other non -EINVAL value would be as good an indicator to
the validation tests that they shouldn't inject to this address.
---
drivers/acpi/apei/einj.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 95cc2a9f3e05..d4326ec12d29 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -549,6 +549,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
!arch_is_platform_page(base_addr)))
return -EINVAL;
+ if (is_zero_pfn(base_addr >> PAGE_SHIFT))
+ return -EADDRINUSE;
+
inject:
mutex_lock(&einj_mutex);
rc = __einj_error_inject(type, flags, param1, param2, param3, param4);
--
2.35.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI, APEI, EINJ: Refuse to inject into the zero page
2022-04-19 21:19 [PATCH] ACPI, APEI, EINJ: Refuse to inject into the zero page Tony Luck
@ 2022-04-22 14:53 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-04-22 14:53 UTC (permalink / raw)
To: Tony Luck
Cc: Rafael J. Wysocki, Len Brown, James Morse, Borislav Petkov,
ACPI Devel Maling List, Linux Kernel Mailing List, patches
On Tue, Apr 19, 2022 at 11:19 PM Tony Luck <tony.luck@intel.com> wrote:
>
> Some validation tests dynamically inject errors into memory used by
> applications to check that the system can recover from a variety of
> poison consumption sceenarios.
>
> But sometimes the virtual address picked by these tests is mapped to
> the zero page.
>
> This causes additional unexpected machine checks as other processes that
> map the zero page also consume the poison.
>
> Disallow injection to the zero page.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
>
> ---
> I picked -EADDRINUSE as a somewhat descriptive error code distinct
> fromm -EINVAL used elsewhere in EINJ, but I'm not strongly attached
> to it. Any other non -EINVAL value would be as good an indicator to
> the validation tests that they shouldn't inject to this address.
> ---
> drivers/acpi/apei/einj.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 95cc2a9f3e05..d4326ec12d29 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -549,6 +549,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
> !arch_is_platform_page(base_addr)))
> return -EINVAL;
>
> + if (is_zero_pfn(base_addr >> PAGE_SHIFT))
> + return -EADDRINUSE;
> +
> inject:
> mutex_lock(&einj_mutex);
> rc = __einj_error_inject(type, flags, param1, param2, param3, param4);
> --
Applied as 5.19 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-22 14:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 21:19 [PATCH] ACPI, APEI, EINJ: Refuse to inject into the zero page Tony Luck
2022-04-22 14:53 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®