Bug 2973 - Broken pipe after authentication when including coverage information
Summary: Broken pipe after authentication when including coverage information
Status: CLOSED WONTFIX
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 7.9p1
Hardware: amd64 Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-25 04:15 AEDT by Sebastian Roland
Modified: 2020-02-14 15:59 AEDT (History)
2 users (show)

See Also:


Attachments
log (3.73 KB, application/gzip)
2019-02-25 04:15 AEDT, Sebastian Roland
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Roland 2019-02-25 04:15:28 AEDT
Created attachment 3246 [details]
log

If OpenSSH is compiled with gcc using --coverage sshd returns with a broken pipe error after authentication. The last working version is 7.1. To reproduce compile with: CFLAGS=--coverage LIBS='-lgcov' ./configure && make && make install.

Only got it working using --with-sandbox=no.

Attached are ssh and sshd debug logs.
Comment 1 Sebastian Roland 2019-02-25 04:17:47 AEDT
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto
Thread model: posix
gcc version 8.2.1 20181127 (GCC)
Comment 2 Jakub Jelen 2019-02-25 19:45:59 AEDT
When compiled with coverage support, the server tries to write files about the line coverage. This indeed fails in the net child, which is confined with seccomp filter sandbox and chroot by default. I am not sure why you would need to authenticate to ssh when it is compiled with coverage support.
Comment 3 Sebastian Roland 2019-02-25 19:52:05 AEDT
Jakub, thank you for your quick reply. You are right about the writing of coverage data. I managed to get that working however it is still only usable when compiling without sandbox support. The reason why it is relevant is that you might want to have coverage reports about your test cases which are failing because of the described behavior.
Comment 4 Jakub Jelen 2019-02-25 20:25:45 AEDT
Coverage data for integration tests (as opposed to unit tests) are not always very helpful. It might show you what lines were not executed, but does not give you any assurance that the executed lines did always the right thing.

We were facing similar issue with libssh, which is using OpenSSH server to test against. At this moment, we do not run coverage in this part of the testsuite, but it should be possible to workaround this by replacing these functions from LD_PRELOAD, as proposed in the following project. Unfortunately, I was not able to make it working for coverage so far.

Otherwise, for testing, it should be probably fine to run without the sandbox.

https://gitlab.com/cryptomilk/priv_wrapper/tree/master
Comment 5 Damien Miller 2019-05-10 15:00:59 AEST
Yes, doing this sort of stuff almost always requires disabling sandboxing and also sometimes patching out the chroot() calls in sshd.c.

We don't have any concrete plans to change this, as it affects only developers, and I don't want to leave a loaded footgun around for everyone else.
Comment 6 Damien Miller 2020-02-14 15:59:22 AEDT
Closing all resolved bug with release of openssh-8.2