Source: mdocml
Version: 1.14.1-1
Severity: important
Tags: patch ftbfs
User: debian-h...@lists.debian.org
Usertags: hurd
Control: found -1 1.14.6-2

Hi,

currently mdocml fails to build on Hurd [1][2].

The problem is that the test program for recvmsg() crashes, which stops
the build (recvmsg() is mandatory for mdocml). The crash is due to the
test itself: to check whether recvmsg() exists, the test tries a very
minimal invocation of recvmsg() with a null parameter for the msghdr;
since the Hurd implementation in glibc does not check for a null
parameter (and thus happily dereferences the pointer), then that
invocation crashes.

While this is a (arguably minor) bug in the Hurd part of glibc, I'm
submitting a local workaround here for the following reasons:
- mdocml is the only occurrence of this recvmsg() bug I've found so far
- it affects only the existance test, the actual mdocml code works fine
  (and the tests pass)
- submitting it to glibc and ensuring it is available in Debian will
  take a while

[1] 
https://buildd.debian.org/status/fetch.php?pkg=mdocml&arch=hurd-i386&ver=1.14.6-2%2Bb1&stamp=1728267527&raw=0
[2] 
https://buildd.debian.org/status/fetch.php?pkg=mdocml&arch=hurd-amd64&ver=1.14.6-2%2Bb1&stamp=1728417431&raw=0

Thanks,
-- 
Pino
Author: Pino Toscano <p...@debian.org>
Description: Pass non-null msghdr to recvmsg()
 The Hurd implementation of recvmsg() in glibc does not handle a NULL value
 for the msghdr parameter, crashing (and thus failing the test).
 .
 Since this is a simple existance test, and the actual mdocml code uses properly
 filled msghdr's, then pass it a valid one also in the existance test.
 .
 This is a workaround for what glibc ought to handle better (i.e. not crash and
 return EINVAL); use it to keep building mdocml while a proper fix is done in
 glibc.
Forwarded: not-needed
Last-Update: 2014-10-27

--- a/test-recvmsg.c
+++ b/test-recvmsg.c
@@ -1,8 +1,11 @@
 #include <sys/socket.h>
 #include <stddef.h>
+#include <string.h>
 
 int
 main(void)
 {
-       return recvmsg(-1, NULL, 0) != -1;
+       struct msghdr msg;
+       memset(&msg, 0, sizeof(msg));
+       return recvmsg(-1, &msg, 0) != -1;
 }

Reply via email to