Friday, February 23, 2024

imlib2 BTI

deraadt@ mentioned a problem with imlib2 on machines with IBT. I've
bodged things so that I can run regression tests (which are only present
in git, not the distributed tarballs, and don't built without extra
patches) - SIGILL shows up when running them here.

Here's a diff adding landing pads to the amd64 asm. There are also some
src/lib/asm_XXX.S which are only used on i386 MMX and not compiled on
amd64 so I have left those alone. (Well actually I wrote a diff for
those too using #ifdef which did build on i386, but it doesn't seem
useful so I dropped it)

This fixes tests for me. OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/imlib2/Makefile,v
retrieving revision 1.54
diff -u -p -r1.54 Makefile
--- Makefile 3 Feb 2024 18:14:34 -0000 1.54
+++ Makefile 23 Feb 2024 10:12:06 -0000
@@ -1,6 +1,7 @@
COMMENT= image manipulation library

DISTNAME= imlib2-1.12.2
+REVISION= 0
SHARED_LIBS= Imlib2 9.0 # 13.2
CATEGORIES= graphics

Index: patches/patch-src_lib_amd64_blend_S
===================================================================
RCS file: patches/patch-src_lib_amd64_blend_S
diff -N patches/patch-src_lib_amd64_blend_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_lib_amd64_blend_S 23 Feb 2024 10:12:06 -0000
@@ -0,0 +1,11 @@
+Index: src/lib/amd64_blend.S
+--- src/lib/amd64_blend.S.orig
++++ src/lib/amd64_blend.S
+@@ -102,6 +102,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba)
+
+
+ #define ENTER \
++ endbr64 ; \
+ pushq %rbp ; \
+ movq %rsp, %rbp ; \
+ pushq %rbx ; \
Index: patches/patch-src_lib_amd64_blend_cmod_S
===================================================================
RCS file: patches/patch-src_lib_amd64_blend_cmod_S
diff -N patches/patch-src_lib_amd64_blend_cmod_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_lib_amd64_blend_cmod_S 23 Feb 2024 10:12:06 -0000
@@ -0,0 +1,11 @@
+Index: src/lib/amd64_blend_cmod.S
+--- src/lib/amd64_blend_cmod.S.orig
++++ src/lib/amd64_blend_cmod.S
+@@ -114,6 +114,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba_cmod)
+
+
+ #define ENTER \
++ endbr64 ; \
+ pushq %rbp ; \
+ movq %rsp, %rbp ; \
+ pushq %rbx ; \

No comments:

Post a Comment