This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] libio: do not unbuffer legacy standard files in compatibility mode [BZ #24228]
- From: Florian Weimer <fweimer at redhat dot com>
- To: "Dmitry V. Levin" <ldv at altlinux dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 13 Mar 2019 16:08:16 +0100
- Subject: Re: [PATCH v3] libio: do not unbuffer legacy standard files in compatibility mode [BZ #24228]
- References: <20190218124438.GB20127@altlinux.org> <87mumtcl0w.fsf@oldenburg2.str.redhat.com> <20190218191021.GA25527@altlinux.org> <20190219005741.GA29070@altlinux.org> <20190219012913.GB29070@altlinux.org>
* Dmitry V. Levin:
> Commit glibc-2.23~693 (a601b74d31ca086de38441d316a3dee24c866305)
Please quote the commit hash and commit subject, kernel-style. (How did
you determine this reference, anyway?)
> diff --git a/libio/genops.c b/libio/genops.c
> index 2a0d9b81df..aa92d61b6b 100644
> --- a/libio/genops.c
> +++ b/libio/genops.c
> @@ -789,6 +789,10 @@ _IO_unbuffer_all (void)
>
> for (fp = (FILE *) _IO_list_all; fp; fp = fp->_chain)
> {
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> + if (__glibc_unlikely (&_IO_stdin_used == NULL) && _IO_legacy_file (fp))
> + continue;
> +#endif
I wonder if we should check _IO_legacy_file only here. This is related
to the previous discussion.
> diff --git a/libio/tst-bz24228.c b/libio/tst-bz24228.c
> new file mode 100644
> index 0000000000..3692f14b71
> --- /dev/null
> +++ b/libio/tst-bz24228.c
> @@ -0,0 +1,30 @@
> +/* BZ #24228 check for memory corruption in legacy libio
> +
> + Copyright (C) 2019 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
We do not generally have a blank line for the “Copyright” line, I think.
> +#include <mcheck.h>
> +#include <support/test-driver.h>
> +
> +static int
> +do_test (void)
> +{
> + mtrace ();
> + return 0;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/libio/tst-bz24228.map b/libio/tst-bz24228.map
> new file mode 100644
> index 0000000000..ecb8c058f5
> --- /dev/null
> +++ b/libio/tst-bz24228.map
> @@ -0,0 +1,3 @@
> +{
> + local: _IO_stdin_used;
> +};
Please add a comment to the file why you are doing this, something like
“hide the symbol from libc.so.6 to switch to the libio/oldfileops.c
implementation (if it is available for the architecture)”.
Thanks,
Florian