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

compile options #520

Open
jmbnyc opened this issue Oct 8, 2024 · 5 comments
Open

compile options #520

jmbnyc opened this issue Oct 8, 2024 · 5 comments

Comments

@jmbnyc
Copy link

jmbnyc commented Oct 8, 2024

Is it a requirement to compile pcre2 source code with -mshstk (shadow stack)?

@zherczeg
Copy link
Collaborator

zherczeg commented Oct 8, 2024

No. Is there a project where it is a requirement?

@jmbnyc
Copy link
Author

jmbnyc commented Oct 8, 2024

No requirement at all inside my code.
I asked because after generating pcre2 Makefile (from version 10.44) I noticed the following:

echo " CC " src/libpcre2_8_la-pcre2_compile.lo;/bin/bash ./libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I./src "-I./src" -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden -mshstk -O2 -MT src/libpcre2_8_la-pcre2_compile.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_compile.Tpo -c -o src/libpcre2_8_la-pcre2_compile.lo test -f 'src/pcre2_compile.c' || echo './'src/pcre2_compile.c

The presence of -mshstk caught my eye and was wondering if it is a required flag. I am thinking of pulling the pcre2 source directly into my binary (no library) and thus need to provide the appropriate compile flags and we currently do not have -mshstk as a compile option and I'd like to keep it that way.

@PhilipHazel
Copy link
Collaborator

That's odd. A simple ./configure on 10.44 gives just this:

C compiler flags ................... : -O2 -fvisibility=hidden

@NWilson
Copy link
Contributor

NWilson commented Oct 9, 2024

There's this in the changelog:

Version 10.36 04-December-2020

  1. Add CET_CFLAGS so that when Intel CET is enabled, pass -mshstk to
    compiler. This fixes https://bugs.exim.org/show_bug.cgi?id=2578. Patch for
    Makefile.am and configure.ac by H.J. Lu. Equivalent patch for CMakeLists.txt
    invented by PH.

I guess the user is using Intel CET?

@zherczeg
Copy link
Collaborator

zherczeg commented Oct 9, 2024

Shadow stack can be used as a security feature, and even jit supports it. Although I never tested it, the code was a contribution from Intel.

However, it is not a mandatory feature for PCRE2, and there is no reason to be that way, ever.

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

No branches or pull requests

4 participants