From: Shuai Xue <xueshuai@linux.alibaba.com>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: "rjw@rjwysocki.net" <rjw@rjwysocki.net>,
"lenb@kernel.org" <lenb@kernel.org>,
"james.morse@arm.com" <james.morse@arm.com>,
"bp@alien8.de" <bp@alien8.de>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
graeme.gregory@linaro.org, will.deacon@arm.com,
myron.stowe@redhat.com, len.brown@intel.com,
ying.huang@intel.com
Subject: Re: [BUG] kernel side can NOT trigger memory error with einj
Date: Thu, 17 Mar 2022 10:56:27 +0800 [thread overview]
Message-ID: <f93a5532-3e07-edf4-38ca-142a0f1d78d7@linux.alibaba.com> (raw)
In-Reply-To: <YjIeff7ESJB/amYA@agluck-desk3.sc.intel.com>
Hi, Tony,
Thank you for your quick reply.
在 2022/3/17 AM1:29, Luck, Tony 写道:
> On Tue, Mar 08, 2022 at 01:19:12PM +0800, Shuai Xue wrote:
>> Hi folks,
>>
>> If we inject an memory error at physical memory address, e.g. 0x92f033038,
>> used by a user space process:
>>
>> echo 0x92f033038 > /sys/kernel/debug/apei/einj/param1
>> echo 0xfffffffffffff000 > /sys/kernel/debug/apei/einj/param2
>> echo 0x1 > /sys/kernel/debug/apei/einj/flags
>> echo 0x8 > /sys/kernel/debug/apei/einj/error_type
>> echo 1 > /sys/kernel/debug/apei/einj/error_inject
>>
>> Then the following error will be reported in dmesg:
>>
>> ACPI: [Firmware Bug]: requested region covers kernel memory @ 0x000000092f033038
>>
>> After digging into einj trigger interface, I think it's a kernel bug.
>
> I think you are right. This isn't the first bug where Linux tries
> to validate addresses supplied by EINJ for Linux to read/write.
>
> I hadn't come across it because I almost always set:
>
> # echo 1 > notrigger
>
> so that I can have some application, or function in the kernel
> trigger the error. Instead of running the EINJ trigger action
> to make it happen right away.
Haha, I know your great test suit, ras-tools. All cases are not triggered
by EINJ tigger action. I have learned a lot from it.
>> I am wondering that should we use kmap to map RAM in acpi_map or add a
>> another path to address this issue? Any comment is welcomed.
>
> Perhaps just drop the sanity checks? Just trusting the BIOS? Sounds
> radical, but this is validation code where the user is deliberately
> injecting errors. If there are BIOS bugs, then people doing validation
> may be well positioned to find the BIOS people to make them fix
> things.
>
> Problem with this approach is that EINJ calls into the APEI code
> that is used for other things besides error injection for validation.
> So a blanket removal of sanity checks wouldn't be a good idea.
Agree. A blanket removal of APEI sanity checks is not a good idea. How about
requesting memory with kmap instead APEI API only in __einj_error_trigger()?
Then we would not break the validation of APEI code and could trigger the
injected error.
I have provided a rough code in last mail.
> A hacking way to address this issue is that map RAM memory with kmap
> instead of apei_exec_pre_map_gars, and read it directly instead of
> apei_exec_run.
> - rc = apei_exec_pre_map_gars(&trigger_ctx);
> - if (rc)
> - goto out_release;
> + volatile long *ptr;
> + long tmp;
> + unsigned long pfn;
> + pfn = param1 >> PAGE_SHIFT;
>
> - rc = apei_exec_run(&trigger_ctx, ACPI_EINJ_TRIGGER_ERROR);
> + ptr = kmap(pfn_to_page(pfn));
> + tmp = *(ptr + (param1 & ~ PAGE_MASK));
>
> - apei_exec_post_unmap_gars(&trigger_ctx);
Best Regards.
Shuai
next prev parent reply other threads:[~2022-03-17 2:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 5:19 Shuai Xue
2022-03-16 17:29 ` Luck, Tony
2022-03-17 2:56 ` Shuai Xue [this message]
2022-03-17 16:57 ` Luck, Tony
2022-03-20 13:11 ` Shuai Xue
2022-03-21 2:43 ` Huang, Ying
2022-03-22 3:36 ` Shuai Xue
2022-03-21 15:54 ` Luck, Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f93a5532-3e07-edf4-38ca-142a0f1d78d7@linux.alibaba.com \
--to=xueshuai@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=graeme.gregory@linaro.org \
--cc=james.morse@arm.com \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myron.stowe@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=tony.luck@intel.com \
--cc=will.deacon@arm.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®