Sunday, October 29, 2023

net/powerdns_recursor fix boost context switching wrt IBT

Hi,

After some digging it turns out that boost 1.80 does have the required
endbr64 instructions in its context switch assembly code. But that is
not enough, to make PowerDNS Recursor work on my new laptop I had to
place three endbr64 instructions after jump_fcontext() calls in
pdns_recursor itself.

This way I could remove the USE_NOBTCFI marker.

So far only lightly tested but I thought I'd share this result as
others may benefit from this insight.

-Otto

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/net/powerdns_recursor/Makefile,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile
--- Makefile 30 Sep 2023 10:41:00 -0000 1.46
+++ Makefile 29 Oct 2023 08:04:58 -0000
@@ -4,7 +4,7 @@ V= 4.9.1
DISTNAME= pdns-recursor-${V}
EXTRACT_SUFX = .tar.bz2
PKGNAME= powerdns-recursor-${V}
-REVISION= 0
+REVISION= 1

CATEGORIES= net

@@ -16,9 +16,6 @@ PERMIT_PACKAGE= Yes
WANTLIB+= ${COMPILER_LIBCXX} boost_context-mt boost_filesystem-mt
WANTLIB+= boost_system-mt boost_thread-mt c crypto curl fstrm m
WANTLIB+= sodium ssl z
-
-# boost_context 1.80.0 doesn't have landing pads (1.81.0 should fix)
-USE_NOBTCFI= Yes

SITES= https://downloads.powerdns.com/releases/
MAINTAINER= Otto Moerbeek <otto@drijf.net>
Index: patches/patch-mtasker_fcontext_cc
===================================================================
RCS file: patches/patch-mtasker_fcontext_cc
diff -N patches/patch-mtasker_fcontext_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-mtasker_fcontext_cc 29 Oct 2023 08:04:58 -0000
@@ -0,0 +1,48 @@
+Index: mtasker_fcontext.cc
+--- mtasker_fcontext.cc.orig
++++ mtasker_fcontext.cc
+@@ -32,6 +32,20 @@ using boost::context::make_fcontext;
+ using boost::context::detail::make_fcontext;
+

No comments:

Post a Comment