additional memory management changes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2-signed (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned | ||
Kinetic |
Won't Fix
|
Undecided
|
Unassigned | ||
Lunar |
Fix Released
|
Undecided
|
Unassigned | ||
grub2-unsigned (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned | ||
Kinetic |
Won't Fix
|
Undecided
|
Unassigned | ||
Lunar |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
The 2.12 mm changes did not take into account grub's mm overhead when requesting pages from the firmware and hence can cause out of memory issues (i.e. we need 4 KiB, it allocates 4 KiB from the firwmare, but then only has like 4000 byte left or something left that, because it itself needs to store some metadata).
Also two performance improvements to those mm changes.
Full commits with more details:
commit 873be3c86c35f8c
Author: Zhang Boyang <email address hidden>
Date: Sun Jan 29 19:49:33 2023 +0800
mm: Avoid complex heap growth math in hot path
We do a lot of math about heap growth in hot path of grub_memalign().
However, the result is only used if out of memory is encountered, which
is seldom.
This patch moves these calculations away from hot path. These
calculations are now only done if out of memory is encountered. This
change can also help compiler to optimize integer overflow checks away.
Signed-off-by: Zhang Boyang <email address hidden>
Reviewed-by: Daniel Kiper <email address hidden>
Gbp-Pq: Topic 2.12-mm
commit ff73d7484d7f885
Author: Zhang Boyang <email address hidden>
Date: Sun Jan 29 19:49:32 2023 +0800
mm: Preallocate some space when adding new regions
When grub_memalign() encounters out-of-memory, it will try
grub_
However, it doesn't preallocate memory space for future allocation
requests. In extreme cases, it requires one call to
grub_
be very slow.
This patch introduces GRUB_MM_
granularity. The new region size is now set to the bigger one of its
original value and GRUB_MM_
memory space preallocated if current allocations request is small.
The value of GRUB_MM_
smaller, the cost of small memory allocations will be higher. If this
value is larger, more memory will be wasted and it might cause
out-of-memory on machines with small amount of RAM.
Signed-off-by: Zhang Boyang <email address hidden>
Reviewed-by: Daniel Kiper <email address hidden>
Gbp-Pq: Topic 2.12-mm
commit ef6115f3b411e63
Author: Zhang Boyang <email address hidden>
Date: Sun Jan 29 19:49:31 2023 +0800
mm: Adjust new region size to take management overhead into account
When grub_memalign() encounters out-of-memory, it will try
grub_
However, the size passed to it doesn't take region management overhead
into account. Adding a memory area of "size" bytes may result in a heap
region of less than "size" bytes really available. Thus, the new region
may not be adequate for current allocation request, confusing
out-of-memory handling code.
This patch introduces GRUB_MM_
management overhead (e.g. metadata, padding). The value of this new
constant must be large enough to make sure grub_memalign(
always succeeds after a successful call to
grub_
for any given addr and size (assuming no integer overflow).
The size passed to grub_mm_
thus if grub_mm_
can always succeed.
Signed-off-by: Zhang Boyang <email address hidden>
Reviewed-by: Daniel Kiper <email address hidden>
Gbp-Pq: Topic 2.12-mm
[Test plan]
Boot a couple platforms make sure it works fine, let it rest in devel for a couple weeks until after the point release.
[where problems could occur]
It could fail to allocate memory in other ways now of course. Security issues because of overflows or stuff are always possible too. I did do some basic review though and that seemed fine.
Changed in grub2-unsigned (Ubuntu): | |
status: | New → Fix Committed |
tags: | removed: block-proposed-bionic block-proposed-focal block-proposed-jammy block-proposed-kinetic |
@Julian Andres Klode (~juliank):
to add this ppa's
ppa:ubuntu- uefi-team/ ubuntu/
ppa:ubuntu- uefi-team/ ubuntu/ grub2-signed/ 1.187.4~ 22.04.1
solves the problem for me!
After i added this ppa's I was able to install the updates over the Ubuntu Store App successfully. /abload. de/img/ bildschirmfotov om2023gpeui. png
=> https:/
Thank you so much for your work!
Should I now remove the on top named ppa's again or can I let them in? /abload. de/img/ bildschirmfotov om2023zqfhq. png /abload. de/img/ bildschirmfotov om2023awigo. png
=> https:/
=> https:/