Hello,
My sincerest apologies if this question is malformed, misplaced, or mistaken in some way.
I am inexperienced with Genode, but have been exploring it for a number of personal projects. The one I am currently working on is creating a minimal sculpt-like OS to replace the default Android 4.2 operating system on a rugged 4G Sonim XP5700 phone to serve as a platform for further Genode exploration and IoT projects.
To test the viability of this, I have been using Claude Opus 4.7/4.8 to accelerate working through creating a port for the msm8226/msm8926 SoC and phone platform. It has been largely successful so far, but hit a snag when implementing the file system service. This was its report:
``` part_block has a real bug for this device's GPT: the parse loop (gpt.h:373) runs to a hardcoded MAX_PARTITIONS=128, but this Qualcomm GPT declares fewer entry slots, so the entry-array buffer (sized to the header's actual entries(), gpt.h:363) overruns once i passes the real count. (_calculate_used at gpt.h:342 already correctly bounds by entries() — only the parse loop doesn't.) The one-line fix is to bound the parse loop by min(entries(), MAX_PARTITIONS). ```
And its recommended fix, which successfully resolved the issue:
``` diff --git a/repos/os/src/server/part_block/gpt.h b/repos/os/src/server/part_block/gpt.h index dbe9128e01..3539024cfb 100644 --- a/repos/os/src/server/part_block/gpt.h +++ b/repos/os/src/server/part_block/gpt.h @@ -370,7 +370,17 @@ class Block::Gpt : public Block::Partition_table _gpt_total = (gpt.part_lba_end() - gpt.part_lba_start()) + 1; _gpt_used = _calculate_used(gpt, entries, gpt.entries());
- for (int i = 0; i < MAX_PARTITIONS; i++) { + /* + * Iterate only over the entries the header actually declares -- + * a GPT may advertise fewer slots than MAX_PARTITIONS (e.g. the + * Qualcomm MSM8226 eMMC declares < 128), and the entry-array + * buffer above is sized to gpt.entries(); walking to MAX_PARTITIONS + * unconditionally overruns it (Mmio Range_violation). This matches + * the bound already used by _calculate_used(). + */ + unsigned const num_entries = min(gpt.entries(), + (uint32_t)MAX_PARTITIONS); + for (unsigned i = 0; i < num_entries; i++) {
Gpt_entry e(entries.range_at(i * gpt.entry_size())); ```
I am not sure of what the stance is on AI generated code or how well-documented pull requests need to be before creation, and I do not yet have the ability to test this change in a comprehensive way. I would love to contribute in any way I can, but am not yet certain of whether I have the tools or knowledge to do so correctly yet.
I would greatly appreciate any feedback or advice, and thank you for your time and consideration regardless. This has been a remarkable project to learn about so far.
Thanks, Ryan Davidovics