From eaee7a0ebead5ac92056ae7903a34b625bf461cb Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 7 Oct 2021 08:19:11 -0600 Subject: [PATCH] Fix fuzzer build with when --enable-static-sudoers is used. This introduces a sudoers-specific version of LT_STATIC instead of appending the --tag=disable-shared to SUDOERS_LDFLAGS. I've also removed the -static flag as it should not be needed. --- configure | 105 +++--------------------------------- configure.ac | 8 +-- plugins/sudoers/Makefile.in | 6 +-- 3 files changed, 14 insertions(+), 105 deletions(-) diff --git a/configure b/configure index a17ebdb8c..19c7e4c4a 100755 --- a/configure +++ b/configure @@ -855,6 +855,7 @@ SUDOERS_LIBS SUDO_LIBS SUDO_OBJS SUDOERS_OBJS +SUDOERS_LT_STATIC COMMON_OBJS LT_DEP_LIBS LT_STATIC @@ -3559,6 +3560,7 @@ ac_config_headers="$ac_config_headers config.h pathnames.h" + # @@ -28856,74 +28858,10 @@ case "$lt_cv_dlopen" in SUDO_OBJS="${SUDO_OBJS} preload.o" STATIC_SUDOERS="\$(top_builddir)/plugins/sudoers/sudoers.la" - -if test ${SUDOERS_LDFLAGS+y} -then : - - case " $SUDOERS_LDFLAGS " in #( - *" --tag=disable-shared "*) : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS already contains --tag=disable-shared"; } >&5 - (: SUDOERS_LDFLAGS already contains --tag=disable-shared) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } ;; #( - *) : - - as_fn_append SUDOERS_LDFLAGS " --tag=disable-shared" - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; -esac - -else $as_nop - - SUDOERS_LDFLAGS=--tag=disable-shared - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - -fi - - -if test ${SUDOERS_LDFLAGS+y} -then : - - case " $SUDOERS_LDFLAGS " in #( - *" -static "*) : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS already contains -static"; } >&5 - (: SUDOERS_LDFLAGS already contains -static) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } ;; #( - *) : - - as_fn_append SUDOERS_LDFLAGS " -static" - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; -esac - -else $as_nop - - SUDOERS_LDFLAGS=-static - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - -fi - + SUDOERS_LT_STATIC="--tag=disable-shared" LT_STATIC="" else + SUDOERS_LT_STATIC="--tag=disable-static" LT_STATIC="--tag=disable-static" fi ;; @@ -28936,39 +28874,6 @@ fi SUDO_OBJS="${SUDO_OBJS} preload.o" STATIC_SUDOERS="\$(top_builddir)/plugins/sudoers/sudoers.la" -if test ${SUDOERS_LDFLAGS+y} -then : - - case " $SUDOERS_LDFLAGS " in #( - *" --tag=disable-shared "*) : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS already contains --tag=disable-shared"; } >&5 - (: SUDOERS_LDFLAGS already contains --tag=disable-shared) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } ;; #( - *) : - - as_fn_append SUDOERS_LDFLAGS " --tag=disable-shared" - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; -esac - -else $as_nop - - SUDOERS_LDFLAGS=--tag=disable-shared - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : SUDOERS_LDFLAGS=\"\$SUDOERS_LDFLAGS\""; } >&5 - (: SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - -fi - - if test ${SUDOERS_LDFLAGS+y} then : @@ -29001,8 +28906,10 @@ else $as_nop fi + SUDOERS_LT_STATIC="--tag=disable-shared" LT_STATIC="" else + SUDOERS_LT_STATIC="--tag=disable-static" LT_STATIC="--tag=disable-static" fi ;; diff --git a/configure.ac b/configure.ac index 0385de1ad..c6958f9b4 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ AC_SUBST([LT_LDEXPORTS]) AC_SUBST([LT_STATIC]) AC_SUBST([LT_DEP_LIBS]) AC_SUBST([COMMON_OBJS]) +AC_SUBST([SUDOERS_LT_STATIC]) AC_SUBST([SUDOERS_OBJS]) AC_SUBST([SUDO_OBJS]) AC_SUBST([LIBS]) @@ -4266,10 +4267,10 @@ case "$lt_cv_dlopen" in AC_DEFINE(STATIC_SUDOERS_PLUGIN) SUDO_OBJS="${SUDO_OBJS} preload.o" STATIC_SUDOERS="\$(top_builddir)/plugins/sudoers/sudoers.la" - AX_APPEND_FLAG([--tag=disable-shared], [SUDOERS_LDFLAGS]) - AX_APPEND_FLAG([-static], [SUDOERS_LDFLAGS]) + SUDOERS_LT_STATIC="--tag=disable-shared" LT_STATIC="" else + SUDOERS_LT_STATIC="--tag=disable-static" LT_STATIC="--tag=disable-static" fi ;; @@ -4279,10 +4280,11 @@ case "$lt_cv_dlopen" in AC_DEFINE(STATIC_SUDOERS_PLUGIN) SUDO_OBJS="${SUDO_OBJS} preload.o" STATIC_SUDOERS="\$(top_builddir)/plugins/sudoers/sudoers.la" - AX_APPEND_FLAG([--tag=disable-shared], [SUDOERS_LDFLAGS]) AX_APPEND_FLAG([-static], [SUDOERS_LDFLAGS]) + SUDOERS_LT_STATIC="--tag=disable-shared" LT_STATIC="" else + SUDOERS_LT_STATIC="--tag=disable-static" LT_STATIC="--tag=disable-static" fi ;; diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index 9472d3d7b..aef210d49 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -165,7 +165,7 @@ LIB_FUZZING_ENGINE = @FUZZ_ENGINE@ FUZZ_PROGS = fuzz_policy fuzz_sudoers fuzz_sudoers_ldif FUZZ_SEED_CORPUS = ${FUZZ_PROGS:=_seed_corpus.zip} FUZZ_LIBS = libparsesudoers.la @SUDOERS_LIBS@ $(LIB_FUZZING_ENGINE) -FUZZ_LDFLAGS = @LDFLAGS@ @SUDOERS_LDFLAGS@ +FUZZ_LDFLAGS = @SUDOERS_LDFLAGS@ FUZZ_MAX_LEN = 4096 FUZZ_RUNS = 8192 @@ -334,9 +334,9 @@ libparsesudoers.la: $(LIBPARSESUDOERS_OBJS) sudoers.la: $(SUDOERS_OBJS) $(LIBIOLOG) $(LIBLOGSRV) libparsesudoers.la @LT_LDDEP@ case "$(LT_LDFLAGS)" in \ *-no-install*) \ - $(LIBTOOL) $(LTFLAGS) @LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module;; \ + $(LIBTOOL) $(LTFLAGS) @SUDOERS_LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module;; \ *) \ - $(LIBTOOL) $(LTFLAGS) @LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(ASAN_LDFLAGS) $(SSP_LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -avoid-version -rpath $(plugindir) -shrext .so;; \ + $(LIBTOOL) $(LTFLAGS) @SUDOERS_LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(ASAN_LDFLAGS) $(SSP_LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -avoid-version -rpath $(plugindir) -shrext .so;; \ esac visudo: libparsesudoers.la $(VISUDO_OBJS) $(LIBUTIL)