git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 0/2] fallback to interpreter if JIT fails with pcre

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Dec 9, 2018, 23:00 UTC
Message-ID
<20181209230024.43444-1-carenas@gmail.com>

while testing in NetBSD 8, was surprised to find that most test cases using PCRE2 where failing with some cryptic error from git :

  fatal: Couldn't JIT the PCRE2 pattern '$PATTERN', got '-48'

interestingly enough, using a JIT enabled PCRE1 library (not the default) will show a similar error but a different error code.

the underlying problem is the same though; NetBSD includes PAX support which restricts the use of memory that is both writeable and executable and that prevents the JIT to create a compiled expression to jump into, and while the "fix" for NetBSD is simple it would seem the user experience could be improved if instead of aborting, git will instead return the matches using the slower interpreter (which seem to be also the recomendation from the library developers)

it is important to note that the problem is not unique to NetBSD and had reproduced it in OpenBSD where working around the issue is more complicated as WˆX exceptions require a filesystem mount option, and I can see it being problematic with linux (as shown by the open bug[1] and the development of an alternative allocator to workaround the issue with seLinux) and with macOS (specially versions older than 10.14) where there are restrictions to the number of maps allowed with those flags.

I am also curious if expanding NO_LIBPCRE1_JIT as an option to disable JIT with PCRE2 (with a different name) might be worth pursuing? as well as some ways to narrow the failures that will trigger the fallback, but the later is likely to need library changes which might not be possible with the old version anyway.

[1] https://bugs.exim.org/show_bug.cgi?id=1749
Carlo Marcelo Arenas Belón (2):
  grep: fallback to interpreter if JIT fails with pcre1
  grep: fallback to interpreter if JIT fails with pcre2
 Makefile | 12 ++++++------
 grep.c   | 13 +++++++++++--
 2 files changed, 17 insertions(+), 8 deletions(-)
-- 
2.20.0
Next: Carlo Marcelo Arenas Belón
Message 1 of 13 in “fallback to interpreter if JIT fails with pcre”
  1. 0/2 fallback to interpreter if JIT fails with pcreCarlo Marcelo Arenas Belón, Dec 9, 2018
  2. 1/2 grep: fallback to interpreter if JIT fails with pcre1Carlo Marcelo Arenas Belón, Dec 9, 2018
  3. Ævar Arnfjörð BjarmasonDec 9, 2018
  4. brian m. carlsonDec 10, 2018
  5. Carlo ArenasDec 10, 2018
  6. Junio C HamanoDec 10, 2018
  7. Ævar Arnfjörð BjarmasonDec 10, 2018
  8. Carlo ArenasDec 11, 2018
  9. Ævar Arnfjörð BjarmasonDec 11, 2018
  10. Junio C HamanoDec 10, 2018
  11. Junio C HamanoDec 10, 2018
  12. 2/2 grep: fallback to interpreter if JIT fails with pcre2Carlo Marcelo Arenas Belón, Dec 9, 2018
  13. Junio C HamanoDec 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.