From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 13159385842B for ; Wed, 27 Apr 2022 18:49:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13159385842B Received: by mail-oi1-x22a.google.com with SMTP id e4so2979547oif.2 for ; Wed, 27 Apr 2022 11:49:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=RU8mJtuF3greCAdO/Hed3vh40okIC9XPg3/BcQsKYqs=; b=8EPYLw2b0A2NveXjgVSVu7wMaZ7d5c/04wHJNkgHgkP1hvwZ0b+Q672tdoQYVS5k/7 Vjf/tztN+v+AycNqMwS7sN7SbjlBIfGm5ohJWg5iS99834FRRbiBT7o7Ch+ergnH9WHl Z4txU+znyEDW9FF+FwPte1EjhmmaTJmjEKnZU/DErmfWLSoyiruUrtUczrpkK3H8u6zt miQG62K9a6cLH3ssVZ5oz7y+1BPZuF0Kxx++mJKycEtSihpzX/H5QSTldbtS1Nebr3dg kBdmG5RsOGDNUAnM/vFN0I276X2eFCNNY1DMbxYa8f2K255ELZC+v0sqmQk2fnphc4wh chNg== X-Gm-Message-State: AOAM533GPJT4GTmCH0P3LFhDhtQVofNI5sb2vOPe2NfzOC4lLWvVc2Wz gjNsvEHPkgkGxEHEHNtlzMNvLwmfcAYufQ== X-Google-Smtp-Source: ABdhPJxVTa9AyP5hcvD2Pzbs3JuTGwYEcxaE3jCUX0MlePLguAmA9xWJiOLuq7w/pYlBBpQDWnmL3w== X-Received: by 2002:a05:6808:4c4:b0:325:2247:7c24 with SMTP id a4-20020a05680804c400b0032522477c24mr8510114oie.231.1651085356353; Wed, 27 Apr 2022 11:49:16 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:4214:b613:182d:cdde:5f86? ([2804:431:c7ca:4214:b613:182d:cdde:5f86]) by smtp.gmail.com with ESMTPSA id s10-20020a056830148a00b005ea12d6454bsm4810733otq.38.2022.04.27.11.49.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Apr 2022 11:49:15 -0700 (PDT) Message-ID: <916fffc4-7cc5-4cc7-5fc0-61ddd17d31d1@linaro.org> Date: Wed, 27 Apr 2022 15:49:13 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 2/4] Consolidate stdio-lock.h Content-Language: en-US To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha References: <20220426191523.833171-1-adhemerval.zanella@linaro.org> <20220426191523.833171-3-adhemerval.zanella@linaro.org> <87o80mhd4u.fsf@oldenburg.str.redhat.com> <874k2ee79d.fsf@oldenburg.str.redhat.com> <87o80mcqng.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87o80mcqng.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 27 Apr 2022 18:49:18 -0000 On 27/04/2022 15:44, Florian Weimer wrote: > * Adhemerval Zanella: > >> You are right. The change now uses __libc_cleanup_region_start from >> libc-lock.h instead of the cleanup version. I am not sure about >> hardening, but afaiu __libc_cleanup_push_defer should handle C++ >> unwinding for fopencookie. > > No, C++ unwinding will right go through these frames. We only > interleave in the other direction (pthread_cancel unwinding running C++ > destructors). Right, so Hurd version is indeed broken. > >> It seems that the Hurd version is indeed to the best option, so I think for >> generic it would be better to just use: >> >> diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h >> index 14cf458bdd..a42131f5a5 100644 >> --- a/sysdeps/generic/stdio-lock.h >> +++ b/sysdeps/generic/stdio-lock.h >> @@ -45,20 +45,12 @@ __libc_lock_define_recursive (typedef, _IO_lock_t) >> #define _IO_cleanup_region_end(_doit) \ >> __libc_cleanup_region_end (_doit) >> >> -#if defined _LIBC && IS_IN (libc) >> - >> -# ifdef __EXCEPTIONS >> -# define _IO_acquire_lock(_fp) \ >> +#define _IO_acquire_lock(_fp) \ >> do { \ >> FILE *_IO_acquire_lock_file \ >> __attribute__((cleanup (_IO_acquire_lock_fct))) \ >> = (_fp); \ >> _IO_flockfile (_IO_acquire_lock_file); >> -# else >> -# define _IO_acquire_lock(_fp) _IO_acquire_lock_needs_exceptions_enabled >> -# endif >> -# define _IO_release_lock(_fp) ; } while (0) >> - >> -#endif >> +#define _IO_release_lock(_fp) ; } while (0) >> >> #endif /* stdio-lock.h */ > > I suppose so. > I will update the patch.