Commit 9dee7e8
committed
Probe JIT availability at runtime
SELinux or PaX/grsecurity based kernels may deny creating writable and
executable mappings, leading to errors when trying to allocate JIT
memory, even though JIT support is generally available. Instead of
failing hard in this case, allow to use the interpreter fallback by
probing and announcing the availability of JIT mode at runtime through
the PCRE2_CONFIG_JIT hook.
This only happens for configurations using only the default JIT memory
allocator, i.e. not the SELinux aware one. However, we still mark the
latter as experimental and distributions like Debian don't enable it.
The current behaviour leads to nasty user visible errors on such
systems, e.g. when running 'git grep':
$ git grep peach
fatal: Couldn't JIT the PCRE2 pattern 'peach', got '-48'
With this change in place, it'll fall back to the interpreter and "just
work", providing a much more pleasant user experience.
Signed-off-by: Mathias Krause <[email protected]>1 parent c833353 commit 9dee7e8
3 files changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1992 | 1992 | | |
1993 | 1993 | | |
1994 | 1994 | | |
| 1995 | + | |
1995 | 1996 | | |
1996 | 1997 | | |
1997 | 1998 | | |
| |||
2019 | 2020 | | |
2020 | 2021 | | |
2021 | 2022 | | |
| 2023 | + | |
2022 | 2024 | | |
2023 | 2025 | | |
2024 | 2026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
200 | 215 | | |
201 | 216 | | |
202 | 217 | | |
| |||
0 commit comments