Skip to content

Commit

Permalink
ACPI, APEI, EINJ: Refuse to inject into the zero page
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Tony Luck authored and Rafael J. Wysocki committed Apr 22, 2022
1 parent a090931 commit ab59c89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/acpi/apei/einj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ab59c89

Please sign in to comment.