Commit Graph

58 Commits

Author SHA1 Message Date
Raúl Marín
f2e83f092d Patch getauxval for tsan re-exec 2024-07-25 21:56:42 +02:00
Raúl Marín
7fedc0ffbe
Update base/glibc-compatibility/musl/getauxval.c
Co-authored-by: Alexander Gololobov <davenger@clickhouse.com>
2024-07-25 12:26:37 +02:00
Raúl Marín
fda11dc62d Typo 2024-07-24 22:51:26 +02:00
Raúl Marín
e4b50c18c2 getauxval: Avoid crash under sanitizer re-exec due to high ASLR entropy 2024-07-24 22:26:46 +02:00
Alexey Milovidov
a7430004b3 Fix real time query profiler on AArch64 2024-03-04 18:13:49 +01:00
Alexey Milovidov
cbf5443585 Remove old code 2024-03-04 00:11:55 +01:00
Nikita Taranov
3f6ca2f9e8
Backport fix for UBSan error in musl/logf.c 2023-05-09 19:05:40 +02:00
avogar
a4fecb75de Try fix compatibility check, add expf and scalbnf implementation from musl 2023-04-03 19:05:22 +00:00
Amos Bird
62d011d0c0
Provide more glibc compatibility symbols
These are needed by newer capnp. musl does the following:

 #define fallocate64 fallocate
 #define pwritev64 pwritev
2023-03-01 15:12:43 +08:00
Alexey Milovidov
d8cda3dbb8 Remove PVS-Studio 2023-02-19 23:30:05 +01:00
Raúl Marín
050f3ca7cf Fix msan warning 2022-11-08 17:25:03 +01:00
Amos Bird
4c2b3de93d
Fix msan error 2022-11-04 22:08:14 +08:00
Amos Bird
a89e847514
Fix getauxval for sanitizer builds 2022-11-04 22:08:13 +08:00
Suzy Wang
cad4eeb891 Correct __dup3() to dup3() 2022-08-28 18:03:07 -07:00
Suzy Wang
7a190f84c8 Remove weak_alias 2022-08-19 11:59:47 -07:00
Suzy Wang
1171ba9095 Add dup3() and inotify_init() from musl 1.2.3 2022-08-18 13:25:50 -07:00
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
Alexey Milovidov
72dda35108
Revert "[RFC] Fix LSan by fixing getauxval()" 2022-07-21 04:34:04 +03:00
Azat Khuzhin
f187c3499a 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()
Refs: #33957
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-18 16:49:49 +03:00
Alexey Milovidov
7135ff448f Revert #33957 2022-01-30 01:09:15 +03:00
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
alexey-milovidov
c6f40c5c2d
Revert "Revert "less sys calls #2: make vdso work again"" 2021-08-25 14:19:20 +03:00
alexey-milovidov
3db3b40b5e
Revert "less sys calls #2: make vdso work again" 2021-08-19 01:38:12 +03:00
Vitaly Baranov
213e6366c2
Update getauxval.c 2021-08-12 13:44:09 +03:00
Vitaly Baranov
3d9a4adfbf
Better handling case when __environ is null 2021-08-12 13:43:06 +03:00
Vitaly Baranov
9243e89150
Update getauxval.c 2021-08-12 12:10:37 +03:00
Vitaly Baranov
242d8e1861
__auxv_init lazy initialization 2021-08-12 11:06:12 +02:00
Mikhail Filimonov
2c01e2789a
make vdso work again 2021-08-12 11:06:06 +02:00
Alexey Milovidov
367f7fe6c9 Fix warnings by PVS-Studio 2021-05-08 23:57:08 +03:00
Alexey Milovidov
7f349cd286 Fix warnings by PVS-Studio in some third-party code 2021-05-08 22:41:06 +03:00
Yatsishin Ilya
f8ae63995e Fix msan warnings 2021-01-29 19:11:50 +03:00
Alexey Milovidov
98a8a20b70 Fix MSan error in rocksdb #19213 2021-01-17 21:30:02 +03:00
Alexey Milovidov
10ea06edad Import strsignal from Musl 2021-01-08 08:09:30 +03:00
Alexey Milovidov
98687ff8f4 Merge branch 'master' into harmful 2020-12-31 02:25:28 +03:00
Yatsishin Ilya
ce1e2b18a3 Fix codespell warnings. Split style checks. Update style checks docker 2020-12-24 13:17:52 +03:00
Nikolai Kochetov
af7f5c9518
Merge pull request #17868 from ClickHouse/async-read-from-socket
Async read from socket
2020-12-23 12:20:42 +03:00
alexey-milovidov
f0dc3ec152
Merge pull request #17665 from amosbird/clientedit
clickhouse-client editor
2020-12-22 09:53:54 +03:00
Alexey Milovidov
157c66ebdb Merge branch 'master' into harmful 2020-12-21 10:57:50 +03:00
Amos Bird
fe16aec48b
add .sql suffix 2020-12-21 14:43:06 +08:00
Alexey Milovidov
ff82176933 Add powf and powl to glibc-compatibility 2020-12-21 02:54:05 +03:00
Alexey Milovidov
42a4e38f08 Merge branch 'master' into harmful 2020-12-17 06:28:55 +03:00
Nikolai Kochetov
dd6b5baa59 Add timerfd from musl 2020-12-14 17:41:59 +03:00
Vitaly Baranov
7b0f94b5f2 glibc-compatibility: Add secure_getenv(). 2020-11-24 17:55:02 +03:00
Vitaly Baranov
3253a525e2 glibc-compatibility: Add getauxval(). 2020-11-24 17:55:02 +03:00
Vitaly Baranov
a61359c224 glibc-compatibility: Add accept4() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
Vitaly Baranov
fc67aaec20 glibc-compatibility: Add epoll_create1() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
Vitaly Baranov
d949898890 glibc-compatibility: Add eventfd(), eventfd_read(), eventfd_write() from musl 1.2.1. 2020-11-24 17:55:02 +03:00
sundy-li
c7617173c4 add sync_file_range for glibc-compatibility 2020-11-11 09:08:52 +08:00
Alexey Milovidov
91e80598cd Add "harmful" library 2020-10-28 02:00:16 +03:00
nikitamikhaylov
8a39b65fa2 fix build and tests 2020-10-19 19:15:22 +03:00