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

Set LIBFFI_TMPDIR at startup (#80651) #80698

Merged

Conversation

DaveCTurner
Copy link
Contributor

Today if libffi cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default libffi won't find this
directory and will try various other places. In certain configurations,
none of the other places that libffi tries are suitable. With older
versions of JNA this would result in a SIGSEGV; since #80617 the JVM
will exit with an exception.

With this commit we use the LIBFFI_TMPDIR environment variable to
configure libffi to use the same directory as JNA for its temporary
files if they are needed.

Closes #18272
Closes #73309
Closes #74545
Closes #77014
Closes #77053
Relates #77285

Co-authored-by: Rory Hunter roryhunter2@gmail.com

Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since elastic#80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes elastic#18272
Closes elastic#73309
Closes elastic#74545
Closes elastic#77014
Closes elastic#77053
Relates elastic#77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
@DaveCTurner DaveCTurner added :Core/Infra/Core Core issues without another label backport v8.0.0 labels Nov 15, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Nov 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@DaveCTurner DaveCTurner added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Nov 15, 2021
@elasticsearchmachine elasticsearchmachine merged commit 7361d39 into elastic:8.0 Nov 15, 2021
@DaveCTurner DaveCTurner deleted the 2021-11-15-backport-80651-8.0 branch November 15, 2021 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v8.0.0-rc1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants