Repository navigation
Conversation
On webOS 4.10 (LG's SDL .so.0.4.1, firmware 4.10.2-29) the first WebOSShowScreenKeyboard of a process mallocs its keyboard record without zeroing it, requests a new wl_registry and dispatches the display once instead of making a round trip. Only the registry listener fills the record's text_model_factory and wl_seat fields. When that one dispatch does not read the compositor's reply (that libwayland only dispatches what is already queued when the queue is not empty, and otherwise reads one batch), SDL uses leftover heap as a proxy and the app dies with SIGSEGV in wl_proxy_marshal_constructor. On the crash seen in the field, r0 held bytes 12..16 of the event-log line freed just before the call. The webOS shell now raises the keyboard itself: two SDL_PumpEvents, then SDL_StartTextInput. The first pump empties the queue and the second reads what waits on the socket, so the raise's own dispatch sends the registry request with nothing in the way and reads the reply. The SDL shell gains event::pump for it; desktop and Tizen are unchanged. SDL_PumpEvents is exported by all 14 firmware inventories. Signed-off-by: Tiago Pereira <1698241+tiper@users.noreply.github.com>
1 task done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On webOS 4.10 the app can crash the first time it raises the TV keyboard (opening Search). It's rare and intermittent:
Cause
It's in LG's SDL. I disassembled
libSDL2andlibwayland-clientfrom the matching firmware (05.40.97,4.10.2-29). On the first raise,WebOSShowScreenKeyboardmallocs its keyboard record without zeroing it and asks the compositor for its globals. It then does a singlewl_display_dispatchinstead of a round trip. Thetext_model_factorypointer is only filled in by the registry reply. If that reply isn't in the one batch the dispatch reads (for example, because other events were already queued), SDL uses leftover heap as a proxy. Herer0is"art ", from our log line that had just been freed, andwl_proxy_marshal_constructorfaults on it (called at0x723d8, which matcheslr).Fix
WebosShell::show_keyboardnow callsSDL_PumpEventstwice beforeSDL_StartTextInput. That drains both the queue and the socket, so SDL's own dispatch reads the compositor's reply. The pumped events stay queued for the nextSDL_PollEvent. The workaround is limited to the webOS platform.plx_shell_sdlonly gains a stockevent::pump(), and desktop and Tizen don't change.SDL_PumpEventsis exported on all 14 firmware inventories. The trap is documented indocs/search.md.Testing
the_webos_shell_drains_the_connection_before_raising_the_keyboard: it fails without the pumps and passes with them.plx_shell_sdl49/0,plx_platform_webos70/0,make check-nodefand the ARM build are clean.