Hi Aurélien,

On 08/01/2024 21:18, Aurelien Jarno wrote:
> On riscv64, mptcpd fails to build from source with a segmentation fault
> in the test-mptcpwrap test:

(...)

> 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.

Thank you for the very nice investigation and analysis!

The fixes were then easy to do:
- upstream: https://github.com/multipath-tcp/mptcpd/pull/286
- debian: https://salsa.debian.org/debian/mptcpd/-/commit/8069902

> 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.

Many thanks for the explanation!

I will wait for the different pipelines to be over, before sending a new
version to mentors.debian.net!

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.

Reply via email to