ClickHouse/base/glibc-compatibility/musl
Azat Khuzhin a4f9e1da5b Fix getauxval() by using procfs with fallback to environ
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]).

  Also note, that fixing setenv() will not fix LSan,
  since the culprit is getauxval()

  [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1163404
  [2]: ClickHouse#32928 (comment)

- 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]: ClickHouse#33840

Fix this by using /proc/self/auxv with fallback to environ solution to
make it compatible with environment that does not allow reading from
auxv (or no procfs).

v2: add fallback to environ solution
v3: fix return value for __auxv_init_procfs()
(cherry picked from commit f187c3499a)
v4: more verbose message on errors, CI founds [1]:
    AUXV already has value (529267711)
    [1]: https://s3.amazonaws.com/clickhouse-test-reports/39103/2325f7e8442d1672ce5fb43b11039b6a8937e298/stress_test__memory__actions_.html
v5: break at AT_NULL
v6: ignore AT_IGNORE
v7: suppress TSan and remove superior check to avoid abort() in case of race
v8: proper suppressions (not inner function but itself)
Refs: #33957
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-25 01:22:04 +03:00
..
aarch64 libs/ → base/ 2020-02-14 17:48:30 +03:00
x86_64 Implemented unwind info for __syscall function 2020-03-03 05:29:51 +03:00
__math_divzero.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_divzerof.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_invalid.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_invalidf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_oflow.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_oflowf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_uflow.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_uflowf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_xflow.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__math_xflowf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
__polevll.c Add powf and powl to glibc-compatibility 2020-12-21 02:54:05 +03:00
accept4.c glibc-compatibility: Add accept4() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
atomic.h libs/ → base/ 2020-02-14 17:48:30 +03:00
clock_getres.c Fix glibc compatibility 2020-03-23 19:51:06 +03:00
clock_gettime.c Remove weak aliases from musl 2020-03-03 04:59:57 +03:00
clock_nanosleep.c Remove weak aliases from musl 2020-03-03 04:59:57 +03:00
COPYRIGHT libs/ → base/ 2020-02-14 17:48:30 +03:00
epoll.c glibc-compatibility: Add epoll_create1() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
eventfd.c glibc-compatibility: Add eventfd(), eventfd_read(), eventfd_write() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
exp2.c libs/ → base/ 2020-02-14 17:48:30 +03:00
exp2f_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
exp2f_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
exp2f.c libs/ → base/ 2020-02-14 17:48:30 +03:00
exp_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
exp_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
exp.c libs/ → base/ 2020-02-14 17:48:30 +03:00
fallocate.c libs/ → base/ 2020-02-14 17:48:30 +03:00
fcntl.c libs/ → base/ 2020-02-14 17:48:30 +03:00
futimens.c libs/ → base/ 2020-02-14 17:48:30 +03:00
getauxval.c Fix getauxval() by using procfs with fallback to environ 2022-07-25 01:22:04 +03:00
getentropy.c libs/ → base/ 2020-02-14 17:48:30 +03:00
getrandom.c libs/ → base/ 2020-02-14 17:48:30 +03:00
glob.c libs/ → base/ 2020-02-14 17:48:30 +03:00
lgamma.c Fix warnings by PVS-Studio in some third-party code 2021-05-08 22:41:06 +03:00
lgammal.c Fix warnings by PVS-Studio in some third-party code 2021-05-08 22:41:06 +03:00
libm.h Fix warnings by PVS-Studio 2021-05-08 23:57:08 +03:00
log2_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
log2_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
log2.c libs/ → base/ 2020-02-14 17:48:30 +03:00
log2f_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
log2f_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
log2f.c libs/ → base/ 2020-02-14 17:48:30 +03:00
log_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
log_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
log.c libs/ → base/ 2020-02-14 17:48:30 +03:00
logf_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
logf_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
logf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
mkstemps.c add .sql suffix 2020-12-21 14:43:06 +08:00
musl_features.h Remove weak aliases from musl 2020-03-03 04:59:57 +03:00
pipe2.c libs/ → base/ 2020-02-14 17:48:30 +03:00
posix_spawn.c libs/ → base/ 2020-02-14 17:48:30 +03:00
pow_data.c libs/ → base/ 2020-02-14 17:48:30 +03:00
pow_data.h libs/ → base/ 2020-02-14 17:48:30 +03:00
pow.c libs/ → base/ 2020-02-14 17:48:30 +03:00
powf_data.c Add powf and powl to glibc-compatibility 2020-12-21 02:54:05 +03:00
powf_data.h Add powf and powl to glibc-compatibility 2020-12-21 02:54:05 +03:00
powf.c Fix warnings by PVS-Studio in some third-party code 2021-05-08 22:41:06 +03:00
powl.c Fix codespell warnings. Split style checks. Update style checks docker 2020-12-24 13:17:52 +03:00
pwritev.c libs/ → base/ 2020-02-14 17:48:30 +03:00
README libs/ → base/ 2020-02-14 17:48:30 +03:00
sched_cpucount.c libs/ → base/ 2020-02-14 17:48:30 +03:00
sched_getcpu.c Fix msan warnings 2021-01-29 19:11:50 +03:00
secure_getenv.c glibc-compatibility: Add secure_getenv(). 2020-11-24 17:55:02 +03:00
strsignal.c Import strsignal from Musl 2021-01-08 08:09:30 +03:00
sync_file_range.c add sync_file_range for glibc-compatibility 2020-11-11 09:08:52 +08:00
syscall_ret.c libs/ → base/ 2020-02-14 17:48:30 +03:00
syscall.h glibc-compatibility: Add accept4() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
timerfd.c Add timerfd from musl 2020-12-14 17:41:59 +03:00
timespec_get.c libs/ → base/ 2020-02-14 17:48:30 +03:00
utimensat.c libs/ → base/ 2020-02-14 17:48:30 +03:00
vasprintf.c libs/ → base/ 2020-02-14 17:48:30 +03:00
vdso.c glibc-compatibility: Add getauxval(). 2020-11-24 17:55:02 +03:00

Tiny pieces extracted from MUSL library.

git://git.musl-libc.org/musl
c10bc61508dc52b8315084e628f36a6c3c2dabb1

NOTE: Files was edited.

NOTE: Math related files are pulled from commit 6ad514e4e278f0c3b18eb2db1d45638c9af1c07f.