ClickHouse/base/glibc-compatibility
Azat Khuzhin 0fe1f070fa Fix getauxval() in glibc-compatibility
getauxval() from glibc-compatibility did not work always correctly:

- it does not work after setenv(), and this breaks vsyscalls,
  like sched_getcpu() [1] (and BaseDaemon.cpp always set TZ if timezone
  is defined, which is true for CI [2]).

  [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1163404
  [2]: https://github.com/ClickHouse/ClickHouse/pull/32928#issuecomment-1015762717

- another think that is definitely broken is LSan (Leak Sanitizer), it
  relies on worked getauxval() but it does not work if __environ is not
  initialized yet (there is even a commit about this).

  And because of, at least, one leak had been introduced [3]:

    [3]: https://github.com/ClickHouse/ClickHouse/pull/33840

Fix this by using /proc/self/auxv.

And let's see how many issues will LSan find...

I've verified this patch manually by printing AT_BASE and compared it
with output of LD_SHOW_AUXV.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-26 12:56:27 +03:00
..
memcpy Remove trash from CMake 2021-10-11 06:58:08 +03:00
musl Fix getauxval() in glibc-compatibility 2022-01-26 12:56:27 +03:00
CMakeLists.txt Remove MAKE_STATIC_LIBRARIES (in favor of USE_STATIC_LIBRARIES) 2022-01-24 17:28:33 +03:00
glibc-compatibility.c Replace __pthread_get_minstack() with a const 2021-06-20 14:03:04 +03:00