Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 727244 - >=net-mail/dovecot-2.3.10.1: test failure (backtrace_append)
Summary: >=net-mail/dovecot-2.3.10.1: test failure (backtrace_append)
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Eray Aslan
URL: https://dovecot.org/pipermail/dovecot...
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: CVE-2020-10957, CVE-2020-10958, CVE-2020-10967
  Show dependency tree
 
Reported: 2020-06-05 16:52 UTC by Sam James
Modified: 2021-07-23 22:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_727244.txt,33.91 KB, text/plain)
2020-06-05 16:52 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-06-05 16:52:24 UTC
Created attachment 643554 [details]
build.log

...
array compare (char*) ................................................ : ok
array swap ........................................................... : ok
array_free_without_data .............................................. : ok
array_free ........................................................... : ok
test-backtrace.c:19: Assert failed: backtrace_append(bt) == 0
test-backtrace.c:21: Assert failed: strstr(str_c(bt), "main") != NULL
backtrace_append ..................................................... : FAILED
test-backtrace.c:43: Assert failed: backtrace_get(&bt) == 0
/bin/sh: line 1:   371 Segmentation fault      ./$bin
make[4]: *** [Makefile:2756: check-local] Error 1
make[4]: Leaving directory '/var/tmp/portage/net-mail/dovecot-2.3.10.1/work/dovecot-2.3.10.1/src/lib'

----
Portage 2.3.99 (python 3.7.7-final-0, default/linux/arm/17.0/armv6j, gcc-9.3.0, glibc-2.30-r8, 4.19.113-v7+ armv7l)
=================================================================
System uname: Linux-4.19.113-v7+-armv7l-ARMv7_Processor_rev_5_-v7l-with-gentoo-2.6
KiB Mem:      948244 total,    122524 free
KiB Swap:    4194300 total,   4176288 free
Timestamp of repository gentoo: Fri, 05 Jun 2020 15:35:38 +0000
sh bash 5.0_p17
ld GNU ld (Gentoo 2.32 p2) 2.32.0
distcc 3.3.3 armv6j-unknown-linux-gnueabihf [enabled]
app-shells/bash:          5.0_p17::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.18::gentoo, 3.6.10-r2::gentoo, 3.7.7-r2::gentoo, 3.8.2-r2::gentoo
dev-util/cmake:           3.16.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r2::gentoo, 2.32-r1::gentoo, 2.33.1-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo, 9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r8::gentoo
Repositories:

gentoo
    location: /bound/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:
    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="@FREE"
CBUILD="armv6j-unknown-linux-gnueabihf"
CFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard -fdiagnostics-color=always -frecord-gcc-switches -fdiagnostics-show-option -frecord-gcc-switches"
CHOST="armv6j-unknown-linux-gnueabihf"
CONFIG_PROTECT="/boot/cmdline.txt /boot/config.txt /etc /etc/grs/systems.conf /usr/share/gnupg/qualified.txt /var/qmail/alias /var/qmail/control /var/vpopmail/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard -fdiagnostics-color=always -frecord-gcc-switches"
DISTDIR="/bound/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard -fdiagnostics-color=always -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard -fdiagnostics-color=always -frecord-gcc-switches"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/share/doc/*/*.pdf /usr/share/man/*/*"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--hash-style=gnu"
LINGUAS="en en_GB en_US"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl arm berkdb bzip2 cli crypt dri elogind fortran gdbm iconv ipv6 ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl tcpd unicode xattr zlib" ADA_TARGET="gnat_2018" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb v4 v5 v6" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-09-06 01:55:38 UTC
Further context: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962630

Building with USE=unwind fails on 'fake arm' (arm64 box with a linux32 chroot), so need to try on real hardware.
Comment 2 Eray Aslan gentoo-dev 2020-09-12 09:06:42 UTC
USE="unwind" should work now with net-mail/dovecot-2.3.11.3-r1
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-09-12 19:19:57 UTC
(In reply to Eray Aslan from comment #2)
> USE="unwind" should work now with net-mail/dovecot-2.3.11.3-r1

I think the "eautoreconf" needs to be uncommented (can drop elibtoolize then?) to make this effective.

Since USE=unwind is needed for tests on arm, but not really sure how to enforce this in the ebuild other than adding USE=test then REQUIRED_USE="test? ( arm? ( unwind ) )" which isn't clean.

Tests don't pass fully now (backtrace fails, but doesn't segfault, so the others can run!):
>test-backtrace.c:14: Assert failed: strstr(str_c(bt), "test_backtrace") != NULL
>backtrace_append ..................................................... : FAILED
>test-backtrace.c:38: Assert failed: strstr(bt, "test_backtrace") != NULL
>backtrace_get ........................................................ : FAILED

with "2 / 988 tests failed".

This is a graet improvement and I'll report it upstream when I get a chance.
Comment 5 Marek Szuba archtester gentoo-dev 2021-07-23 22:27:21 UTC
Having run into this problem on riscv earlier on today, here is what I have managed to find out about it.

1. Dovecot backtrace tests do NOT work unless the its executables have been instrumented with unwind tables, regardless of whether Dovecot uses libunwind or libc for this purpose;

2. There are two ways for a modern compiler to add unwind tables to an executable: in static form by using the compiler flag -funwind-tables, or in DWARF form using -fasynchronous-unwind-tables;

3. Both gcc and clang enable generation of asynchronous unwind tables BY DEFAULT on certain arches. Having had a look at gcc sources (in gcc/common/config/), as of 11.1.0 this feature is enabled by default on aarch64, i386 (which covers both x86 and amd64), rs6000, s390, tilegx and tilepro. I've also seen it mentioned on the Internet that Red Hat patches gcc on their distros to enable this on all arches for more consistent backtracing, haven't verified it yet though.

PoC covering all of the above: compile dovecot on amd64 with -fno-asynchronous-unwind-tables in CFLAGS and run the test suite. On my system this makes test-backtrace.c start failing regardless of whether I use USE=unwind or not.
Comment 6 Marek Szuba archtester gentoo-dev 2021-07-23 22:32:52 UTC
This should be fixed in 2.3.15-r1 now - I added 'if on riscv; append -funwind-tables' there during keywording and have just updated it in accordance with my research. Of course if go ahead and change this if you prefer eras, you're the maintainer after all.

My poor man's substitute for having forgotten to include the Bug tag in the commit message:

commit a4eee8b76225e833d31c9acb155ad0a5354eddc5
Author: Marek Szuba <marecki@gentoo.org>
Date:   Fri Jul 23 22:15:47 2021 +0000

    net-mail/dovecot: use -fasynchronous-unwind-tables, unconditionally
    
    Have just confirmed that on riscv asynchronous tables fix test-backtrace
    errors as well as static ones. Conversely, appending
    -fno-asynchronous-unwind-tables on amd64 (which is one of the arches for
    which both gcc and clang enable asynchronous unwind tables by default,
    IIRC because they've got something to do with stack management) makes
    the two tests start failing - regardless of whether USE=unwind is
    enabled or not.