[09/10] hurd: Also make it possible to call strlen very early

Message ID 20230517191436.73636-10-bugaevc@gmail.com
State Committed
Commit c93ee967cd688bc6d43c795b48e988075655a67f
Headers
Series Stack setup & misc fixes for x86_64-gnu |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Sergey Bugaev May 17, 2023, 7:14 p.m. UTC
  strlen, which is another ifunc-selected function, is invoked during
early static executable startup if the argv arrives from the exec
server. Make it not crash.

Checked on x86_64-gnu: statically linked executables launched after the
exec server is up now start up successfully.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 sysdeps/mach/hurd/x86_64/static-start.S | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Samuel Thibault May 17, 2023, 9:04 p.m. UTC | #1
Applied, thanks!

Sergey Bugaev, le mer. 17 mai 2023 22:14:35 +0300, a ecrit:
> strlen, which is another ifunc-selected function, is invoked during
> early static executable startup if the argv arrives from the exec
> server. Make it not crash.
> 
> Checked on x86_64-gnu: statically linked executables launched after the
> exec server is up now start up successfully.
> 
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  sysdeps/mach/hurd/x86_64/static-start.S | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sysdeps/mach/hurd/x86_64/static-start.S b/sysdeps/mach/hurd/x86_64/static-start.S
> index cc8e2410..0fed375c 100644
> --- a/sysdeps/mach/hurd/x86_64/static-start.S
> +++ b/sysdeps/mach/hurd/x86_64/static-start.S
> @@ -22,6 +22,9 @@ _start:
>  
>  	leaq __memcpy_sse2_unaligned(%rip), %rax
>  	movq %rax, memcpy@GOTPCREL(%rip)
> +	leaq __strlen_sse2(%rip), %rax
> +	movq %rax, strlen@GOTPCREL(%rip)
> +
>  	call _hurd_stack_setup
>  	xorq %rdx, %rdx
>  	jmp _start1
> -- 
> 2.40.1
> 
>
  

Patch

diff --git a/sysdeps/mach/hurd/x86_64/static-start.S b/sysdeps/mach/hurd/x86_64/static-start.S
index cc8e2410..0fed375c 100644
--- a/sysdeps/mach/hurd/x86_64/static-start.S
+++ b/sysdeps/mach/hurd/x86_64/static-start.S
@@ -22,6 +22,9 @@  _start:
 
 	leaq __memcpy_sse2_unaligned(%rip), %rax
 	movq %rax, memcpy@GOTPCREL(%rip)
+	leaq __strlen_sse2(%rip), %rax
+	movq %rax, strlen@GOTPCREL(%rip)
+
 	call _hurd_stack_setup
 	xorq %rdx, %rdx
 	jmp _start1