You could also try modifying the Ia32 segment descriptors to mark the
stack segment as an "expand down" type with a limit set just below the
low end of the stack area. That should generate a stack-fault exception
if the stack overflows, and wouldn't require building page tables. See
sections 5.1 - 5.3 of the Intel SDM, volume 3.
Brian J. Johnson
------------------------------------------------------------------------
*From:* Ni, Ray [mailto:ray...@intel.com]
*Sent:* Wednesday, September 14, 2022, 10:25 PM
*To:* devel@edk2.groups.io <devel@edk2.groups.io>, tiger...@zhaoxin.com
<tiger...@zhaoxin.com>
*Cc:* Fan, Jeff <fanjianf...@byosoft.com.cn>
*Subject:* [edk2-devel] How to guard CAR's stack overflow
It’s doable.
You need to enable paging and mark the very low 4K area of the stack
as not-present.
You could use the UefiCpuPkg/Library/CpuPageTableLib to help you
create the 1:1 page table with the specific
4K area as not-present (if you are using x86 processors).
Thanks,
Ray
*From:*devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of
*Tiger Liu(BJ-RD)
*Sent:* Thursday, September 15, 2022 8:50 AM
*To:* devel@edk2.groups.io
*Subject:* [edk2-devel] How to guard CAR's stack overflow
Hi, Experts:
Usually, we use Cache As Ram to setup stack and heap for C language
running environment before permanent memory has been initialized.
So, is there a method to guard this phase’s stack overflow?
Note:
I find udk has introduced a method to guard stack overflow after
memory has been initialized and discovered.
Thanks
保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
/CONFIDENTIAL NOTE: /
/This email contains confidential or legally privileged information
and is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of
this email is strictly prohibited./
_._,_._,_
------------------------------------------------------------------------
Groups.io Links:
You receive all messages sent to this group.
View/Reply Online (#93797)
<https://edk2.groups.io/g/devel/message/93797>
| | Mute This Topic
<https://groups.io/mt/93691088/1761811>
| New Topic
<https://edk2.groups.io/g/devel/post>
Your Subscription
<https://edk2.groups.io/g/devel/editsub/1761811>
| Contact Group Owner <mailto:devel+ow...@edk2.groups.io> |
Unsubscribe
<https://edk2.groups.io/g/devel/unsub>
[brian.john...@hpe.com]
_
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93972): https://edk2.groups.io/g/devel/message/93972
Mute This Topic: https://groups.io/mt/93691088/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-