From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id B38573858C5F for ; Fri, 4 Aug 2023 12:36:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B38573858C5F 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-oa1-x30.google.com with SMTP id 586e51a60fabf-1bbb4bde76dso1359456fac.2 for ; Fri, 04 Aug 2023 05:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691152594; x=1691757394; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=L4LeERf0rUDCmhS4cgUScXOI5w4fjSwmemInTKdGGLU=; b=ImJ28vS5TFahGnhr6G9/hbCQiExBqkkWRSoGQdVQuYGt9o1WqP+uJKP+ndGHX+vPfB /gAyi7GaKg1GYpphdDyvRMSRecFQcS5xpPg+BCYF6TP5PHWYVTrLZidRrMRTXeO/YoFu R8h5+r6uYBrsWru3esIBpujxaLOl6eQ9lSaaBMonzpR8jIVr7s3yvJhlNbKR3+/x9CX/ xloq+2dLWKOMnQQN4Jme8Li9UEz4bfExHV4iTtvOHZdS2tkdtk63JN+JtFXcfkbpKpMt O83IEKjPyWjyKelXfWMxHLdQWTxFjUnFKRrEA7PFbh5C/1L58GlXRWXLpNC1AaVesjF1 BOJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691152594; x=1691757394; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L4LeERf0rUDCmhS4cgUScXOI5w4fjSwmemInTKdGGLU=; b=JnG8F+pcJ1NTysp40HGleHfhJ+Hnrpl1mpHhjnakM5y9rUxtEjamf1i3s38+CWpxTf RWcmJ4nQfBpHq1dw3xgumc2UMfwlcrMo/0Dw3EH7M6xP4k3oSNdBh14N0pNegTg/MGQW uLx8LuSn08bGYxibi+YGGUYgS0/qusH0CWWwWpfztvF8nA/+rLGr/xyqqQX1ZrX4G98i HmNXp+yftcji96S5USNb1pPfkXAgn4FJEhkWuSfcqLE9npg2wZ8NBnWkvCXIBF4lsffQ qRORHOPjIVOtorTj9swaDJvZHXDFi+RKXwKwBPdet9KRrX+POpPvHFnLukzPCOOcG3wq mJnQ== X-Gm-Message-State: AOJu0YwGy5HrRGsJ97JHOoheRDsbZSh8tXux+s802y9u44p3lAhk514k bGuq4AjG9bLlHHkNnmV+e7gS2Q== X-Google-Smtp-Source: AGHT+IGq7yY+o6ehz6b6+eRZ9J9VBkVqAXJcGmZJMyr/U0aLwcJAVZ2AZxEIxCVpOMooVtnVs/5mdw== X-Received: by 2002:a05:6870:d10b:b0:1ba:629a:e34a with SMTP id e11-20020a056870d10b00b001ba629ae34amr1901157oac.12.1691152594503; Fri, 04 Aug 2023 05:36:34 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:9aa9:4d9b:c1fc:878b:d33a? ([2804:1b3:a7c1:9aa9:4d9b:c1fc:878b:d33a]) by smtp.gmail.com with ESMTPSA id e15-20020a056871044f00b001bb58a346b8sm1038094oag.18.2023.08.04.05.36.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 05:36:33 -0700 (PDT) Message-ID: Date: Fri, 4 Aug 2023 09:36:30 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v2 1/2] setjmp: Use BSD sematic as default for setjmp To: Florian Weimer Cc: libc-alpha@sourceware.org, Carlos O'Donell References: <20230803173436.4146900-1-adhemerval.zanella@linaro.org> <20230803173436.4146900-2-adhemerval.zanella@linaro.org> <87bkfndwop.fsf@oldenburg.str.redhat.com> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <87bkfndwop.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 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 04/08/23 05:43, Florian Weimer wrote: > * Adhemerval Zanella: > >> 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. > > I still think we shouldn't do this due to the performance implications. By not changing it and with the abort AS-safe fix, the following code will always abort the program: -- static jmp_buf jb; static void sigabrt_handler (int sig) { longjmp (jb, 1); } struct sigaction sa = { .sa_handler = sigabrt_handler, .sa_flags = 0 }; sigemptyset (&sa.sa_mask); assert (sigaction (SIGABRT, &sa, 0) == 0); if (setjmp (jb) == 0) abort (); if (setjmp (jb) == 0) abort (); // No reached. -- Callers will need to change to sigsetjmp (..., 1) to have the same semantic. That's the main reason I am suggesting this patch.