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

GRUB module loading corruption #374

Closed
marysaka opened this issue Jul 12, 2019 · 7 comments
Closed

GRUB module loading corruption #374

marysaka opened this issue Jul 12, 2019 · 7 comments
Assignees
Labels
help wanted Extra attention is needed project-kernel Related to the kernel type-bug Something isn't working

Comments

@marysaka
Copy link
Member

This memory corruption only occurs while loading vi and can be reproduced on PR #360 .

@marysaka marysaka added type-bug Something isn't working help wanted Extra attention is needed project-kernel Related to the kernel labels Jul 12, 2019
@roblabla
Copy link
Member

d9c80bf is the commit that's affected (in case PR gets force pushed)

@Orycterope
Copy link
Member

Can you give a description of the problem ?

@Orycterope Orycterope self-assigned this Jul 21, 2019
@Orycterope
Copy link
Member

This bug is definitely present on master.

Haven't bisect yet, but reverting last xmas_elf update fixes the problem: 014dc18 (Jun 15 !)

I would like to investigate and report the bug to xmas_elf, but in the mean time I'm going to make a PR doing the revert.

Orycterope added a commit to Orycterope/SunriseOS that referenced this issue Jul 21, 2019
This reverts commit 014dc18.

Addressing sunriseos#374

xmas_elf does an out of bound access when loading vi, causing a kernel panic.

Reverting the last update of xmas_elf seems to fix the problem, use this until we figure out where this bug comes from.
@Orycterope Orycterope changed the title Memory corruption in Kernel ELF loader xmas_elf OOB access in Kernel ELF loader Jul 21, 2019
@Orycterope
Copy link
Member

I was wrong, reverting xmas_elf update does no solve the problem. On some branches it seems to sometime disappear when doing a full rebuild of sunrise, hinting toward an incremental compilation problem.

For now I still believe this is a xmas_elf bug, and sunrise is not responsible for it. To prove my theory I'm going to try to replicate the OOB in a std crate that just tries to parse the "faulty" vi elf with xmas_elf.

@roblabla
Copy link
Member

roblabla commented Jul 25, 2019

@Thog found the problem: it's in mkiso-rs.

Once the bug is found, we should add a test to the CI that the generated ISO is correct by mounting the ISO and checking all the files.

EDIT: Such a test would not actually have found the problem, since the ISO filesystem seems to be OK. The El Torrito is apparently broken.

@marysaka
Copy link
Member Author

GRUB2 seems to not like the way my files were allocated, this should be fixed by the last release of mkisofs-rs. Please make sure to update it.

@Orycterope
Copy link
Member

Updated mkisofs-rs, diffed every module loaded by grub against their original elf, everything seems to be in order now.

I'm closing the issue.

@Orycterope Orycterope changed the title xmas_elf OOB access in Kernel ELF loader GRUB module loading corruption Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed project-kernel Related to the kernel type-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants