-
Notifications
You must be signed in to change notification settings - Fork 64
Patch page tables of child PD's into their parent #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
096fb53 to
a483c35
Compare
Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
The previous approach for patching the page tables of child PD's into the parent PD was to patch two symbols, one for the table metadata (PGD) which points to entries in the table data array, which is the rest of the paging structures. The drawback of this approach is that you need to hardcode the size of the child paging structures in the parent PD. This commit supports a variable size of table data regions by appending a loadable segment to the ELF of the parent. Co-authored-by: Alwin Joshy <joshyalwin@gmail.com> Co-authored-by: Szymon Duchniewicz <s.duchniewicz@unsw.edu.au> Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Co-authored-by: Alwin Joshy <joshyalwin@gmail.com> Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Cleanup how we patch child page table's as data into new elf segments. Co-authored-by: Alwin Joshy <joshyalwin@gmail.com> Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Support for memory regions using large pages to be mapped into the translation tables that are mapped into the parent PD's. Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnanwinter1@gmail.com>
Signed-off-by: Krishnan Winter <krishnan-git@wintermail.me>
Signed-off-by: Krishnan Winter <krishnan-git@wintermail.me>
midnightveil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to post this.
tool/microkit/src/elf.rs
Outdated
| } | ||
|
|
||
| pub fn get_segment(&mut self, segment_name: &str) -> Option<&ElfSegment> { | ||
| for segment in &self.segments { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just self.segments.find(|segment| segment.name == Some(segment_name))?
|
|
||
| // patch the data in | ||
| let elf = &mut pd_elf_files[pd_idx]; | ||
| elf.populate_segment(".table_data", &table_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had this discussion in person but hard NACK on actually editing the ELF files directly to do this, as opposed to doing this via adding a new segment into the memory regions the tool adds directly.
Signed-off-by: Krishnan Winter <krishnan-git@wintermail.me>
Signed-off-by: Krishnan Winter <krishnan-git@wintermail.me>
Signed-off-by: Krishnan Winter <krishnan-git@wintermail.me>
This PR adds support for patching a copy of a child PD's page tables into the parent.
We add an extra attribute to the protection domain xml tag, if set to
true, the child page tables will be added into the parent.We create a vector for all potential child page tables, with the length of the total amount of PDs in the system. This vector is a vector of 64 references to potential PGD's of potential child PDs. If the above tag is set to true, we will go through the current elf segments, memory regions and the ipc buffer associated with each of the child PDs, and create a copy of this paging structure and add to the above vector. At this point, the underlying frame caps haven't been allocated. We will add a blank elf segment,
.table_datato the parent elf at this point, of the correct size that we have calculated from creating these paging structures.Later on when these frame caps have been allocated, its a simple matter of filling in the already create paging structures. To make this simpler, we have added some helper structs and functions in
lib.rs. I'm not sure if this is the best place for this code to live.We then populate the elf segment we created before with these complete paging structures. Additionally we patch a struct variable into the parent containing the base address of this new segment, as well as an array of 64 pointers into this region that are the start of the PGD of each child. We haven't added this struct to the microkit header, so it is therefore up to the user to define this structure. Please let me know if we should add this to
microkit.hinstead. The entries in this table are pointers to the next level tables, or the frame cap. We support both large and small pages. This has been tested on aarch64, but should also work on RISCV64 provided that the address are Sv48 (48bit addressing) we don't actually use . The caps to the underlying frames are also minted into the parent's cspace.Additionally, we extend the current elf library in the microkit tool to be able to create and populate new segments to the in-memory copy of the supplied elf's.
Please feel free to provide any feedback!