public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oliver Smith-Denny" <osde@linux.microsoft.com>
To: devel@edk2.groups.io, ardb@kernel.org,
	Taylor Beebe <taylor.d.beebe@gmail.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Subject: Re: [edk2-devel] [PATCH v1] MdeModulePkg: Fixup MAT Attributes After Splitting EFI Memory Map
Date: Wed, 17 Apr 2024 14:53:52 -0700	[thread overview]
Message-ID: <b5bac13d-0664-434f-9f0e-bd48e7f50b40@linux.microsoft.com> (raw)
In-Reply-To: <CAMj1kXEDjFCObphTOxMaS7wJWoyZJ_6ca7weQRF8RSP3eUX8xQ@mail.gmail.com>

On 4/17/2024 9:52 AM, Ard Biesheuvel wrote:
> So the purpose of the MAT is to describe RT code (and to a lesser
> extent, RT data) regions where we cannot apply either RO or XP to the
> whole thing. IIRC there was never an intent to exhaustively describe
> all memory runtime regions. Also note that RO was introduced at this
> point, because WP was already being used in the ordinary memory map in
> a deviating manner. RO is defined both for the memory map and the MAT,
> and so it can occur in either.
> 

At the principle level, I think we can say that we want all runtime code
regions to RO and all runtime data regions to be XP. Regardless of
whatever situation we have today, I think this is a reasonable
principle to maintain. If you don't want those attributes, a different
memory type should be allocated. If we agree on this principle, I think
we should put it into practice. Again, the UEFI spec calls out that
EfiRuntimeServicesCode is for image code. From a security and safety
standpoint, we know we want image code to be RO.

To help with any existing (mis)use of EfiRuntimeServicesCode, I do
think we should put a big old assert in the MAT generation logic that
says I found a EfiRuntimeServicesCode section that is not described
in an image record, something is wrong with your configuration, you
are not using EfiRuntimeServicesCode correctly. If I am missing a
legitimate use of EfiRuntimeServicesCode, please help educate me.

Also, I know that modern Windows security features rely on the MAT
describing all EfiRuntimeServicesCode and EfiRuntimeServicesData
regions. Here is an MSDN link that makes a statement towards
that:

https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/unified-extensible-firmware-interface

In a more actionable way, the Windows testing infrastructure will
test to ensure that there are no EfiRuntimeServices[Code|Data]
sections in the EFI memory map that are not described in the MAT.
Again, there are various security features that rely on this.

Thanks,
Oliver


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117935): https://edk2.groups.io/g/devel/message/117935
Mute This Topic: https://groups.io/mt/105570114/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-04-17 21:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  2:28 [edk2-devel] [PATCH v1] MdeModulePkg: Fixup MAT Attributes After Splitting EFI Memory Map Taylor Beebe
2024-04-17  6:38 ` Ard Biesheuvel
2024-04-17 13:40   ` Oliver Smith-Denny
2024-04-17 14:05     ` Taylor Beebe
2024-04-17 14:09       ` Oliver Smith-Denny
2024-04-17 14:34         ` Taylor Beebe
2024-04-17 16:52           ` Ard Biesheuvel
2024-04-17 21:53             ` Oliver Smith-Denny [this message]
2024-04-17 21:41           ` Oliver Smith-Denny
     [not found]           ` <17C72F39F4EB8845.20027@groups.io>
2024-04-17 22:12             ` Oliver Smith-Denny

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-list 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=b5bac13d-0664-434f-9f0e-bd48e7f50b40@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /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