public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 2/4] Consolidate stdio-lock.h
Date: Wed, 27 Apr 2022 20:44:35 +0200	[thread overview]
Message-ID: <87o80mcqng.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <e02ccf0b-23f3-e1a8-4381-af83e33c812e@linaro.org> (Adhemerval Zanella's message of "Wed, 27 Apr 2022 15:35:18 -0300")

* 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).

> 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.

Thanks,
Florian


  reply	other threads:[~2022-04-27 18:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 19:15 [PATCH v2 0/4] Move libio lock single-thread optimization to generic libc-lock Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 1/4] libio: Assume _IO_MTSAFE_IO Adhemerval Zanella
2022-04-27 12:34   ` Florian Weimer
2022-04-27 18:40     ` Adhemerval Zanella
2022-04-27 19:35       ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 2/4] Consolidate stdio-lock.h Adhemerval Zanella
2022-04-27 13:25   ` Florian Weimer
2022-04-27 16:15     ` Adhemerval Zanella
2022-04-27 18:00       ` Florian Weimer
2022-04-27 18:35         ` Adhemerval Zanella
2022-04-27 18:44           ` Florian Weimer [this message]
2022-04-27 18:49             ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 3/4] Move libio lock single-thread optimization to generic libc-lock (BZ #27842) Adhemerval Zanella
2022-04-27 13:30   ` Florian Weimer
2022-04-27 16:32     ` Adhemerval Zanella
2022-04-28 16:39       ` Adhemerval Zanella
2022-04-28 16:56         ` Florian Weimer
2022-04-28 17:14           ` Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 4/4] Assume _LIBC and libc module for libc-lock.h Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o80mcqng.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).