diff -Nru passenger-5.0.30/debian/changelog passenger-5.0.30/debian/changelog --- passenger-5.0.30/debian/changelog 2019-03-16 07:54:26.000000000 +0000 +++ passenger-5.0.30/debian/changelog 2020-04-18 17:57:12.000000000 +0000 @@ -1,3 +1,10 @@ +passenger (5.0.30-1.1+rpi1) bullseye-staging; urgency=medium + + * Fix alignment issues in the main CMSG codepath and switch arm Linux systems + from the workaround codepath to the main codepath (Closes: 955440). + + -- Peter Michael Green Sat, 18 Apr 2020 17:57:12 +0000 + passenger (5.0.30-1.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru passenger-5.0.30/debian/patches/fix-arm-cmsg.patch passenger-5.0.30/debian/patches/fix-arm-cmsg.patch --- passenger-5.0.30/debian/patches/fix-arm-cmsg.patch 1970-01-01 00:00:00.000000000 +0000 +++ passenger-5.0.30/debian/patches/fix-arm-cmsg.patch 2020-04-18 17:56:58.000000000 +0000 @@ -0,0 +1,81 @@ +Description: Fix the CMSG related FTBFS on Debian arm* and raspbian + The CMSG code has two codepaths, the "workaround" code path which upstream + currently uses on OS X, Solaris and all arm systems and the "main" codepath + used everywhere else. + . + Unfortunately the "workaround" codepath no longer builds on Debian, presumbally + due to changes in glibc. + . + I do not know for sure, but I belive that the problem that the developers were + trying to solve when they made arm systems use the "workaround" codepath was an + alignment issue. The "main" codepath used a char array as a buffer which is not + alignment safe. + . + This patch changes the "main" codepath to use a union for the buffer as + used in the example in current versions of the cmsg manpage and changes the + conditional defines so that arm Linux systems no longer use the "workaround" + codepath. +Author: Peter Michael Green + +Index: passenger-5.0.30/src/cxx_supportlib/Utils/IOUtils.cpp +=================================================================== +--- passenger-5.0.30.orig/src/cxx_supportlib/Utils/IOUtils.cpp ++++ passenger-5.0.30/src/cxx_supportlib/Utils/IOUtils.cpp +@@ -1125,7 +1125,7 @@ readFileDescriptor(int fd, unsigned long + struct msghdr msg; + struct iovec vec; + char dummy[1]; +- #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__) ++ #if defined(__APPLE__) || defined(__SOLARIS__) + // File descriptor passing macros (CMSG_*) seem to be broken + // on 64-bit MacOS X. This structure works around the problem. + struct { +@@ -1134,7 +1134,10 @@ readFileDescriptor(int fd, unsigned long + } control_data; + #define EXPECTED_CMSG_LEN sizeof(control_data) + #else +- char control_data[CMSG_SPACE(sizeof(int))]; ++ union { //union for alignment purposes ++ char data[CMSG_SPACE(sizeof(int))]; ++ struct cmsghdr align; ++ } control_data; + #define EXPECTED_CMSG_LEN CMSG_LEN(sizeof(int)) + #endif + struct cmsghdr *control_header; +@@ -1168,7 +1171,7 @@ readFileDescriptor(int fd, unsigned long + throw IOException("No valid file descriptor received."); + } + +- #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__) ++ #if defined(__APPLE__) || defined(__SOLARIS__) + return control_data.fd; + #else + return *((int *) CMSG_DATA(control_header)); +@@ -1184,13 +1187,16 @@ writeFileDescriptor(int fd, int fdToSend + struct msghdr msg; + struct iovec vec; + char dummy[1]; +- #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__) ++ #if defined(__APPLE__) || defined(__SOLARIS__) + struct { + struct cmsghdr header; + int fd; + } control_data; + #else +- char control_data[CMSG_SPACE(sizeof(int))]; ++ union { ++ char control_data[CMSG_SPACE(sizeof(int))]; ++ struct cmsghdr align; ++ } control_data; + #endif + struct cmsghdr *control_header; + int ret; +@@ -1215,7 +1221,7 @@ writeFileDescriptor(int fd, int fdToSend + control_header = CMSG_FIRSTHDR(&msg); + control_header->cmsg_level = SOL_SOCKET; + control_header->cmsg_type = SCM_RIGHTS; +- #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__) ++ #if defined(__APPLE__) || defined(__SOLARIS__) + control_header->cmsg_len = sizeof(control_data); + control_data.fd = fdToSend; + #else diff -Nru passenger-5.0.30/debian/patches/series passenger-5.0.30/debian/patches/series --- passenger-5.0.30/debian/patches/series 2019-03-16 07:51:09.000000000 +0000 +++ passenger-5.0.30/debian/patches/series 2020-04-18 17:43:39.000000000 +0000 @@ -3,3 +3,4 @@ nodejs_bin_name.patch CVE-2017-16355.patch Fix-privilege-escalation-in-the-Nginx-module.patch +fix-arm-cmsg.patch