aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0008-fix-ld-behavior-dependent-crash-in-ppc64-ldso-startu.patch
blob: d8230159e7d2e74282bd381dca57fbd83483a54c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From fc85fb38605a8bf341c367b8ab0d36edab2bdbfc Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Wed, 8 Mar 2017 13:35:33 -0500
Subject: [PATCH] fix ld-behavior-dependent crash in ppc64 ldso startup

the 32-bit pc-relative address for stage 2 of dynamic linker entry was
wrongly loaded with a zero-extending load instead of sign-extending
load, resulting in an invalid jump if the offset happened to be
negative, which depends on the linker's ordering of text sections.
---
 arch/powerpc64/reloc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc64/reloc.h b/arch/powerpc64/reloc.h
index e1bad00..faf70ac 100644
--- a/arch/powerpc64/reloc.h
+++ b/arch/powerpc64/reloc.h
@@ -27,6 +27,6 @@
 	"	bl 1f \n" \
 	"	.long " #sym "-. \n" \
 	"1:	mflr %1 \n" \
-	"	lwz %0, 0(%1) \n" \
+	"	lwa %0, 0(%1) \n" \
 	"	add %0, %0, %1 \n" \
 	: "=r"(*(fp)), "=r"((long){0}) : : "memory", "lr" )
-- 
1.9.3