From patchwork Mon May 15 08:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 69333 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F2FD3852763 for ; Mon, 15 May 2023 08:34:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F2FD3852763 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684139652; bh=ElD5vij6z0NOC9LExmvj9x6QlpyxmJWP2tS6D2b6jqQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=KrKQ4wHMJ3xs/Z3KXAXR7uyWOHQJCyXzSgDIImlJCJFg4WJiwWkIIFIGwqi+zPRJ6 yUuplmiP/XT9qHAe7J+RAB7HFWd9SgBuyZuPv1b9+MaMC56kUQkboYwpAq5AvRjS0D am09KYo5rDpXFj2HT3EmHx8lufN2rlE8x7kM55Ts= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id C917F385701E for ; Mon, 15 May 2023 08:33:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C917F385701E Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2ac7de2b72fso136039261fa.1 for ; Mon, 15 May 2023 01:33:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684139607; x=1686731607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ElD5vij6z0NOC9LExmvj9x6QlpyxmJWP2tS6D2b6jqQ=; b=U8OBhnzzx/DdBZ60K90yineilzq7Q0WpnmB+By9WAEfLiRwKwonxIocwAWDrF+6UoK LfJNYLouAE4gEaKOrcjCC+dejGAjMRMIqUbUcUJ+Y8vlHhrw62d4YA912HoQKacvBmKJ AkqGJ1QjparlwoVhiJ9W/l2PT0W2eTbkPplnaw9E3yI/ZTOSAuKDrT8B3pfLdXTy4LOV oRtgdJbLwOlHvavE/XqVD3+NmaSfclL0kp6VNpr+fHumdlUrPbL7UNXKWC4tlPDWUOVM Ids6FNxOm+nCz008KuAJKNXrtDqE2xkTSCpRTeEdIlD/oOkcltpRs/WAk9V4P1HVKgFW I9CA== X-Gm-Message-State: AC+VfDwS28jBfy7jlO2gTfMihb20V8Xi0mQXFrCtG5xckZiTwNkbHWyj OnTx5q8OY/Gp34U34B2o7Eaiq4Fuzmc= X-Google-Smtp-Source: ACHHUZ4M5y6wC0ngCfxkbEU+F0jiVLztJ3gXOdSJpQatH+16yRzm8PYl/8dRMaLXz2jggiXQO/eGsg== X-Received: by 2002:ac2:4825:0:b0:4f1:47be:8db6 with SMTP id 5-20020ac24825000000b004f147be8db6mr7055887lft.56.1684139606820; Mon, 15 May 2023 01:33:26 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id p3-20020a05651238c300b004f251e73fc5sm2510677lft.30.2023.05.15.01.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 01:33:26 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: [PATCH 2/4] hurd: Align signal stack pointer after allocating stackframe Date: Mon, 15 May 2023 11:33:21 +0300 Message-Id: <20230515083323.1358039-3-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515083323.1358039-1-bugaevc@gmail.com> References: <20230515083323.1358039-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" sizeof (*stackframe) appears to be divisible by 16, but we should not rely on that. So make sure to leave enough space for the stackframe first, and then align the final pointer at 16 bytes. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/x86/trampoline.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c index 19bddad8..1f92064e 100644 --- a/sysdeps/mach/hurd/x86/trampoline.c +++ b/sysdeps/mach/hurd/x86/trampoline.c @@ -196,15 +196,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action #endif } + /* Push the arguments to call `trampoline' on the stack. */ + sigsp -= sizeof (*stackframe); #ifdef __x86_64__ /* Align SP at 16 bytes. Coupled with the fact that sigreturn_addr is 16-byte aligned within the stackframe struct, this ensures that it ends up on a 16-byte aligned address, as required by the ABI. */ sigsp = (void *) ((uintptr_t) sigsp & ~15UL); #endif - - /* Push the arguments to call `trampoline' on the stack. */ - sigsp -= sizeof (*stackframe); stackframe = sigsp; if (_hurdsig_catch_memory_fault (stackframe))