Commit e2fbcd2
committed
pe: Fix PF in GRUB after memattrs call
The call to update_mem_attrs() takes an aligned pointer within an
allocated region but passes the entire size of the allocated region. The
result is that Shim may remove execute permission from some pages
belonging to GRUB causing a page fault upon returning from the LoadImage
call.
There are two cases:
* When loading the image, set the memory attributes for exactly what we
intend to load.
* When freeing the image, be cautious and apply the edk2 workaround for
the entire allocated region.
Fixes: 226fee2 ("PE Loader: support and require NX")
Fixes: 2f64bb9 ("loader-protocol: add workaround for EDK2 2025.02 page fault on FreePages")
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>1 parent afc4955 commit e2fbcd2
2 files changed
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
| |||
196 | 194 | | |
197 | 195 | | |
198 | 196 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 197 | + | |
| 198 | + | |
202 | 199 | | |
203 | 200 | | |
204 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
| 720 | + | |
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| |||
0 commit comments