git: bd98a274d0ed - stable/12 - flua: don't allow dlopen, et al., for bootstrap flua

Kyle Evans kevans at FreeBSD.org
Sun Jan 24 03:43:52 UTC 2021


The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=bd98a274d0edbf596c40435335a37282adaebdb0

commit bd98a274d0edbf596c40435335a37282adaebdb0
Author:     Kyle Evans <kevans at FreeBSD.org>
AuthorDate: 2020-08-14 02:22:19 +0000
Commit:     Kyle Evans <kevans at FreeBSD.org>
CommitDate: 2021-01-24 03:43:26 +0000

    flua: don't allow dlopen, et al., for bootstrap flua
    
    There are some logistics issues that need to be sorted out here before we
    can actually allow this to work.
    
    It's not really safe to allow LUA_USE_DLOPEN with host lib paths being used.
    The host system could have an entirely different lua version and this could
    cause us to crash and burn.
    
    If we want to revive this later, we need to make sure to define c module
    paths inside OBJDIR that are compiled against whatever version we've
    bootstrapped.
    
    (cherry picked from commit c2a2b4f3cf11e770892a524df637f671f5989719)
    (cherry picked from commit 967fbfd9e2b7a015d5cba1491badcdf9044b28b9)
---
 lib/liblua/Makefile   | 2 ++
 lib/liblua/luaconf.h  | 2 ++
 libexec/flua/Makefile | 3 +--
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/liblua/Makefile b/lib/liblua/Makefile
index 28fc05a9aa71..e5f5e3c5960a 100644
--- a/lib/liblua/Makefile
+++ b/lib/liblua/Makefile
@@ -29,6 +29,8 @@ CFLAGS+=	-DLUA_PROGNAME="\"${PROG}\""
 .if defined(BOOTSTRAPPING)
 CFLAGS+=	-DLUA_PATH_DEFAULT="\"/nonexistent/?.lua\""
 CFLAGS+=	-DLUA_CPATH_DEFAULT="\"/nonexistent/?.so\""
+# We don't support dynamic libs on bootstrap builds.
+CFLAGS+=	-DBOOTSTRAPPING
 .endif
 
 .include <bsd.lib.mk>
diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h
index 6226e8ab1e84..bc7f5bb6e141 100644
--- a/lib/liblua/luaconf.h
+++ b/lib/liblua/luaconf.h
@@ -75,8 +75,10 @@
 /* Local modifications: need io.popen */
 #ifdef __FreeBSD__
 #define LUA_USE_POSIX
+#ifndef BOOTSTRAPPING
 #define LUA_USE_DLOPEN
 #endif
+#endif
 
 /*
 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile
index 373f93cbf176..0cd8ca924495 100644
--- a/libexec/flua/Makefile
+++ b/libexec/flua/Makefile
@@ -30,8 +30,7 @@ CFLAGS+=	-DLUA_PROGNAME="\"${PROG}\""
 CFLAGS+=	-DLUA_USE_READLINE
 CFLAGS+=	-I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit
 LIBADD+=	edit
-.endif
-
 LDFLAGS+=	-Wl,-E
+.endif
 
 .include <bsd.prog.mk>


More information about the dev-commits-src-branches mailing list