aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2024-02-04 06:58:45 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2024-02-05 17:30:43 +0000
commitb602563d3e3a4428c07eacbfde85e6e0fbe1c0f4 (patch)
treedd51a50077ea19b198d4b4af702ca10ebf9a9efd
parent013ff61eea0d87aeed7b9a33a86462f58ea11417 (diff)
main/boost1.82: fix stack alignment on i386
Without this patch, boost's `make_fcontext` does not correctly align the stack pointer on i386. This will cause software to SIGSEV when using `movaps` and similar instructions which require 16-byte stack alignment. This fixes the Nix check() on x86 (see !60218). See: * https://github.com/boostorg/context/issues/210 * https://github.com/boostorg/context/pull/218
-rw-r--r--main/boost1.82/APKBUILD4
-rw-r--r--main/boost1.82/boost-fix-i386-stack-alignment.patch48
2 files changed, 51 insertions, 1 deletions
diff --git a/main/boost1.82/APKBUILD b/main/boost1.82/APKBUILD
index afee3362531..a5d7efc13b4 100644
--- a/main/boost1.82/APKBUILD
+++ b/main/boost1.82/APKBUILD
@@ -2,7 +2,7 @@
pkgname=boost1.82
pkgver=1.82.0
_pkgver="${pkgver//./_}"
-pkgrel=3
+pkgrel=4
pkgdesc="Free peer-reviewed portable C++ source libraries"
url="https://www.boost.org/"
arch="all"
@@ -17,6 +17,7 @@ subpackages="
boost-dev:_dev
"
source="https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/boost_$_pkgver.tar.bz2
+ boost-fix-i386-stack-alignment.patch
boost-1.57.0-python-abi_letters.patch
boost-1.57.0-python-libpython_dep.patch
boost-phoenix-uarg.patch
@@ -221,6 +222,7 @@ _pyversion() {
sha512sums="
6fddc452ca67f99f5c181e21c73d96feb7346e10886477c91b4abc2cdf447750599e0d42f935ef591222200ef6c033de078a7ad2bb577c81fa56a249b17420cb boost_1_82_0.tar.bz2
+f7a2f6945dc1203c5d6500180e77c532585ceb27e93465e3293b6c5b926da5039e3240b69953e1ddfc072e106db2d1bfb52c984384fd15749b74960c8b5b3200 boost-fix-i386-stack-alignment.patch
d96d4d37394a31764ed817d0bc4a99cffa68a75ff1ecfd4417b9e1e5ae2c31a96ed24f948c6f2758ffdac01328d2402c4cf0d33a37107e4f5f721e636daebd66 boost-1.57.0-python-abi_letters.patch
132c4b62815d605c2d3c9038427fa4f422612a33711d47b2862f2311516af8a371d6b75bf078a7bffe20be863f8d21fb9fe74dc1a1bac3a10d061e9768ec3e02 boost-1.57.0-python-libpython_dep.patch
7fad4b81ae5df38f740148153bcb5b4b31c12061f1264404b96a324e0d2f06943530cbcf9002d17772fb4ad87dcf0ba8bf4ed397725ee448a4d310df5d0383ad boost-phoenix-uarg.patch
diff --git a/main/boost1.82/boost-fix-i386-stack-alignment.patch b/main/boost1.82/boost-fix-i386-stack-alignment.patch
new file mode 100644
index 00000000000..0b85b5b92fa
--- /dev/null
+++ b/main/boost1.82/boost-fix-i386-stack-alignment.patch
@@ -0,0 +1,48 @@
+From 2a5e11babb2a9e992fb96461a61d36f2b54b207b Mon Sep 17 00:00:00 2001
+From: Niels Dossche <niels.dossche@ugent.be>
+Date: Wed, 25 Jan 2023 09:05:19 +0100
+Subject: [PATCH] Make sure the i386 sysv stack is aligned
+
+SysV ABI requires a stack alignment of 16 bytes. Currently, for i386
+with SysV ABI, the trampoline function is entered with an unaligned
+stack. This causes problems for the context-function that is jumped to
+as its stack is also unaligned. This causes a crash for our use-case
+because the context function contains an SSE instruction which reads
+from the stack. The SSE instruction requires the correct alignment.
+Fix it by changing the 0x2c offset to 0x30, such that the stack remains
+aligned.
+---
+ src/asm/make_i386_sysv_elf_gas.S | 4 ++--
+ src/asm/make_i386_sysv_macho_gas.S | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libs/context/src/asm/make_i386_sysv_elf_gas.S b/libs/context/src/asm/make_i386_sysv_elf_gas.S
+index 0b7ab81..9261e56 100644
+--- a/libs/context/src/asm/make_i386_sysv_elf_gas.S
++++ b/libs/context/src/asm/make_i386_sysv_elf_gas.S
+@@ -40,8 +40,8 @@ make_fcontext:
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+- /* reserve space for context-data on context-stack */
+- leal -0x2c(%eax), %eax
++ /* reserve space for context-data on context-stack, and align the stack */
++ leal -0x34(%eax), %eax
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */
+diff --git a/libs/context/src/asm/make_i386_sysv_macho_gas.S b/libs/context/src/asm/make_i386_sysv_macho_gas.S
+index fdcdb7c..519e406 100644
+--- a/libs/context/src/asm/make_i386_sysv_macho_gas.S
++++ b/libs/context/src/asm/make_i386_sysv_macho_gas.S
+@@ -38,8 +38,8 @@ _make_fcontext:
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+- /* reserve space for context-data on context-stack */
+- leal -0x2c(%eax), %eax
++ /* reserve space for context-data on context-stack, and align the stack */
++ leal -0x34(%eax), %eax
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */