[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1060285: mptcpd: FTBFS with a segmentation fault in the testsuite when SCTP disabled and no /etc/protocols



Source: mptcpd
Version: 0.12-2
Severity: serious
Tags: ftbfs upstream
Justification: fails to build from source (but built successfully in the past)
User: debian-riscv@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv@lists.debian.org

Dear maintainer,

On riscv64, mptcpd fails to build from source with a segmentation fault
in the test-mptcpwrap test:

| =======================================
|    mptcpd 0.12: tests/test-suite.log
| =======================================
| 
| # TOTAL: 19
| # PASS:  17
| # SKIP:  1
| # XFAIL: 0
| # FAIL:  1
| # XPASS: 0
| # ERROR: 0
| 
| .. contents:: :depth: 2
| 
| SKIP: test-start-stop
| =====================
| 
| Running non-interactive sudo check...
| sudo: a password is required
|     fail, skipping the test
| SKIP test-start-stop (exit status: 77)
| 
| FAIL: test-mptcpwrap
| ====================
| 
| Test case 0: PASS
| Test case 1: Segmentation fault
| FAIL test-mptcpwrap (exit status: 139)

A full build log is available here:
https://buildd.debian.org/status/fetch.php?pkg=mptcpd&arch=riscv64&ver=0.12-2%2Bb1&stamp=1704714971&raw=0

Investigation shows that 3 conditions are needed to trigger this issue:
- A recent kernel that supports mptcp, to be checked with
  /proc/sys/net/mptcp/enabled
- Something that prevents SCTP to be used, for instance on the build
  daemons /proc/sys/kernel/modules_disabled is set to 1, preventing the
  sctp.ko module to be loaded
- A system without /etc/protocols, for instance without the netbase
  package installed.

With this three conditions, this triggers the following code path from
the mptcpwrap-tester.c file:

| static void test_socket_data(struct socket_data const *data)
| {
|         int const fd = socket(data->domain, data->type, data->protocol);
| 
|         if (fd == -1) {
|                 if (errno == EPROTONOSUPPORT) {
|                         struct protoent const *const p =
|                                 getprotobynumber(data->protocol);
| 
|                         fprintf(stderr,
|                                 "WARNING: Ignoring unsupported "
|                                 "protocol: %d - %s\n",
|                                 data->protocol,
|                                 p->p_name);
| 
|                         return;
|                 }

The output of getprotobynumber() is used directly, without checking for
a NULL pointer in case of error, for instance because /etc/protocols
does not exist. This causes a segmentation fault when trying to
dereference it. A workaround is to build-depends on netbase, and a
proper fix to test for this error.

In the latest rebuild of mptpcd, the conditions where met only on the
riscv64 buildd, and riscv64 is not a release architecture. That said a
few mips64el buildds also met the 3 conditions and it will be the case
of more and more buildds once they are upgraded to bookworm. I am
therefore filling this issue as severity serious.

Regards
Aurelien


Reply to: