add missing tls patches #1

Merged
deusch merged 7 commits from tegu-display into halium-16.0 2026-05-09 13:28:45 +02:00
Owner

and a small (wip) display patch

and a small (wip) display patch
While Bionic's StaticTls is normally only for the main
executable, libhybris attempts to utilize it for dlopened libraries
by using a pre-allocated thread-local array.

Because all libraries are dlopened, only the calling thread initializes
its static TLS. Other existing threads need a way to detect and setup
these new TLS segments.

This change adds generation-aware lazy initialization by adding
a generation check to tlsdesc_resolver_static. It compares the
thread's DTV generation with the global generation. If it is stale,
it uses a register-preserving slow path, which calls
hybris_linker_tls_init_thread.

hybris_linker_tls_init_thread function synchronizes the thread's DTV
and performs a static TLS initialization only for modules loaded after
the thread's last sync.

This prevents overwriting TLS data that the thread already modified
in older modules.
- Add overflowed() to A16 StaticTlsLayout (needed by register_soinfo_tls)
- Fix finish_layout() to use A16 field names (cursor_/align_ vs offset_/alignment_)
- Add overflow tracking to A16 reserve()
- Remove CHECK(static_offset == SIZE_MAX) in unregister_tls_module —
  hybris assigns static offsets to all modules via hybris_tls_storage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AIDL gralloc mapper (Gralloc5) loads mapper.pixel.so via
android_load_sphal_library which searches the default linker
paths. The library lives in /vendor/lib64/hw/ which wasn't
in the search list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without initial-exec, hybris_tls_storage uses TLSDESC (dynamic TLS)
which means the TP offset varies per thread depending on when the
TLSDESC resolver runs. This causes crashes when the compositor's
Mali shader compiler thread hits the slow path.

With initial-exec, the TP offset is fixed at load time and constant
across all threads. Requires LD_PRELOAD to reserve static TLS space
when the library is dlopen'd (handled by lsc-wrapper).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
deusch merged commit 0ec4110baf into halium-16.0 2026-05-09 13:28:45 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ubports/libhybris!1
No description provided.