Repository navigation
warn when PCRE2 JIT compilation fails - #124
Open
teruteru128 wants to merge 1 commit into
Open
teruteru128 wants to merge 1 commit into
teruteru128 wants to merge 1 commit into
Conversation
JIT failure was silently ignored, leaving matching to run on the much slower interpreter with no indication of it. Warn once, and only when not running quietly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
filters_add()currently discards the result ofpcre2_jit_compile():When that call fails, matching quietly falls back to the interpreter.
DOFILTERrunspcre2_match()once per filter for every key that isgenerated, so this is the hottest path in a PCRE2 build, and nothing
tells the user that it is now running the slow way.
It fails in two situations that are easy to walk into: a PCRE2 built
without JIT support, where every pattern comes back with "bad JIT
option", and a system that refuses the executable mapping JIT needs,
such as a hardened kernel or a W^X policy. Oversized patterns are not
the concern here; the compiler's own "regular expression is too large"
limit is reached first and is already reported.
This warns once, and only when not running quietly, so a filter file
with a thousand patterns still produces a single line. JIT failure stays
non-fatal, and nothing is printed when JIT succeeds.
Tested by forcing
pcre2_jit_compile()to fail with a bad option:one warning is printed for a file with several filters,
-qsuppressesit, and an unmodified build stays silent.