From patchwork Sat Jan 31 16:06:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 129367 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id E43794BAD179 for ; Sat, 31 Jan 2026 16:07:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E43794BAD179 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id A819C4BA2E07 for ; Sat, 31 Jan 2026 16:06:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A819C4BA2E07 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A819C4BA2E07 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769875594; cv=none; b=eN6O+2OExeZ3M7CahQjZQYNe2kKu96FYJyqrn3VjeAlz/q5CRslG+4FXlQzfY5ELvnMNT+waGMy6WkAWYQC4VW0/xHi8IKq6sqzbXyh2hHbvMubqbK2+F4oYrn+WXQA8wrf2oxpg65me8WunxNFdRjRBInhWcilTm+wUmwfTQ/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769875594; c=relaxed/simple; bh=FZGytcMnjIGnYK2ExEANx0i5HC+UAFJajl+y+j+JWwc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UoNL2CuH9QJ7WfwabMFtJN7Y/xVzKF+puO6Licm8fEHxxeUZ0cmfMLNbGnyFovTKoXn06NwDHmyFeQslVrj8XChzOLlBTUalYzZWhCregQTJXiaTBqYP6zL9DeBB5NkN7HbGCBuMwPOJm8JDCBZmeRiu2qcsYyDktl0+2Js+wOY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A819C4BA2E07 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 9D9DAA0667; Sat, 31 Jan 2026 17:06:33 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1K_6L7UZBUc4; Sat, 31 Jan 2026 17:06:33 +0100 (CET) Received: from end (unknown [164.15.244.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 6E45AA0407; Sat, 31 Jan 2026 17:06:33 +0100 (CET) Received: from samy by end with local (Exim 4.99.1) (envelope-from ) id 1vmDUR-00000000DlA-188I; Sat, 31 Jan 2026 17:06:27 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: copy over start/end and entry too on fork Date: Sat, 31 Jan 2026 17:06:26 +0100 Message-ID: <20260131160626.52885-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org 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.