Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
multimedia/openh264: ENDRB64 sprinkling
To:
ports@openbsd.org
Cc:
kn@openbsd.org
Date:
Tue, 20 Feb 2024 18:05:41 +0100

Download raw body.

Thread
  • Mark Kettenis:

    multimedia/openh264: ENDRB64 sprinkling

Theo says I need to explain a bit more how to fix these issues so that
you guys can fix things yourself in the future ;).

This one is fairly simple.  We're missing an ENDBR64 instruction at
the start of exported assembly functions.  Calling into the shared
library through PLT entries involves an indirect branch.  So this
triggers a SIGILL.  So we need to add ENDBR64 instructions at the
start of a function.

In this case there is a nice WELS_EXTERN macro that is used to create
exported functions.  This macro is defined in a file that gets
included by all the different assembly files.  So we can simply adjust
that macro to insert an ENDBR64 instruction at the start of the
function.

ok?


Index: multimedia/openh264/Makefile
===================================================================
RCS file: /cvs/ports/multimedia/openh264/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- multimedia/openh264/Makefile	2 Feb 2024 10:14:45 -0000	1.9
+++ multimedia/openh264/Makefile	20 Feb 2024 16:57:07 -0000
@@ -3,6 +3,7 @@ GH_ACCOUNT =		cisco
 GH_PROJECT =		openh264
 GH_TAGNAME =		v2.4.1
 CATEGORIES =		multimedia
+REVISION =		0
 
 SHARED_LIBS =		openh264	1.0	# 7.0
 
Index: multimedia/openh264/patches/patch-codec_common_x86_asm_inc_asm
===================================================================
RCS file: multimedia/openh264/patches/patch-codec_common_x86_asm_inc_asm
diff -N multimedia/openh264/patches/patch-codec_common_x86_asm_inc_asm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ multimedia/openh264/patches/patch-codec_common_x86_asm_inc_asm	20 Feb 2024 16:57:07 -0000
@@ -0,0 +1,13 @@
+Index: codec/common/x86/asm_inc.asm
+--- codec/common/x86/asm_inc.asm.orig
++++ codec/common/x86/asm_inc.asm
+@@ -501,6 +501,9 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbit
+         %endif
+     %endif
+     %1:
++    %ifndef X86_32
++        endbr64
++    %endif
+ %endmacro
+ 
+ %macro WELS_AbsW 2