-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ModSecurity 3 no longer compiles with LuaJIT 2.1 #1909
Comments
Hi @mdunc I'm wondering if you are running the latest version and that the configure script correctly ran on your environment setting the flags for LuaJIT correctly? On one of my test environments (Debian 8.9) it compiles and runs fine with LuaJIT:
I would suggest double-checking that other Lua versions (5.1, 5.2, 5.3) are not screwing up the configure script by checking the output of the configure script. |
Hi @victorhora . I am compiling this in Alpine Linux 3.6 as part of a Docker container. The Dockerfile I am using has not been modified in several months and used to work fine (I have also tried Alpine 3.8 with the same results). The luajit and luajit-dev packages are installed (no other Lua versions are installed) then ModSecurity is pulled from Github and built with the following environment variables set:
These are the commands I'm using to build:
That |
This is the configure output:
|
Also, I see from the output you provided that Debian is using LuaJIT 2.0, not 2.1. I haven't gone through the code in LuaJIT, but this is what is causing the conflict in ModSecurity - dee9898#diff-f120b67754e2c3ff8a98d4e3007f12efR111. I had no problems compiling prior to that commit. |
Indeed. LuaJIT 2.1 is breaking. I believe this is due luaL_setfuncs() already being defined in LuaJIT 2.1 (see lauxlib.h#L88). Commit dee9898#diff-f120b67754e2c3ff8a98d4e3007f12efR111 defines this func as it is being used by the Lua engine inside ModSecurity (lua.cc#L138) but it is lacking in Lua 5.1 to make it compatible. It might just need an extra ifdef here dee9898#diff-f120b67754e2c3ff8a98d4e3007f12efR105 to cover for LuaJIT 2.1. |
@mdunc As for:
I've also checked this one and it wasn't necessary on the latest version of Alpine Linux (3.8.1). I did get: Can you maybe try the same on Alpine 3.6 to see if it fixes the issue? Otherwise we can consider including it by default as long as it doesn't break our buildbots or other mainstream distros. Thanks. |
Pull request #1910 should fix this issue. Thanks for the report :) |
There is still a problem when using Luajit-2.1
as /usr/include/lua is a symlink to luajit-2.1 this leads to non-working make.
But at this point the LUA_CFLAGS is already set so the if block is never executed.
|
Hi @StrathCole, Thanks for the report. Can you let us know if your environment have more than one version of Lua (or LuaJIT) installed? Sometimes the configure script can get a bit confused if that's the case. If the issue still persists it would be great if you could provide details on your environment (e.g. distro). Thanks! |
I'm also seeing this problem while trying to use Amazon Linux 2 to build LuaJIT 2.1 with ModSecurity (via ingress-nginx). The workaround: Details:
|
I should note fe98ce4 reverted searching for |
This commit fixes two items: 1. Previously `configure` would search for Lua in known paths, but this could cause the Makefile to use inconsistent header and library paths. For example, if luajit were installed in `/usr/local/include` but lua 5.1 were installed in `/usr/lib/liblua-5.1.so`, the build would attempt to use the luajit headers but link against the lua 5.1 library. To fix this, we switch the order of the search: * First attempt to find an installed LUA library with `pkg-config`. * If we cannot find a library that way, fall back to the known-path scan. This is actually what is already documented in `LUA_POSSIBLE_PATHS`. 2. Add luajit back into `LUA_POSSIBLE_LIB_NAMES`. This was added in 0ac23a4 but quietly reverted in fe98ce4. The changes in the first item also ensure the `CFLAGS` are set properly for luajit. This should fix the issues raised in owasp-modsecurity#1909.
#2718 should help here. |
This commit fixes two items: 1. Previously `configure` would search for Lua in known paths, but this could cause the Makefile to use inconsistent header and library paths. For example, if luajit were installed in `/usr/local/include` but lua 5.1 were installed in `/usr/lib/liblua-5.1.so`, the build would attempt to use the luajit headers but link against the lua 5.1 library. To fix this, we switch the order of the search: * First attempt to find an installed LUA library with `pkg-config`. * If we cannot find a library that way, fall back to the known-path scan. This is actually what is already documented in `LUA_POSSIBLE_PATHS`. 2. Add luajit back into `LUA_POSSIBLE_LIB_NAMES`. This was added in 0ac23a4 but quietly reverted in fe98ce4. The changes in the first item also ensure the `CFLAGS` are set properly for luajit. This should fix the issues raised in owasp-modsecurity#1909.
This commit fixes two items: 1. Previously `configure` would search for Lua in known paths, but this could cause the Makefile to use inconsistent header and library paths. For example, if luajit were installed in `/usr/local/include` but lua 5.1 were installed in `/usr/lib/liblua-5.1.so`, the build would attempt to use the luajit headers but link against the lua 5.1 library. To fix this, we switch the order of the search: * First attempt to find an installed LUA library with `pkg-config`. * If we cannot find a library that way, fall back to the known-path scan. This is actually what is already documented in `LUA_POSSIBLE_PATHS`. 2. Add luajit back into `LUA_POSSIBLE_LIB_NAMES`. This was added in 0ac23a4 but quietly reverted in fe98ce4. The changes in the first item also ensure the `CFLAGS` are set properly for luajit. This should fix the issues raised in owasp-modsecurity#1909.
A recent change in ModSecurity seems to have broken compatibility with LuaJIT (which is compatible with Lua 5.1). The following is the error when compiling:
The text was updated successfully, but these errors were encountered: