Skip to content

Add allocator check to pcre2_jit_compile #433

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

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

zherczeg
Copy link
Collaborator

No description provided.

@zherczeg
Copy link
Collaborator Author

Return value options for pcre2_jit_compile(NULL, PCRE2_JIT_TEST_ALLOC)

  • 0 : JIT is compiled, and has a working allocator
  • PCRE2_ERROR_NOMEMORY : JIT is compiled, but cannot allocate executable memory
  • PCRE2_ERROR_NULL : JIT is not compiled

@PhilipHazel PhilipHazel merged commit 68b0258 into PCRE2Project:master Jul 23, 2024
11 checks passed
@PhilipHazel
Copy link
Collaborator

I will update the documentation and add something to pcre2test.

@PhilipHazel
Copy link
Collaborator

I have now done that in commit 4249b67.

@zherczeg zherczeg deleted the alloc_check branch July 24, 2024 13:56
@zherczeg
Copy link
Collaborator Author

Thank you!

gstrauss added a commit to gstrauss/lighttpd1.4 that referenced this pull request Aug 7, 2024
omit pcre2 JIT error trace if JIT not available due to system
restrictions

https://www.spinics.net/lists/git/msg452824.html
Under Linux systems with SELinux's 'deny_execmem' or PaX's MPROTECT
enabled, the allocation of PCRE2's JIT rwx memory may be prohibited,
making pcre2_jit_compile() fail with PCRE2_ERROR_NOMEMORY (-48)

PCRE2 10.45 adds PCRE2_JIT_TEST_ALLOC to test if JIT is available.
PCRE2Project/pcre2#433

(With this patch, lighttpd omits trace for PCRE2 < 10.45 if JIT is
 available but the pattern is crazy and pcre2_jit_compile() fails.
 However, 'ok' to proceed since the pattern successfully compiled
 with pcre2_compile(), though might execute more slowly than with JIT.)
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.

2 participants