[PATCH v2] time: Avoid memcmp overread in tzset (bug 31931)

Florian Weimer fweimer@redhat.com
Thu Jun 27 06:34:15 GMT 2024


* Florian Weimer:

> The test does not necessarily trigger the crash, depending on memcmp
> behavior.  A crash was observed in __memcmp_ia32 on i686 builds.
>
> Tested on i686-linux-gnu.
>
> ---
> v2: Style fix for boolean comparison.  Fix putenv argument in the test.
>  time/Makefile           |  5 ++++-
>  time/tst-tzfile-fault.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  time/tzfile.c           |  5 +++--
>  3 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/time/Makefile b/time/Makefile
> index 5b541fb9d3..f4c75b786d 100644
> --- a/time/Makefile
> +++ b/time/Makefile
> @@ -50,7 +50,8 @@ tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
>  	   tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \
>  	   tst-adjtime tst-ctime tst-difftime tst-mktime4 tst-clock_settime \
>  	   tst-settimeofday tst-itimer tst-gmtime tst-timegm \
> -	   tst-timespec_get tst-timespec_getres tst-strftime4
> +	   tst-timespec_get tst-timespec_getres tst-strftime4 \
> +	   tst-tzfile-fault
>  
>  tests-time64 := \
>    tst-adjtime-time64 \
> @@ -110,3 +111,5 @@ tst-tzname-ENV = TZDIR=${common-objpfx}timezone/testdata
>  CPPFLAGS-tst-tzname.c += -DTZDEFRULES='"$(posixrules-file)"'
>  
>  bug-getdate1-ARGS = ${objpfx}bug-getdate1-fmt
> +
> +tst-tzfile-fault-ENV = GLIBC_TUNABLES=glibc.rtld.enable_secure=1

How should we backport this?  The tunable glibc.rtld.enable_secure only
exists in 2.40.  The fix obviously applies to earlier releases as well.

Thanks,
Florian



More information about the Libc-stable mailing list