From: "Gabriel F. T. Gomes" <gabriel@inconstante.net.br>
To: Florian Weimer <fweimer@redhat.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Add the --with-tty-gid configure option [BZ #24941]
Date: Thu, 31 Oct 2019 20:41:00 -0000 [thread overview]
Message-ID: <20191031174137.2e57aec6@tereshkova> (raw)
In-Reply-To: <87h862kdyx.fsf@oldenburg2.str.redhat.com>
Hi, Florian,
Thanks for, in the bug report [1], helping me understand the rationale for
this patch (the problem was well described here, anyway, I had just failed
to notice the details).
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=24941#c3
On Tue, 27 Aug 2019, Florian Weimer wrote:
>2019-08-27 Florian Weimer <fweimer@redhat.com>
>
> [BZ #24941]
> Add the --with-tty-gid configure option.
> * config.make.in (define-tty-gid-cflags): New variable.
> * configure.ac (--with-tty-gid): New option.
> * manual/install.texi (Configuring and compiling): Document
> --with-tty-gid.
> * sysdeps/unix/Makefile [$(subdir) == login] (CFLAGS-grantpt.c):
> Add $(define-tty-gid-cflags).
> * sysdeps/unix/grantpt.c (grantpt): Use TTY_GID constant for gid
> if defined.
> * configure, INSTALL: Regeneration.
I thinks this needs a new commit message, preferably one that summarizes
why this patch is useful... Something in the lines of:
When, in multi-threaded applications, a forked process tries to call
grantpt, it could hang in an internal NSS lock (__nss_database_lookup2),
if the fork happened while NSS was used in another thread. This patch
adds the --with-tty-gid configure option, which avoids the hang, by
avoiding calls to NSS functions.
Other than that, the patch looks good to me.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Thanks
>+@item --with-tty-gid=@var{GID}
>+Use @var{GID} as the value for the group ID of the @samp{tty} group.
>+This enables a more efficient implementation of the @code{grantpt}
>+function, and the function will also work reliably in a forked
>+subprocess of a multi-threaded process.
OK.
>+#ifdef TTY_GID
>+ /* TTY_GID is set by the --with-tty-gid configure option. */
>+ enum { gid = TTY_GID };
>+#else
> static int tty_gid = -1;
> if (__glibc_unlikely (tty_gid == -1))
> {
>@@ -154,6 +158,7 @@ grantpt (int fd)
> tty_gid = p->gr_gid;
> }
> gid_t gid = tty_gid == -1 ? __getgid () : tty_gid;
>+#endif
OK.
next prev parent reply other threads:[~2019-10-31 20:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 12:08 Florian Weimer
2019-10-31 20:41 ` Gabriel F. T. Gomes [this message]
2020-05-27 10:02 ` Florian Weimer
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=20191031174137.2e57aec6@tereshkova \
--to=gabriel@inconstante.net.br \
--cc=fweimer@redhat.com \
--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).