Skip to content

Fix FreeBSD minherit arg naming#3694

Merged
lrstewart merged 4 commits intoaws:mainfrom
lrstewart:inheritzero
Dec 8, 2022
Merged

Fix FreeBSD minherit arg naming#3694
lrstewart merged 4 commits intoaws:mainfrom
lrstewart:inheritzero

Conversation

@lrstewart
Copy link
Copy Markdown
Contributor

Resolved issues:

resolves #3674

Description of changes:

Handle the case where minherit takes "INHERIT_ZERO" instead of "MAP_INHERIT_ZERO".

Callouts

This test duplicates a couple typo fixes from #3670, since that PR deals with OpenBSD, which also hits the path with the typos.

Testing:

I added a basic test for two OSes we know should support minherit, one that uses MAP_INHERIT_ZERO (OpenBSD) and one that uses INHERIT_ZERO (FreeBSD). The OpenBSD version of the test won't get executed until we add an OpenBSD build to the CI, which is blocked by #3670.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Dec 7, 2022
@lrstewart lrstewart marked this pull request as ready for review December 7, 2022 10:39
#endif

/* Sometimes (for example, on FreeBSD) MAP_INHERIT_ZERO is called INHERIT_ZERO */
#if !defined(MAP_INHERIT_ZERO) && defined(INHERIT_ZERO)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, this is one way of doing it. But it breaks a bit if there is a third *BSD calling it INHERIT_ZERO_MAP (or whatever different name)... But I'm not sure what the prettiest way of handling this is anyway...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think there can be a pretty way to handle all possible names. We would just have to add another check for a third name. The best we can do is decide on one name our code uses (MAP_INHERIT_ZERO) and translate all other names to that so that later code can just assume MAP_INHERIT_ZERO.

@lrstewart lrstewart enabled auto-merge (squash) December 7, 2022 23:07
@lrstewart lrstewart merged commit f3378e8 into aws:main Dec 8, 2022
@lrstewart lrstewart deleted the inheritzero branch December 8, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve FreeBSD fork detection

5 participants