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

Fix shmfs truncate #215

Merged
merged 3 commits into from
Feb 6, 2024
Merged

Fix shmfs truncate #215

merged 3 commits into from
Feb 6, 2024

Conversation

pussuw
Copy link

@pussuw pussuw commented Feb 6, 2024

No description provided.

@pussuw pussuw requested review from jlaitine and eenurkka February 6, 2024 10:04
up_addrenv_page_wipe can be used to wipe a single page of memory.
When shmfs_truncate is called, it uses shmfs_alloc_object to create the
physical backing for the shm file. However, the allocated physical
memory returned by mm_pgalloc is not cleared when CONFIG_BUILD_KERNEL is
set, which is a clear POSIX violation:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html

"If the file was previously shorter than length, its size is increased,
and the extended area appears as if it were zero-filled."

For FLAT and PROTECTED modes zalloc is used, so the violation affects
KERNEL mode only.
@pussuw pussuw force-pushed the fix_shmfs_truncate branch from 03219ea to 28b41e2 Compare February 6, 2024 10:07
Copy link

@eenurkka eenurkka left a comment

Choose a reason for hiding this comment

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

LGTM!

@pussuw pussuw merged commit 480e853 into master Feb 6, 2024
7 checks passed
@pussuw pussuw deleted the fix_shmfs_truncate branch February 6, 2024 10:48
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