From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 1ABF738582BD for ; Wed, 2 Aug 2023 12:32:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1ABF738582BD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6bc8d1878a0so4055119a34.1 for ; Wed, 02 Aug 2023 05:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690979556; x=1691584356; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=6zGi/E4kcoRvkNkPOt0zUlwXLlzOr3TeL8SonwV2nFk=; b=ImLgsZfMoLKWSAfqNYXyNT1KEK2ihlZ3q2RshdQcguBrFLA0cPJRqwdIHWIP1FmmzI dX7OSzDuFbyD1Vz/ypfccarG3x2SweEH5W2WnOAcpE18aqTHT2M1nSl2VFBbe3z+K+wi bZrFzybHbMt7KCSDCnplS/wonnBa14MBUDu3LoktxmbEKa3Kpw6Up2gl+iejw1+RL8pi Jf8xlcGgus9Xiko6ZeQJz/7vfBuW0Rpst1cXHpgEYCTLZ056wW33rXpMabAfqA8T14Ub AZndCf5A6riymvdCk+zsGeZhi++eIhxinCClVBcXQnBUHbxI2Jz2KZZce7oPU2KDDZct l18w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690979556; x=1691584356; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6zGi/E4kcoRvkNkPOt0zUlwXLlzOr3TeL8SonwV2nFk=; b=hFJsJSfbQpTRn6ghi0xHLtdmgRfFKLAq6sttfxHvOLd64wTYgBkhjocwzczhZvEOcJ cDXavEd7xwiDETxEEDI6gaEwCObSmloF22RIumaOFQWlI06sXM9rSTjMODytK7ErGCEk 2fbngbH5QlIGtM68oXe3ZMDFzYpYFlFTnpenx5zdGBS7vaVFBO4xaV7OcCGOEnoONS26 5wVjyvUbbUmustHBL1lofINqj35uCOTlYhZOfwX51jMWeDGVmv6O/zjIgqmC9KUAP2h+ eOrcZi4llBm/EMI2KZ/Fc3ncYDS9wGcQ87nFpE9KfKjgH/73zEjiiLWm/1E94NLOxkzM af2w== X-Gm-Message-State: ABy/qLbjcwRnCp/7+/25v9KCQiYwmz4ZNeD15Hn/PONzRW2De/KSbKsA X14xyXv63IJ8bcooPg/yyLmWeA== X-Google-Smtp-Source: APBJJlGZB9Dg11WmHeKrmyY9D5Sj7QH3jjfp9l4Zp23UYtBDzh7DSbs+vX8dD8B6qBpxmU2xtjcvQw== X-Received: by 2002:a05:6830:111a:b0:6b9:d06a:1284 with SMTP id w26-20020a056830111a00b006b9d06a1284mr15866468otq.21.1690979556295; Wed, 02 Aug 2023 05:32:36 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:9aa9:84f6:53b3:4cd0:ffe6? ([2804:1b3:a7c1:9aa9:84f6:53b3:4cd0:ffe6]) by smtp.gmail.com with ESMTPSA id h21-20020a9d61d5000000b006b90b5626desm5844195otk.62.2023.08.02.05.32.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Aug 2023 05:32:35 -0700 (PDT) Message-ID: Date: Wed, 2 Aug 2023 09:32:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 1/2] setjmp: Use BSD sematic as default for setjmp Content-Language: en-US To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha , Carlos O'Donell References: <20230731171900.4065501-1-adhemerval.zanella@linaro.org> <20230731171900.4065501-2-adhemerval.zanella@linaro.org> <871qgn5fds.fsf@oldenburg.str.redhat.com> <40947004-fcac-d50c-feea-3a6512a10d69@linaro.org> <87cz05yivp.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <87cz05yivp.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 List-Id: On 02/08/23 04:59, Florian Weimer wrote: > * Adhemerval Zanella Netto: > >> On 01/08/23 05:35, Florian Weimer wrote: >>> * Adhemerval Zanella via Libc-alpha: >>> >>>> POSIX relaxed the relation of setjmp/longjmp and the signal mask >>>> save/restore, meaning that setjmp does not require to be routed to >>>> _setjmp to be standard compliant. >>>> >>>> This is done to avoid breakage of SIGABRT handlers, since to fully >>>> make abort AS-safe, it is required to remove the recurisve lock >>>> used to unblock SIGABRT prior raised the signal. >>>> >>>> Also, it allows caller to actually use setjmp, since from >>>> 7011c2622fe3e10a29dbe74f06aaebd07710127d the symbol is unconditionally >>>> routed to _setjmp. >>> >>> Doesn't this have non-trivial performance impact? >> >> Yes, it is two extra sigprocmask to get/set the signal mask. This is >> not *strictly* required, but the SIGABRT on abort generates racy >> conditions on process creation and. This patch can be dropped, but it >> would mean that to get expected semantic for abort handlers will need >> to use sigsetjmp (..., 1) instead of setjmp. > > Sorry, I don't understand? With the current locking, this change should > really not be required because the user SIGABRT handler does not run > with the signal mask changed. > This change is only required to keep the same semantic of setjmp/longjmp regarding SIGABRT handler, where current code keeps subsequent SIGABRT installed with default flags to not keep the signal masked. Otherwise, users that callers that handle SIGABRT will need to either a different sigaction mask that do no change the blocked signals while handling the signal, call sigprocmask after SIGABRT returns from longjmp, or use sigsetjmp.