i386: make debug wrappers compatible with static PIE

Message ID mvmilapfp4q.fsf@suse.de
State Committed
Commit ca230f5833d699a35778f83b3ab646ba37f6f66c
Headers
Series i386: make debug wrappers compatible with static PIE |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Patch failed to apply

Commit Message

Andreas Schwab July 12, 2023, 9:36 a.m. UTC
  Static PIE requires the use of PLT relocation.
---
 sysdeps/i386/memcpy_chk.S  | 4 ++--
 sysdeps/i386/memmove_chk.S | 4 ++--
 sysdeps/i386/mempcpy_chk.S | 4 ++--
 sysdeps/i386/memset_chk.S  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
  

Comments

Siddhesh Poyarekar July 12, 2023, 12:21 p.m. UTC | #1
On 2023-07-12 05:36, Andreas Schwab via Libc-alpha wrote:
> Static PIE requires the use of PLT relocation.
> ---
>   sysdeps/i386/memcpy_chk.S  | 4 ++--
>   sysdeps/i386/memmove_chk.S | 4 ++--
>   sysdeps/i386/mempcpy_chk.S | 4 ++--
>   sysdeps/i386/memset_chk.S  | 4 ++--
>   4 files changed, 8 insertions(+), 8 deletions(-)

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

> 
> diff --git a/sysdeps/i386/memcpy_chk.S b/sysdeps/i386/memcpy_chk.S
> index 7b12c12aba..1676de4fff 100644
> --- a/sysdeps/i386/memcpy_chk.S
> +++ b/sysdeps/i386/memcpy_chk.S
> @@ -28,8 +28,8 @@
>   ENTRY (__memcpy_chk)
>   	movl	12(%esp), %eax
>   	cmpl	%eax, 16(%esp)
> -	jb	__chk_fail
> -	jmp	memcpy
> +	jb	HIDDEN_JUMPTARGET (__chk_fail)
> +	jmp	JUMPTARGET (memcpy)
>   END (__memcpy_chk)
>   libc_hidden_builtin_def (__memcpy_chk)
>   #endif
> diff --git a/sysdeps/i386/memmove_chk.S b/sysdeps/i386/memmove_chk.S
> index 604aea8305..785b27373b 100644
> --- a/sysdeps/i386/memmove_chk.S
> +++ b/sysdeps/i386/memmove_chk.S
> @@ -27,8 +27,8 @@
>   ENTRY (__memmove_chk)
>   	movl	12(%esp), %eax
>   	cmpl	%eax, 16(%esp)
> -	jb	__chk_fail
> -	jmp	memmove
> +	jb	HIDDEN_JUMPTARGET (__chk_fail)
> +	jmp	JUMPTARGET (memmove)
>   END (__memmove_chk)
>   libc_hidden_builtin_def (MEMMOVE_CHK)
>   #endif
> diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S
> index 276eab1e8a..f58ca96e16 100644
> --- a/sysdeps/i386/mempcpy_chk.S
> +++ b/sysdeps/i386/mempcpy_chk.S
> @@ -27,8 +27,8 @@
>   ENTRY (__mempcpy_chk)
>   	movl	12(%esp), %eax
>   	cmpl	%eax, 16(%esp)
> -	jb	__chk_fail
> -	jmp	__mempcpy
> +	jb	HIDDEN_JUMPTARGET (__chk_fail)
> +	jmp	HIDDEN_JUMPTARGET (__mempcpy)
>   END (__mempcpy_chk)
>   libc_hidden_builtin_def (__mempcpy_chk)
>   #endif
> diff --git a/sysdeps/i386/memset_chk.S b/sysdeps/i386/memset_chk.S
> index a2e9208e1c..9901ca6d52 100644
> --- a/sysdeps/i386/memset_chk.S
> +++ b/sysdeps/i386/memset_chk.S
> @@ -27,8 +27,8 @@
>   ENTRY (__memset_chk)
>   	movl	12(%esp), %eax
>   	cmpl	%eax, 16(%esp)
> -	jb	__chk_fail
> -	jmp	memset
> +	jb	HIDDEN_JUMPTARGET (__chk_fail)
> +	jmp	JUMPTARGET (memset)
>   END (__memset_chk)
>   libc_hidden_builtin_def (__memset_chk)
>   #endif
  

Patch

diff --git a/sysdeps/i386/memcpy_chk.S b/sysdeps/i386/memcpy_chk.S
index 7b12c12aba..1676de4fff 100644
--- a/sysdeps/i386/memcpy_chk.S
+++ b/sysdeps/i386/memcpy_chk.S
@@ -28,8 +28,8 @@ 
 ENTRY (__memcpy_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
-	jb	__chk_fail
-	jmp	memcpy
+	jb	HIDDEN_JUMPTARGET (__chk_fail)
+	jmp	JUMPTARGET (memcpy)
 END (__memcpy_chk)
 libc_hidden_builtin_def (__memcpy_chk)
 #endif
diff --git a/sysdeps/i386/memmove_chk.S b/sysdeps/i386/memmove_chk.S
index 604aea8305..785b27373b 100644
--- a/sysdeps/i386/memmove_chk.S
+++ b/sysdeps/i386/memmove_chk.S
@@ -27,8 +27,8 @@ 
 ENTRY (__memmove_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
-	jb	__chk_fail
-	jmp	memmove
+	jb	HIDDEN_JUMPTARGET (__chk_fail)
+	jmp	JUMPTARGET (memmove)
 END (__memmove_chk)
 libc_hidden_builtin_def (MEMMOVE_CHK)
 #endif
diff --git a/sysdeps/i386/mempcpy_chk.S b/sysdeps/i386/mempcpy_chk.S
index 276eab1e8a..f58ca96e16 100644
--- a/sysdeps/i386/mempcpy_chk.S
+++ b/sysdeps/i386/mempcpy_chk.S
@@ -27,8 +27,8 @@ 
 ENTRY (__mempcpy_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
-	jb	__chk_fail
-	jmp	__mempcpy
+	jb	HIDDEN_JUMPTARGET (__chk_fail)
+	jmp	HIDDEN_JUMPTARGET (__mempcpy)
 END (__mempcpy_chk)
 libc_hidden_builtin_def (__mempcpy_chk)
 #endif
diff --git a/sysdeps/i386/memset_chk.S b/sysdeps/i386/memset_chk.S
index a2e9208e1c..9901ca6d52 100644
--- a/sysdeps/i386/memset_chk.S
+++ b/sysdeps/i386/memset_chk.S
@@ -27,8 +27,8 @@ 
 ENTRY (__memset_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
-	jb	__chk_fail
-	jmp	memset
+	jb	HIDDEN_JUMPTARGET (__chk_fail)
+	jmp	JUMPTARGET (memset)
 END (__memset_chk)
 libc_hidden_builtin_def (__memset_chk)
 #endif