Reproducible SIGSEGV when Dovecot 2.3 compiled against glibc-2.28

Reuben Farrelly reuben-dovecot at reub.net
Wed Aug 8 10:55:22 EEST 2018


On 8/08/2018 5:29 pm, Thore Bödecker wrote:
> Hey,
> 
> you mentioned that dovecot builds fine, but does "make check" also
> complete successfully with a glibc-2.28 build on a glibc-2.28 system?
> 
> We have been seeing segfaults during "make check" and it seems the following
> patch was able to make the testsuite run successfully.
 >
> Just out of curiosity, could you try this patch and see if this fixes
> the issues you're experiencing?
> 
> 
> include-crypt-h.patch:
> --------8<--------
> diff -up dovecot-2.3.0.1/src/auth/mycrypt.c.libxcrypt dovecot-2.3.0.1/src/auth/mycrypt.c
> --- dovecot-2.3.0.1/src/auth/mycrypt.c.libxcrypt       2018-02-28 15:28:58.000000000 +0100
> +++ dovecot-2.3.0.1/src/auth/mycrypt.c 2018-03-27 10:57:38.447769201 +0200
> @@ -14,6 +14,7 @@
>   #  define _XPG6 /* Some Solaris versions require this, some break with this */
>   #endif
>   #include <unistd.h>
> +#include <crypt.h>
> 
>   #include "mycrypt.h"
> 
> -------->8--------

Ok, well....after running 'make check' I also saw a failure due to a 
segfault.  It's the same crash Thore is seeing:

/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc
-std=gnu99 -O0 -g -pipe -march=native -mtune=native -ggdb
-fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
-mfunction-return=thunk -mindirect-branch=thunk -Wall -W
-Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
-Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime
-Wstrict-aliasing=2   -module -avoid-version  -Wl,-O1 -Wl,--as-needed -o
libauthdb_imap.la -rpath /usr/lib64/dovecot/auth
libauthdb_imap_la-passdb-imap.lo ../lib-imap-client/libimap_client.la
../../src/lib-dovecot/libdovecot.la -export-dynamic -ldl
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC
.libs/libauthdb_imap_la-passdb-imap.o  -Wl,--whole-archive
../lib-imap-client/.libs/libimap_client.a -Wl,--no-whole-archive 
-Wl,-rpath 
-Wl,/home/portage/portage/net-mail/dovecot-9999_p20180807/work/dovecot-9999_p20180807/src/lib-dovecot/.libs
-Wl,-rpath -Wl,/usr/lib64/dovecot -Wl,--as-needed
../../src/lib-dovecot/.libs/libdovecot.so -ldl  -O0 -g -march=native
-mtune=native -ggdb -fstack-protector-strong -mfunction-return=thunk
-mindirect-branch=thunk -Wl,-O1   -Wl,-soname -Wl,libauthdb_imap.so -o
.libs/libauthdb_imap.so
libtool: link: ( cd ".libs" && rm -f "libauthdb_imap.la" && ln -s
"../libauthdb_imap.la" "libauthdb_imap.la" )
make  check-local
make[3]: Entering directory 
'/home/portage/portage/net-mail/dovecot-9999_p20180807/work/dovecot-9999_p20180807/src/auth'
for bin in test-libpassword test-auth-cache test-auth; do \
   if !  ./$bin; then exit 1; fi; \
done
/bin/sh: line 1: 31821 Segmentation fault      ./$bin
make[3]: *** [Makefile:1924: check-local] Error 1
make[3]: Leaving directory 
'/home/portage/portage/net-mail/dovecot-9999_p20180807/work/dovecot-9999_p20180807/src/auth'
make[2]: *** [Makefile:1579: check-am] Error 2


However by applying the patch to include crypt.h (as above) it not only 
fixed the make test but also has fixed the glibc runtime problem too.

In other words - rebuild on glibc-2.28 just now and executed on 
glibc-2.28 based system resulted in a successful and usable auth binary.

Thanks Thore!

Reuben



More information about the dovecot mailing list