@@ -3,6 +3,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <stdlib.h>
+#include <sys/mman.h>
static LIST_HEAD(framebuffers);
@@ -62,6 +63,6 @@ void fb__stop(void)
struct framebuffer *fb;
list_for_each_entry(fb, &framebuffers, node) {
- free(fb->mem);
+ munmap(fb->mem, fb->mem_size);
}
}
@@ -70,6 +70,7 @@ struct framebuffer *vesa__init(struct kvm *kvm)
.depth = VESA_BPP,
.mem = mem,
.mem_addr = VESA_MEM_ADDR,
+ .mem_size = VESA_MEM_SIZE,
};
return fb__register(&vesafb);
}
@@ -20,6 +20,7 @@ struct framebuffer {
u8 depth;
char *mem;
u64 mem_addr;
+ u64 mem_size;
unsigned long nr_targets;
struct fb_target_operations *targets[FB_MAX_TARGETS];
Framebuffer memory which was mmap() is being free() at the shutdown of the guest, leading to glibc errors. Signed-off-by: Sasha Levin <levinsasha928@gmail.com> --- tools/kvm/framebuffer.c | 3 ++- tools/kvm/hw/vesa.c | 1 + tools/kvm/include/kvm/framebuffer.h | 1 + 3 files changed, 4 insertions(+), 1 deletions(-)