This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Don't all __access_noerrno with stack protector from __tunables_init [BZ #21744]


"H.J. Lu" <hjl.tools@gmail.com> writes:

> maybe_enable_malloc_check, which is called by __tunables_init, call
> __access_noerrno.  It isn't problem when maybe_enable_malloc_check is
> is in ld.so, which has a special version of __access_noerrno without
> stack protector.  But when glibc is built with stack protector,
> maybe_enable_malloc_check in libc.a can't call the regular version of
> __access_noerrno with stack protector.
>
> This patch changes maybe_enable_malloc_check to call _dl_access_noerrno
> instead.  For ld.so or glibc built without stack protector, it is defined
> to __access_noerrno.  Otherwise a special version of __access_noerrno
> without stack protector is used by maybe_enable_malloc_check in libc.a.
>
> Tested on x86-64 with and without --enable-stack-protector=all.


> diff --git a/elf/dl-support.c b/elf/dl-support.c
> index c22be854f4..3228cf4020 100644
> --- a/elf/dl-support.c
> +++ b/elf/dl-support.c
> @@ -164,7 +164,13 @@ uint64_t _dl_hwcap2 __attribute__ ((nocommon));
>  /* The value of the FPU control word the kernel will preset in hardware.  */
>  fpu_control_t _dl_fpu_control = _FPU_DEFAULT;
>
> -#if !HAVE_TUNABLES
> +#if HAVE_TUNABLES
> +# ifdef __access_noerrno

It's necessary to include dl-tunables.h before testing for __access_noerrno.

Tested on ppc64le with that modification.

-- 
Tulio Magno


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]