mbox series

[v5,0/2] efi: Free memory on exit

Message ID 20170829192648.55830-1-agraf@suse.de
Headers show
Series efi: Free memory on exit | expand

Message

Alexander Graf Aug. 29, 2017, 7:26 p.m. UTC
When exiting grub, we currently leave the heap allocated. This means that if we
exit and rerun grub, after a few iterations we can run into memory shortage.

This patch set frees the heap on exit. That way we can rerun grub many times
without much problem.

v3 -> v4:

  - Move grub_reboot to kern/efi/efi.c
  - use dynamic list instead of static array at runtime
  - use allocate_pool for list, so we are not bound by heap or random numbers
  - remember all allocations, not just the heap

v4 -> v5:

  - free dynamic list entries on allocation removal

Alexander Graf (2):
  efi: Move grub_reboot() into kernel
  efi: Free malloc regions on exit

 grub-core/Makefile.core.def |  4 ---
 grub-core/kern/efi/efi.c    |  9 +++++
 grub-core/kern/efi/init.c   |  1 +
 grub-core/kern/efi/mm.c     | 88 +++++++++++++++++++++++++++++++++++++++++++++
 grub-core/lib/efi/reboot.c  | 33 -----------------
 include/grub/efi/efi.h      |  1 +
 include/grub/misc.h         |  3 +-
 7 files changed, 101 insertions(+), 38 deletions(-)
 delete mode 100644 grub-core/lib/efi/reboot.c

-- 
2.12.3


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Daniel Kiper Aug. 29, 2017, 10:05 p.m. UTC | #1
On Tue, Aug 29, 2017 at 09:26:46PM +0200, Alexander Graf wrote:
> When exiting grub, we currently leave the heap allocated. This means that if we

> exit and rerun grub, after a few iterations we can run into memory shortage.


Hmmm... Which one should I review? v3, v4, v5 or maybe I should wait for v6?

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Alexander Graf Aug. 30, 2017, 6:33 a.m. UTC | #2
> Am 30.08.2017 um 00:05 schrieb Daniel Kiper <dkiper@net-space.pl>:

> 

>> On Tue, Aug 29, 2017 at 09:26:46PM +0200, Alexander Graf wrote:

>> When exiting grub, we currently leave the heap allocated. This means that if we

>> exit and rerun grub, after a few iterations we can run into memory shortage.

> 

> Hmmm... Which one should I review? v3, v4, v5 or maybe I should wait for v6?


v5 is good, please review that one.

Alex

> 

> Daniel



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel