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

problem with non-JIT pcre2 #100

Closed
0-wiz-0 opened this issue Sep 30, 2016 · 5 comments
Closed

problem with non-JIT pcre2 #100

0-wiz-0 opened this issue Sep 30, 2016 · 5 comments
Labels

Comments

@0-wiz-0
Copy link

0-wiz-0 commented Sep 30, 2016

ucg compiled with pcre seems to work fine.
When compiled with pcre2-10.22, it builds fine but fails for me at runtime with:

path/to/ucg -r pcre path/to/ucg-source
/ucg: error: Error during regex parsing: PCRE2 JIT compilation error: bad JIT option

Not sure what this is about (and there's a weird '/' at the start of the line).
ucg --version output:

Compiler info:
 Name ($(CXX)): c++ -std=gnu++11
 Version string: "g++ (nb1 20160606) 5.4.0"

ISA extensions in use:
 sse4.2: yes
 popcnt: yes

libpcre info:
 Not linked against libpcre.

libpcre2-8 info:
 Version: 10.22 2016-07-29
 JIT support built in?: no
 JIT target architecture: none
 Newline style: LF

pcre2's self tests run fine.

@gvansickle
Copy link
Owner

Hi @0-wiz-0 ,
Does this happen with any regex/literal, or just with 'pcre'. I.e., does it work at all for you with PCRE2?

@0-wiz-0
Copy link
Author

0-wiz-0 commented Sep 30, 2016

This also happens with real regex, like:

ucg -r univ.*code.*rep path/to/ucg
/ucg: error: Error during regex parsing: PCRE2 JIT compilation error: bad JIT option

@gvansickle
Copy link
Owner

Oh, wait:

libpcre2-8 info:
 Version: 10.22 2016-07-29
 JIT support built in?: no
 JIT target architecture: none

No JIT is almost certainly the problem. Does NetBSD have a JIT-enabled PCRE2 available via its package manager or some other reasonable means?

The question of whether to support a no-JIT PCRE/PCRE2 or not has been nagging at me for some time. It's part of the secret sauce that makes ucg "Faster Than Grep"(tm) in its target use cases. Conversely, having a completely non-working ucg benefits nobody....

@0-wiz-0
Copy link
Author

0-wiz-0 commented Sep 30, 2016

I've just built pcre2 with JIT support, and ucg now works fine both with strings and actual regexp.
Perhaps you can improve the error handling in this case :-)

One other issue: on a PaX MPROTECT system, ucg built this way needs to be marked as not MPROTECT safe. On NetBSD this is done by calling 'paxctl +m ucg' after the build is finished. (see http://netbsd.gw.com/cgi-bin/man-cgi?paxctl++NetBSD-current)
On Linux, it's done using 'paxctl -m ucg' (see https://wiki.gentoo.org/wiki/Hardened/PaX_Quickstart#paxctl).
This is a property of the file, so it can be done before installation or after (but take care that the real binary, and not a libtool shell wrapper script, is the target).

@gvansickle
Copy link
Owner

Hi again @0-wiz-0 ,

I've just built pcre2 with JIT support, and ucg now works fine both with strings and actual regexp.
Perhaps you can improve the error handling in this case :-)

Indeed. I think I've decided that I should require a JIT-enabled PCRE/PCRE2 at configure-time, which would eliminate this as an error.

One other issue: on a PaX MPROTECT system, ucg built this way needs to be marked as not MPROTECT safe.

Yeah, I've been wondering when I was going to run into issues with JIT vs. the NX bit. Thanks for the info; I'll file a separate issue for that.

@gvansickle gvansickle changed the title problem with pcre2 problem with non-JIT pcre2 Oct 1, 2016
@gvansickle gvansickle added the bug label Oct 1, 2016
gvansickle added a commit that referenced this issue Oct 6, 2016
gvansickle added a commit that referenced this issue Oct 6, 2016
…kle/ucg into bug/ISSUE100-NonJITPCRE2

* 'bug/ISSUE100-NonJITPCRE2' of https://github.com/gvansickle/ucg:
  Updated NEWS.md for issue #100.
gvansickle added a commit that referenced this issue Oct 7, 2016
* master: (44 commits)
  Updated NEWS.md for issue #100.
  Comment on OSX 10.11.
  Removed OSX 10.11 from rotation due to stty issues from #103.
  Put stty raw back for linux-style script.  Trying to get travis to pull down a pcre2 for trusty.
  Travis change to add pcre2 to linux builds.
  Travis.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  Interim.
  testsuite, capturing intermediate files.
  script workaround for some OSX distro versions.
  Interim.
  printf portability fix.
  ...

# Conflicts:
#	src/libext/filesystem.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants