From d149d15526714689f35568134e8a2f6c8dae96a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Sun, 2 Feb 2025 14:37:23 +0100 Subject: [PATCH] d/p/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch add --- debian/changelog | 3 ++ ...t-NGX_CPU_CACHE_LINE-using-debhelper.patch | 41 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 45 insertions(+) create mode 100644 debian/patches/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch diff --git a/debian/changelog b/debian/changelog index 09302b8..93ede5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ nginx (1.26.2-1) UNRELEASED; urgency=medium * d/gbp.conf: add upstream-signatures = on * d/{control,copyright}: update my email to "janmojzis@debian.org" * d/copyright: bump my copyright year + * d/p/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch add, + set correct NGX_CPU_CACHE_LINE value on i386/armhf architecture and + fix FTBR problem [ Jérémy Lal ] * Add Sergey Kandaurov pgp public key diff --git a/debian/patches/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch b/debian/patches/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch new file mode 100644 index 0000000..63568fa --- /dev/null +++ b/debian/patches/FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch @@ -0,0 +1,41 @@ +From: =?utf-8?b?SmFuIE1vasW+w63FoQ==?= +Date: Tue, 28 Jan 2025 14:38:51 +0100 +Subject: FTBR fix - detect correct NGX_CPU_CACHE_LINE using debhelper + +--- + auto/os/conf | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/auto/os/conf b/auto/os/conf +index bb0ce4e..8109ca1 100644 +--- a/auto/os/conf ++++ b/auto/os/conf +@@ -137,6 +137,28 @@ case "$NGX_MACHINE" in + + esac + ++# Nginx detects machine (NGX_MACHINE) type from runtime `uname -m` command. ++# This causes problem when the native machine is 64bit (e.g. amd64/aarch64) ++# and the build is running on an 32bit system (e.g. in i386/armhf chroot). ++# Then incorrect NGX_MACH_CACHE_LINE value is compiled into the binary ++# and this causes the FTBR problem: ++#./debian/build-bin/src/os/unix/ngx_posix_init.c:56 ++#-70781 movs r3,·#64 @·0x40 ++#+70781 movs r3,·#32 ++# ... ++# As a workaround, the DEB_TARGET_ARCH environment variable is used ++# to detect the correct NGX_MACH_CACHE_LINE value. ++case "$DEB_TARGET_ARCH" in ++ ++ i386) ++ NGX_MACH_CACHE_LINE=32 ++ ;; ++ ++ armhf) ++ NGX_MACH_CACHE_LINE=32 ++ ;; ++esac ++ + if test -z "$NGX_CPU_CACHE_LINE"; then + NGX_CPU_CACHE_LINE=$NGX_MACH_CACHE_LINE + fi diff --git a/debian/patches/series b/debian/patches/series index 52e1dc4..1d0b336 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 0003-define_gnu_source-on-other-glibc-based-platforms.patch nginx-fix-pidfile.patch nginx-ssl_cert_cb_yield.patch +FTBR-fix-detect-correct-NGX_CPU_CACHE_LINE-using-debhelper.patch