Revert "Support -D_FORTIFY_SOURCE=3 by using __builtin_dynamic_object_size."
authorEvgeny Vereshchagin <evvers@ya.ru>
Fri, 3 Jun 2022 19:06:22 +0000 (19:06 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sun, 5 Jun 2022 19:13:17 +0000 (19:13 +0000)
commit2cfb790391958ada34284290af1f9ab863a515c7
tree7c38cd0b39d1c54634c6387a212583f56a1c78dc
parent36cb69fc43cbce6d883b3a0da4f793c81dbf4b2e
Revert "Support -D_FORTIFY_SOURCE=3 by using __builtin_dynamic_object_size."

This reverts commit 0bd292567a543d124cd303f7dd61169a209cae64.

It isn't guaranteed anywhere that __builtin_dynamic_object_size can
always deduce the size of every object passed to it so systemd
can end up using either malloc_usable_size or
__builtin_dynamic_object_size when pointers are passed around,
which in turn can lead to actual segfaults like the one mentioned in
https://github.com/systemd/systemd/issues/23619.

Apparently __builtin_object_size can return different results for
pointers referring to the same memory as well but somehow it hasn't
caused any issues yet. Looks like this whole
malloc_usable_size/FORTIFY_SOURCE stuff should be revisited.

Closes https://github.com/systemd/systemd/issues/23619 and
https://github.com/systemd/systemd/issues/23150.

Reopens https://github.com/systemd/systemd/issues/22801
src/basic/alloc-util.h