Elfedit: file sizes not aligned with page boundaries
Dependencies
- [2]
Z43EQIWNElfedit: edit to file - [3]
AR2X3TLAInitial commit: introducing elfedit - [4]
5PJAXSZ7Elfedit: correct reallocation of dynstr/dynamic - [5]
ZV57M4VNDebugging - [6]
VZTI2E23Elfedit: handling the case where we move the same section we're adding
Change contents
- replacement in elfedit/src/lib.rs at line 1084
let rounded_last_vaddr = align_next(last_vaddr as usize, page_size);let mut rounded_last_vaddr = align_next(last_vaddr as usize, page_size); - edit in elfedit/src/lib.rs at line 1146[3.9990]→[3.9990:9991](∅→∅),[3.9991]→[3.2413:2549](∅→∅),[3.2549]→[3.10063:10088](∅→∅),[3.10063]→[3.10063:10088](∅→∅)
// Combien de sections du début du fichier doit-on// déplacer à la fin pour ajouter notre nouveau header de// segment ? - edit in elfedit/src/lib.rs at line 1161
// Can we add a new LOAD segment (i.e. is there space// immediately after the program header table?) - replacement in elfedit/src/lib.rs at line 1164
// In the absolute worst case, we need 3 new LOAD// segments: our new one, and then one for each end of// the sequence of sections we need to move to make// room for the program headers.// No space. We will move enough sections to the end// of the file, in order to make room.//// In the worst global case of patching, we need 3 new// LOAD segments://// - two new ones (interp + dynstr)// - possibly an extra one for the initial segments we// need to move - edit in elfedit/src/lib.rs at line 1244
rounded_last_vaddr = rounded_last_vaddr + rounded_moved as usize; - edit in elfedit/src/lib.rs at line 1246
// There is space after the program header table, no// need to move anything. - replacement in elfedit/src/lib.rs at line 1287
self.add_load_segment(id, new_offset, new.len(), last_vaddr as usize, 4, page_size);self.add_load_segment(id, new_offset, new.len(), rounded_last_vaddr as usize, 6, page_size);