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) #80699

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 auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) 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
Copy link
Contributor Author

I guessed at how to backport this since the packaging tests look somewhat different in 7.16, but I didn't guess right it seems. @pugnascotia would you work your magic on the failures here?

@pugnascotia
Copy link
Contributor

It's probably due to security-on-by-default differences. I'll check out the branch and take a look.

@pugnascotia
Copy link
Contributor

@DaveCTurner I pushed a tweak that I think will fix it. I wonder if makes more sense to use a utility like ServerUtils.waitForElasticsearch(Installation) since it abstracts away all the security stuff, and also retries if the HTTP request doesn't work at first, which would make the tests more robust in the face of a slow CI agent. But that can wait for later.

@elasticsearchmachine elasticsearchmachine merged commit 9acb783 into elastic:7.16 Nov 15, 2021
@DaveCTurner DaveCTurner deleted the 2021-11-15-backport-80651-7.16 branch November 18, 2021 12:07
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 v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants