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

Utils/FileLoading: Fix LoadFileImpl #4218

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

Sonicadvance1
Copy link
Member

It is not an error that pread returns /less/ than what was requested. In fact it's very common for the Linux kernel to return less than the data requested from procfs.

procfs keeps coming back to bite this function, previously it was fstat returning size of 0 which it hit. Now it only feeds data as much as it wants per loop. In particular /proc/self/maps would only read ~3k bytes on my system, but not be complete.

To fully fix the issue, always make sure to keep reading until there is either an error OR zero is reached!

It is not an error that pread returns /less/ than what was requested. In
fact it's very common for the Linux kernel to return less than the data
requested from procfs.

procfs keeps coming back to bite this function, previously it was fstat
returning size of 0 which it hit. Now it only feeds data as much as it
wants per loop. In particular /proc/self/maps would only read ~3k bytes
on my system, but not be complete.

To fully fix the issue, always make sure to keep reading until there is
either an error OR zero is reached!
Copy link
Contributor

@lioncash lioncash left a comment

Choose a reason for hiding this comment

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

oof, nice catch!

@lioncash lioncash merged commit 527752c into FEX-Emu:main Dec 14, 2024
12 checks passed
@Sonicadvance1 Sonicadvance1 deleted the fix_file_loading branch December 14, 2024 03:57
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.

2 participants