From patchwork Sat Jan 17 14:17:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 128380 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 1F4C84BA23E0 for ; Sat, 17 Jan 2026 14:17:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4C84BA23E0 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 4A9EA4BA2E2E for ; Sat, 17 Jan 2026 14:17:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4A9EA4BA2E2E 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 4A9EA4BA2E2E 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=1768659450; cv=none; b=uNQjGBfL3Xt97/u1VHM0An77X1EqqGfyLN70wJ0x8kAGIw/2owBQm5iyHiRjuO5qQCp2J5JI8JZ1LNfSt9xd05hjXFjEYfxLbeUhQQYJRWFj27Oe2x+LbythKNlH139XVm4xc0OcjfTbop4K4zPHavE6wYZ9Jc1VV03uDCf5SRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768659450; c=relaxed/simple; bh=xb3TwtmYLuaZbUMvfWOunCxMmCDR2HHQZOECbQ6lSOk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=RsrVF0+Zr96DYMppb+08EjIIPdd3QQs131WvX5IbSj3oBrOHvkwRUrd7n7acikfawkHeLx3liJtBj/aeKuWkAL9pwXqLpvkWj//JBL4/B1bkGd9KkuvVch2pm52yU2WXbMqdxyDPO5i5+0NdHsLYzhQaRxfZTaLGYE6EyTueZKo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A9EA4BA2E2E Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 288AFA0494; Sat, 17 Jan 2026 15:17:29 +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 fJ7_dO4L_SvM; Sat, 17 Jan 2026 15:17:29 +0100 (CET) Received: from end (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (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 0B3DEA027E; Sat, 17 Jan 2026 15:17:29 +0100 (CET) Received: from samy by end with local (Exim 4.99.1) (envelope-from ) id 1vh77I-00000003KAu-2U4c; Sat, 17 Jan 2026 15:17:28 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: make __thread_set_pcsptp align stack Date: Sat, 17 Jan 2026 15:17:28 +0100 Message-ID: <20260117141728.792529-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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, URIBL_BLOCKED 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 When cancelling a thread, __pthread_do_cancel forces calling call_exit, but we need to align down the stack, so any further SSE use can work. --- sysdeps/mach/hurd/x86_64/htl/pt-machdep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c index 2cb0ce9838..e11a1f994b 100644 --- a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c +++ b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c @@ -24,6 +24,7 @@ #include #include #include +#include #include int @@ -48,7 +49,11 @@ __thread_set_pcsptp (thread_t thread, if (set_sp) state.ursp = (uintptr_t) sp; if (set_ip) - state.rip = (uintptr_t) ip; + { + /* Making it call something else, we have to re-align the stack for SSE. */ + state.ursp = PTR_ALIGN_DOWN_8_16 (state.ursp); + state.rip = (uintptr_t) ip; + } err = __thread_set_state (thread, i386_REGS_SEGS_STATE, (thread_state_t) &state, i386_THREAD_STATE_COUNT);