[DRE-maint] Bug#955440: passenger: FTBFS on armel and armhf

peter green plugwash at p10link.net
Sat Apr 18 20:09:45 BST 2020


Tags 955440 +patch
Thanks

The offending code is.

         #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)
                 // File descriptor passing macros (CMSG_*) seem to be broken
                 // on 64-bit MacOS X. This structure works around the problem.
                 struct {
                         struct cmsghdr header;
                         int fd;
                 } control_data;
                 #define EXPECTED_CMSG_LEN sizeof(control_data)
#else
                 char control_data[CMSG_SPACE(sizeof(int))];
                 #define EXPECTED_CMSG_LEN CMSG_LEN(sizeof(int))
         #endif

And there is another similar block later in the file that likely suffers from the same issue.

I took a look at a git blame in upstream git https://github.com/phusion/passenger/blame/0ef3222e86ede97dff189de1137cca67684d4e2d/src/cxx_supportlib/Utils/IOUtils.cpp#L1128 which leads back to https://github.com/phusion/passenger/commit/e3885d5c9e7b5403422742f193be0aa5775a84d2 but that is just moving the offending code from MessageChannel.h to IOUtils.cpp so going to the parent commit and blaming again takes us to https://github.com/phusion/passenger/commit/312b5e1c65558e17cd30d1b28089078d8f614fbf which added the arm condition to the list of conditionals and is described as "Fixed compilation problems on Linux systems with ARM CPU".

My feeling is that the issue that upstream was trying to fix was an alignment issue. In particular the creation of  of a buffer by using char control_data[CMSG_SPACE(sizeof(int))] means there are no alignment guarantees on the buffer and if my reading of the macros is correct then an unaligned buffer will lead to unaligned accesses. It looks like this bad practice may have originated from older versions of the manpage, I note that https://linux.die.net/man/3/cmsg_space uses a plain char array while the manpage in Bullseye uses a union.

I have written a patch which fixes the alignment issue in the main codepath and switches arm Linux (and any other non-apple, non-solaris arm systems) from the alternate codepath to the main codepath. I have tested that the package builds in raspbian bullseye-staging with the patch, I have not tested it beyond that.

I have uploaded the package to raspbian bullseye, a debdiff should appear soon at https://debdiffs.raspbian.org/main/p/passenger/ no intent to NMU in Debian.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-ruby-extras-maintainers/attachments/20200418/a35306c1/attachment-0001.html>


More information about the Pkg-ruby-extras-maintainers mailing list