OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Kernel heap question
PostPosted: Sat Apr 20, 2019 11:07 am 
Offline
Member
Member

Joined: Mon Jun 04, 2018 8:10 am
Posts: 44
Hi, I am currently trying to implement a heap for my kernel, however I was wondering about one thing concerning security.
In my kernel, paging is enabled and the heap is going from 0x100000 to 0x150000 in physical memory.
My question is: Is it ok to map all pages concerning heap in the kernel page table at the beginning or is it better/safer to map pages as the heap grows?
I hope my question was clear.


Top
 Profile  
 
 Post subject: Re: Kernel heap question
PostPosted: Sat Apr 20, 2019 11:33 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
Security-wise, this does not make a huge difference. If someone can write to kernel memory (or even read it), the security of the system is compromised anyway.

There are, however, reasons to map not everything at once: doing so will obviously consume more physical memory and it might not be desirable to fix the size of the kernel heap to some smallish number of pages.

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: Kernel heap question
PostPosted: Mon Apr 22, 2019 12:22 am 
Online
Member
Member

Joined: Fri Jun 28, 2013 1:48 am
Posts: 62
I map all physical memory 1:1 to kernel space (above canonical hole). So kernel heap only need to know which pages belongs to it, no need to map them dynamically.

Kernel space is shared between all processes. If dynamic mapping is used within kernel space, then the kernel have to update every process' page table.

_________________
Reinventing the Wheel, code: https://github.com/songziming/wheel


Top
 Profile  
 
 Post subject: Re: Kernel heap question
PostPosted: Tue Apr 23, 2019 10:20 am 
Offline
Member
Member

Joined: Mon Jun 04, 2018 8:10 am
Posts: 44
Okay, thank you for your replies!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group