[hurd,commited] hurd: copy over start/end and entry too on fork

Samuel Thibault samuel.thibault@ens-lyon.org
Sat Jan 31 16:06:26 GMT 2026


gdb needs them to properly find libraries etc.
---
 sysdeps/mach/hurd/_Fork.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sysdeps/mach/hurd/_Fork.c b/sysdeps/mach/hurd/_Fork.c
index 7949f536c5..d2e393a631 100644
--- a/sysdeps/mach/hurd/_Fork.c
+++ b/sysdeps/mach/hurd/_Fork.c
@@ -460,9 +460,9 @@ retry:
 	LOSE;
 
       /* This seems like a convenient juncture to copy the proc server's
-	 idea of what addresses our argv and envp are found at from the
-	 parent into the child.  Since we happen to know that the child
-	 shares our memory image, it is we who should do this copying.  */
+	 idea of what addresses our argv, envp, start, end, entry are found at
+	 from the parent into the child.  Since we happen to know that the
+	 child shares our memory image, it is we who should do this copying. */
       {
 	vm_address_t argv, envp;
 	err = (__USEPORT (PROC, __proc_get_arg_locations (port, &argv, &envp))
@@ -470,6 +470,20 @@ retry:
 	if (err)
 	  LOSE;
       }
+      {
+	vm_address_t start, end;
+	err = (__USEPORT (PROC, __proc_get_code (port, &start, &end))
+	       ?: __proc_set_code (newproc, start, end));
+	if (err)
+	  LOSE;
+      }
+      {
+	vm_address_t entry;
+	err = (__USEPORT (PROC, __proc_get_entry (port, &entry))
+	       ?: __proc_set_entry (newproc, entry));
+	if (err)
+	  LOSE;
+      }
 
       /* Set the child signal thread up to run the msgport server function
 	 using the same signal thread stack copied from our address space.
-- 
2.51.0



More information about the Libc-alpha mailing list