Package: memcached Version: 1.5.0-1 Severity: normal Tags: patch User: [email protected] Usertags: origin-ubuntu bionic ubuntu-patch
Dear maintainers, On ARM, unaligned memory access is not guaranteed to succeed; depending on the CPU and the kernel configuration, it may raise SIGBUS instead. memcached defaults to using unaligned access, which caused the package to fail to build on Ubuntu infrastructure where SIGBUS is raised. Please consider applying the attached patch in Debian, to force the use of host alignment for memory accesses. Thanks, -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ [email protected] [email protected]
diff -Nru memcached-1.5.0/debian/patches/always_enable_alignment.patch memcached-1.5.0/debian/patches/always_enable_alignment.patch --- memcached-1.5.0/debian/patches/always_enable_alignment.patch 1969-12-31 16:00:00.000000000 -0800 +++ memcached-1.5.0/debian/patches/always_enable_alignment.patch 2017-10-25 20:51:35.000000000 -0700 @@ -0,0 +1,59 @@ +Description: Force alignment on in configure.ac + Fixes FTBFS on arhmf. +Author: Nishanth Aravamudan <[email protected]> +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1630742 + +Index: memcached/configure.ac +=================================================================== +--- memcached.orig/configure.ac ++++ memcached/configure.ac +@@ -479,48 +479,7 @@ + AC_CHECK_FUNCS([accept4], [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if support accept4])]) + AC_CHECK_FUNCS([getopt_long], [AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if support getopt_long])]) + +-AC_DEFUN([AC_C_ALIGNMENT], +-[AC_CACHE_CHECK(for alignment, ac_cv_c_alignment, +-[ +- AC_RUN_IFELSE( +- [AC_LANG_PROGRAM([ +-#include <stdlib.h> +-#include <inttypes.h> +- ], [ +- char *buf = malloc(32); +- +- uint64_t *ptr = (uint64_t*)(buf+2); +- // catch sigbus, etc. +- *ptr = 0x1; +- +- // catch unaligned word access (ARM cpus) +-#ifdef ENDIAN_BIG +-#define ALIGNMENT 0x02030405 +-#else +-#define ALIGNMENT 0x05040302 +-#endif +- *(buf + 0) = 1; +- *(buf + 1) = 2; +- *(buf + 2) = 3; +- *(buf + 3) = 4; +- *(buf + 4) = 5; +- int* i = (int*)(buf+1); +- return (ALIGNMENT == *i) ? 0 : 1; +- ]) +- ],[ +- ac_cv_c_alignment=none +- ],[ +- ac_cv_c_alignment=need +- ],[ +- ac_cv_c_alignment=need +- ]) +-]) +-if test $ac_cv_c_alignment = need; then +- AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment]) +-fi +-]) +- +-AC_C_ALIGNMENT ++AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment]) + + dnl Check for our specific usage of GCC atomics. + dnl These were added in 4.1.2, but 32bit OS's may lack shorts and 4.1.2 diff -Nru memcached-1.5.0/debian/patches/series memcached-1.5.0/debian/patches/series --- memcached-1.5.0/debian/patches/series 2017-07-23 16:13:20.000000000 -0700 +++ memcached-1.5.0/debian/patches/series 2017-10-25 20:51:35.000000000 -0700 @@ -1,3 +1,4 @@ 01_init_script_additions.patch 04_add_init_retry.patch 07_disable_tests.patch +always_enable_alignment.patch

