This repository was archived by the owner on Jan 10, 2025. It is now read-only.
mmap: fd should be -1 when creating anonymous mappings#508
Merged
alessandrod merged 1 commit intosolana-labs:mainfrom Sep 3, 2023
Merged
mmap: fd should be -1 when creating anonymous mappings#508alessandrod merged 1 commit intosolana-labs:mainfrom
alessandrod merged 1 commit intosolana-labs:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #508 +/- ##
==========================================
- Coverage 89.62% 89.62% -0.01%
==========================================
Files 23 23
Lines 10297 10294 -3
==========================================
- Hits 9229 9226 -3
Misses 1068 1068
|
alessandrod
approved these changes
Sep 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allocating anonymous with mmap() should have fd set to -1 in conforming code (as 0 is a valid value for a file descriptor).
Linux is forgiving about this however other OS's (FreeBSD) less so.
This trivial change fixes BPF programs on Solana/FreeBSD which are currently broken by this.
I have copied an extract from the linux 2 mmap page for reference below.