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

LibJS+LibCore: Some BSD Compatibility updates #24273

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

ADKaster
Copy link
Member

@ADKaster ADKaster commented May 9, 2024

NetBSD and FreeBSD get upset when we don't set the fd to an invalid
value when using a non-shared mapping.

FreeBSD and NetBSD don't have secure_getenv(3), same as macOS.
FreeBSD 13 and lower also don't allow setting environ pointers to null.

Ref: #23375

cc @0-wiz-0
cc @clausecker

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label May 9, 2024
@ADKaster ADKaster changed the title LibJS+LibCore: Some BSD Compatability updates LibJS+LibCore: Some BSD Compatibility updates May 9, 2024
@clausecker
Copy link
Contributor

Correction: FreeBSD 14 and above do have secure_getenv. All FreeBSD versions allow clearing the environment by setting environ to NULL, but only FreeBSD 14 and above have clearenv.

@ADKaster ADKaster force-pushed the mmap-fd branch 2 times, most recently from 32e794a to f810c77 Compare May 30, 2024 17:27
ADKaster and others added 4 commits June 6, 2024 08:21
NetBSD and FreeBSD get upset when we don't set the fd to an invalid
value when using a non-shared mapping.

Reported-By: Thomas Klausner <wiz@gatalith.at>
FreeBSD and NetBSD don't have secure_getenv(3), same as macOS.
FreeBSD 13 and lower also don't allow setting environ pointers to null.

Co-Authored-By: Robert Clausecker <fuz@FreeBSD.org>
We were already linking librt to LibCore for shm_open and friends.
Now that we build the code that uses POSIX shm into LibCoreMinimal, we
need to link librt into that as well.
On some C libraries, like NetBSD and musl-libc, this under-specified
edge case results in a crash rather than silently ignoring the null
pointer.
@ADKaster ADKaster merged commit 3bb41e9 into SerenityOS:master Jun 6, 2024
10 of 11 checks passed
@ADKaster ADKaster deleted the mmap-fd branch June 6, 2024 15:27
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jun 6, 2024
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.

None yet

2 participants