rust-osdev / rust-osdev/bootloader

PhysFrames mapped multiple times?

Open
#131 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
1.7k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

Yeah, stuff gets mapped multiple times. Here is my log output [from an isa-debugcon]:

; STUFF HERE
MAP @ PhysFrame[4KiB](0x5f8000) to Page[4KiB](0xf001f7000)
Now mapping Seg
MAP @ PhysFrame[4KiB](0x5f8000) to Page[4KiB](0xf001f7000)
panicked at 'kernel mapping failed: Mapping(PageAlreadyMapped(PhysFrame[4KiB](0x5f8000)))', src/main.rs:268:6

And it just hangs. So... It seems that sections do NOT have to be 4k-aligned in ELFs. The culprit in my case was .got. Forcing it to stay aligned fixed my problem. But, this should just work and not require custom linker scripts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/main.rs:268 and reproduce the isa-debugcon log showing the same PhysFrame mapped twice. Inspect the ELF section and linker-script handling around the .got section and compare the requested mappings. Done means ELF sections that are not 4 KiB-aligned no longer cause duplicate mappings or a Mapping(PageAlreadyMapped) panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.