From patchwork Wed May 17 19:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 69553 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 B690C3882674 for ; Wed, 17 May 2023 19:16:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B690C3882674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684350995; bh=scwiVF/vMF8p8A/eAORjCkOU/PAbDLBDq9Zi0mkKLvY=; 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=CTaaIwn2rfIISvLliu4qye46bV7dcAtVXOsQh0uAsmS8Z/jOBNUY3J1HJ7egTmE2D a37rLy6Edt/1FsSiYrN0gVGAwQKtu/TbFHlJfPPItUmjTQJRVctp9yVpkhBT9Ea9KG 3tPMs0gs62uWv7ln6zV4VOH4CLrOQMvgnwd+JdM4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id 32F0F3856976 for ; Wed, 17 May 2023 19:14:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32F0F3856976 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f24d4900bbso1387532e87.3 for ; Wed, 17 May 2023 12:14:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684350885; x=1686942885; 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=scwiVF/vMF8p8A/eAORjCkOU/PAbDLBDq9Zi0mkKLvY=; b=Zqbwldu/HSgig2N+6oQTqCHM7lcBrsly94QpUhD/eLpBxFIGJS1kwU8lIokqJKYJ0j yUOaAQwI6c/fmHEYaLc7j27Jd9lVcixMBnXhyKcxxl/TWTPoKilIAdLcOj5/AMZ6SMFM uRTO5uDYq0+P+q+R/CXaDWa403rLKl05QySMePcJTYKtaKFANya+RMSCQ21wwVkDsvD+ BJ9eqXP0Rxxw0E0TfhhBEEyR9s5BUhaaNizjKVLjZGbSk4bmS8w8MFDTlhm5dszOG32V HgXVlGnxmkUfgn12lUOa7KLGHdeddAypy3bZzqo9sWz4AmqXadxvK9t1M6VW37MrZgbc CNLg== X-Gm-Message-State: AC+VfDxEj0Xr1pyYtudaDb8FfaVv76732/RCsT2X8pHvmqvrL9OsLD0D TQ0QDZ+RtVrv4Fkk8DaBMU5NJ8onqTs= X-Google-Smtp-Source: ACHHUZ5bXS1oeKlGfUXjSssLrD1MlXjWewf+sRal5mQVIAP0eBOEmVBJCG+sLSdxWuCXD4hyj0VT2g== X-Received: by 2002:a19:ad4a:0:b0:4ed:c286:7ab6 with SMTP id s10-20020a19ad4a000000b004edc2867ab6mr470538lfd.67.1684350885169; Wed, 17 May 2023 12:14:45 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id o18-20020ac24352000000b004eed8de597csm3415744lfl.32.2023.05.17.12.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 12:14:44 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: [PATCH 05/10] hurd: Use __mach_setup_thread_call () Date: Wed, 17 May 2023 22:14:31 +0300 Message-Id: <20230517191436.73636-6-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230517191436.73636-1-bugaevc@gmail.com> References: <20230517191436.73636-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" ...instead of mach_setup_thread (), which is unsuitable for setting up function calls. Checked on x86_64-gnu: the signal thread no longer crashes upon trying to process a message. Signed-off-by: Sergey Bugaev --- hurd/hurdsig.c | 10 ++++++---- sysdeps/mach/hurd/profil.c | 5 +++-- sysdeps/mach/hurd/setitimer.c | 11 ++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 78ea59d9..313e95ae 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -22,6 +22,7 @@ #include /* For `struct mutex'. */ #include #include +#include #include #include #include @@ -1525,10 +1526,11 @@ _hurdsig_init (const int *intarray, size_t intarraysize) assert_perror (err); stacksize = __vm_page_size * 8; /* Small stack for signal thread. */ - err = __mach_setup_thread (__mach_task_self (), _hurd_msgport_thread, - _hurd_msgport_receive, - (vm_address_t *) &__hurd_sigthread_stack_base, - &stacksize); + err = __mach_setup_thread_call (__mach_task_self (), + _hurd_msgport_thread, + _hurd_msgport_receive, + (vm_address_t *) &__hurd_sigthread_stack_base, + &stacksize); assert_perror (err); err = __mach_setup_tls (_hurd_msgport_thread); assert_perror (err); diff --git a/sysdeps/mach/hurd/profil.c b/sysdeps/mach/hurd/profil.c index 64fe76f7..8092df0a 100644 --- a/sysdeps/mach/hurd/profil.c +++ b/sysdeps/mach/hurd/profil.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -68,8 +69,8 @@ update_waiter (u_short *sample_buffer, size_t size, size_t offset, u_int scale) /* Set up the profiling collector thread. */ err = __thread_create (__mach_task_self (), &profile_thread); if (! err) - err = __mach_setup_thread (__mach_task_self (), profile_thread, - &profile_waiter, NULL, NULL); + err = __mach_setup_thread_call (__mach_task_self (), profile_thread, + &profile_waiter, NULL, NULL); if (! err) err = __mach_setup_tls(profile_thread); } diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c index d09c59dc..03191b91 100644 --- a/sysdeps/mach/hurd/setitimer.c +++ b/sysdeps/mach/hurd/setitimer.c @@ -25,6 +25,7 @@ #include #include #include +#include /* XXX Temporary cheezoid implementation of ITIMER_REAL/SIGALRM. */ @@ -227,11 +228,11 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old, goto out; _hurd_itimer_thread_stack_base = 0; /* Anywhere. */ _hurd_itimer_thread_stack_size = __vm_page_size; /* Small stack. */ - if ((err = __mach_setup_thread (__mach_task_self (), - _hurd_itimer_thread, - &timer_thread, - &_hurd_itimer_thread_stack_base, - &_hurd_itimer_thread_stack_size)) + if ((err = __mach_setup_thread_call (__mach_task_self (), + _hurd_itimer_thread, + &timer_thread, + &_hurd_itimer_thread_stack_base, + &_hurd_itimer_thread_stack_size)) || (err = __mach_setup_tls(_hurd_itimer_thread))) { __thread_terminate (_hurd_itimer_thread);