Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Provide a hook API when stack overflow occur with stack protection enabled #503

Closed
MarcChen46 opened this issue Jul 27, 2023 · 8 comments
Assignees
Labels
impact:security Has a security impact state:needs-maintainer-feedback Needs more information from a maintainer to determine next steps type:design-change A new proposal or modification to a feature design type:feature-request A new feature proposal urgency:low Little to no impact

Comments

@MarcChen46
Copy link
Contributor

Feature Overview

[Background]
Currently we have EFI_CPU_ARCH_PROTOCOL.RegisterInterruptHandler() for DXE_DRIVER and EFI_SMM_CPU_SERVICE_PROTOCOL.RegisterExceptionHandler() for DXE_SMM_DRIVER to register EXCEPT_IA32_STACK_FAULT type that can perform some customized actions when stack overflow occurred with stack protection enabled, but it has a dependency that the customized code can only get performed after these protocols get installed, it is the gap we want to resolve.

[Feature request]
When stack overflow occurred in any protected modules types(ex: DXE_DRIVER, DXE_CORE, SMM_CORE, DXE_SMM_DRIVER...), it should provide a hook API or mechanism that allow platform to add customized code (ex: report the error to somewhere as telemetry), the customized should not have dependency on protocols.

Solution Overview

Below is just a proposal for reference, it is ok to have any other kind of methods to achieve it.
[Proposal]
Implement a MU version of BaseStackCheckLib instance and implement below code in BaseStackCheckMsft.c, use MSFT VS compiler to compile this C code that has an customized hook API inside __report_gsfailure.

NORETURN VOID __cdecl
__report_gsfailure (
  void
  )
{
  DEBUG ((DEBUG_ERROR, "(__report_gsfailure) STACK PROTECTION : Violation detected\n"));

  CustomizedHook ();  // API provided by another new added library class
  CpuDeadLoop ();
}

Alternatives Considered

No response

Urgency

Low

Are you going to implement the feature request?

Someone else needs to implement the feature

Do you need maintainer feedback?

Maintainer feedback requested

Anything else?

No response

@MarcChen46 MarcChen46 added state:needs-triage Needs to triaged to determine next steps type:feature-request A new feature proposal labels Jul 27, 2023
@github-actions github-actions bot added state:needs-maintainer-feedback Needs more information from a maintainer to determine next steps state:needs-owner Needs an issue owner to be assigned urgency:low Little to no impact labels Jul 27, 2023
@github-actions github-actions bot removed the state:needs-owner Needs an issue owner to be assigned label Jul 27, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in 45 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the state:stale Has not been updated in a long time label Sep 10, 2023
@github-actions
Copy link

This issue has been automatically been closed because it did not have any activity in 45 days and no follow up within 7 days after being marked stale. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2023
@MarcChen46
Copy link
Contributor Author

MarcChen46 commented Sep 18, 2023

@TaylorBeebe, sorry, I did not notice the issue would be closed automatically, may I know if there is any plan for this feature request? can we re-open this issue?

@TaylorBeebe TaylorBeebe reopened this Sep 18, 2023
@TaylorBeebe
Copy link
Contributor

@TaylorBeebe, sorry, I did not notice the issue would be closed automatically, may I know if there is any plan for this feature request? can we re-open this issue?

This feature request is in progress -- reopened the issue

@github-actions github-actions bot removed the state:stale Has not been updated in a long time label Sep 18, 2023
Copy link

github-actions bot commented Nov 2, 2023

This issue has been automatically marked as stale because it has not had activity in 45 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the state:stale Has not been updated in a long time label Nov 2, 2023
@TaylorBeebe TaylorBeebe removed the state:stale Has not been updated in a long time label Nov 3, 2023
@TaylorBeebe
Copy link
Contributor

@MarcChen46
This feature will be completed soon. I posted a draft PR which will be cleaned up over the coming days. I'll ping this issue when the PR is out of draft status. #610

@TaylorBeebe
Copy link
Contributor

PR is out of draft status.

@TaylorBeebe TaylorBeebe added impact:security Has a security impact type:design-change A new proposal or modification to a feature design and removed state:needs-triage Needs to triaged to determine next steps labels Nov 3, 2023
@TaylorBeebe
Copy link
Contributor

Feature completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:security Has a security impact state:needs-maintainer-feedback Needs more information from a maintainer to determine next steps type:design-change A new proposal or modification to a feature design type:feature-request A new feature proposal urgency:low Little to no impact
Projects
None yet
Development

No branches or pull requests

2 participants