Skip to content
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

Support dynamic relocation in libuser #247

Merged
merged 4 commits into from
Apr 19, 2019

Conversation

marysaka
Copy link
Member

@marysaka marysaka commented Apr 5, 2019

This makes every userland programs position-independent.

This PR also correctly separates every section in its appropriate segment.

@todo
Copy link

todo bot commented Apr 5, 2019

ASLR

https://github.com/roblabla42/KFS/blob/7e9cc27c45e6af314162914dc8173d76c3fa1b84/kernel/src/elf_loader.rs#L110-L114


This comment was generated by todo based on a TODO comment in 7e9cc27 in #247. cc @Thog.

@todo
Copy link

todo bot commented Apr 5, 2019

ASLR

https://github.com/roblabla42/KFS/blob/7e9cc27c45e6af314162914dc8173d76c3fa1b84/kernel/src/elf_loader.rs#L137-L144


This comment was generated by todo based on a TODO comment in 7e9cc27 in #247. cc @Thog.

@todo
Copy link

todo bot commented Apr 5, 2019

runtime-generated module object offset for rtld

https://github.com/roblabla42/KFS/blob/7e9cc27c45e6af314162914dc8173d76c3fa1b84/libuser/src/lib.rs#L115-L125


This comment was generated by todo based on a TODO comment in 7e9cc27 in #247. cc @Thog.

@todo
Copy link

todo bot commented Apr 5, 2019

check error

https://github.com/roblabla42/KFS/blob/7e9cc27c45e6af314162914dc8173d76c3fa1b84/libuser/src/lib.rs#L247-L257


This comment was generated by todo based on a TODO comment in 7e9cc27 in #247. cc @Thog.

@roblabla
Copy link
Member

roblabla commented Apr 5, 2019

I'm curious: Does this fix vi being huge because of the .bss being allocated in the file?

@marysaka
Copy link
Member Author

marysaka commented Apr 5, 2019

@roblabla yuuup
image

Copy link
Member

@roblabla roblabla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! The module and relocation stuff should probably move to a separate module, just to keep things clean.

libuser/src/lib.rs Outdated Show resolved Hide resolved
shell/src/main.rs Show resolved Hide resolved
Copy link
Member

@Orycterope Orycterope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !

i386-unknown-none-user.json Outdated Show resolved Hide resolved
i386-unknown-none-user.json Show resolved Hide resolved
Makefile.toml Outdated Show resolved Hide resolved
i386-unknown-none-user.json Outdated Show resolved Hide resolved
libuser/src/lib.rs Outdated Show resolved Hide resolved
libuser/src/lib.rs Outdated Show resolved Hide resolved
libuser/src/lib.rs Outdated Show resolved Hide resolved
linker-scripts/userspace.ld Show resolved Hide resolved
kernel/src/elf_loader.rs Show resolved Hide resolved
libuser/src/lib.rs Outdated Show resolved Hide resolved
@Orycterope
Copy link
Member

As I understand (your PR comment wasn't really explicit), this makes kernel builtins illegible for ASLR. But wouldn't relocations for every other userspace programs be handled by the process loader service on behalf of the starting process, instead of having it relocate itself ?

This means the _start will be different for a builtin and a regular process, but they both use libuser. We might want to add some conditional compilation in libuser for that.

@Orycterope
Copy link
Member

Hum ... Travis still hasn't responded yet, and Mergeable isn't even here. I think they didn't like the repository transfer. @roblabla can you do something about your mergeable bot ?

@Orycterope
Copy link
Member

Forcing travis rebuild: closing and reopening PR

@Orycterope
Copy link
Member

Closes #216

@marysaka
Copy link
Member Author

marysaka commented Apr 8, 2019

Rebased

@marysaka marysaka requested a review from Orycterope April 8, 2019 22:01
Copy link
Member

@Orycterope Orycterope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

libuser/src/crt0/mod.rs Outdated Show resolved Hide resolved
libuser/src/crt0/relocation.rs Show resolved Hide resolved
Copy link
Member

@roblabla roblabla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

kernel/src/elf_loader.rs Outdated Show resolved Hide resolved
LLD now generate less weird binaries.

This will help for dynamic linking and thread locals.
@roblabla roblabla merged commit 426c0b2 into sunriseos:master Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants