This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Don't all __access_noerrno with stack protector from __tunables_init [BZ #21744]
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Cc:
- Date: Mon, 17 Jul 2017 17:04:00 -0300
- Subject: Re: [PATCH] Don't all __access_noerrno with stack protector from __tunables_init [BZ #21744]
- Authentication-results: sourceware.org; auth=none
- References: <20170716191924.GA7226@gmail.com>
"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