Provide error information when input configuration not properly initialized

RESOLVED FIXED in mozilla15

Status

()

Core
Widget
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: cyu, Assigned: cyu)

Tracking

unspecified
mozilla15
All
Gonk (Firefox OS)
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
STR:
* on the device mv /system/usr/idc/sec_touchscreen.idc /system/usr/idc/sec_touchscreen.idc.bak to simulate idc file missing
* restart b2g and touch the home screen
* b2g reloads

Under some corner cases the device's input configuration is not properly configured. Files under /system/usr/idc/ can be missing and pointer device is initialized to default. When this happens, b2g process gets segv on touch. Here is the gdb session showing the symptom

-----------------------
Breakpoint 1, GeckoInputReaderPolicy::obtainPointerController (this=0x422fb1c0, deviceId=6) at /home/cervantes/hg/mozilla-central/widget/gonk/nsAppShell.cpp:281
281         virtual sp<PointerControllerInterface> obtainPointerController(int32_t
(gdb) bt
#0  GeckoInputReaderPolicy::obtainPointerController (this=0x422fb1c0, deviceId=6) at /home/cervantes/hg/mozilla-central/widget/gonk/nsAppShell.cpp:281
#1  0x8297507c in android::TouchInputMapper::configureSurface (this=0x3a670, when=<optimized out>, outResetNeeded=0x43fffdb7) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:2694
#2  0x8297656e in android::TouchInputMapper::configure (this=0x3a670, when=1335175995285881000, config=0x43da2020, changes=0) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:2500
#3  0x8296cf6c in android::InputDevice::configure (this=0x39168, when=1335175995285881000, config=0x43da2020, changes=0) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:910

...(some lines are omitted)

Program received signal SIGSEGV, Segmentation fault.
android::TouchInputMapper::preparePointerGestures (this=0x3a670, when=1335176027728114000, outCancelPreviousGesture=0x43fffd37, outFinishPreviousGesture=0x43fffd36, isTimeout=<optimized out>)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:4533
4533            mPointerController->getPosition(&x, &y);
(gdb) bt
#0  android::TouchInputMapper::preparePointerGestures (this=0x3a670, when=1335176027728114000, outCancelPreviousGesture=0x43fffd37, outFinishPreviousGesture=0x43fffd36, isTimeout=<optimized out>)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:4533
#1  0x829725fc in android::TouchInputMapper::dispatchPointerGestures (this=0x0, when=<optimized out>, policyFlags=0, isTimeout=48)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3959
#2  0x82972d48 in android::TouchInputMapper::dispatchPointerUsage (this=0x3a670, when=1335176027728114000, policyFlags=0, pointerUsage=android::TouchInputMapper::POINTER_USAGE_GESTURES)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3923
#3  0x82973ac4 in android::TouchInputMapper::sync (this=0x3a670, when=1335176027728114000) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3423
#4  0x82973c36 in android::TouchInputMapper::process (this=0x3a670, rawEvent=0x43da2180) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3299
#5  0x82973c4c in android::MultiTouchInputMapper::process (this=0x0, rawEvent=0x43fff778) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:5571
#6  0x82976634 in android::InputDevice::process (this=0x39168, rawEvents=<optimized out>, count=1) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:961
#7  0x829766a4 in android::InputReader::processEventsForDeviceLocked (this=<optimized out>, deviceId=6, rawEvents=0x43da20c0, count=7)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:459
#8  0x82977428 in android::InputReader::processEventsLocked (this=0x43da2000, rawEvents=<optimized out>, count=7) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:321
#9  0x82977654 in android::InputReader::loopOnce (this=0x43da2000) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:283
#10 0x8296cf08 in android::InputReaderThread::threadLoop (this=<optimized out>) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:838
#11 0xa811dd28 in android::Thread::_threadLoop (user=<optimized out>) at frameworks/base/libs/utils/Threads.cpp:770
#12 0xa811e2ea in thread_data_t::trampoline (t=<optimized out>) at frameworks/base/libs/utils/Threads.cpp:127
#13 0xafd11c38 in __thread_entry (func=0xa811e24d <thread_data_t::trampoline(thread_data_t const*)>, arg=0x2bd80, tls=<optimized out>) at bionic/libc/bionic/pthread.c:213
#14 0xafd117ec in pthread_create (thread_out=<optimized out>, attr=0xbe8b14d4, start_routine=0xa811e24d <thread_data_t::trampoline(thread_data_t const*)>, arg=<optimized out>)

-----------------------

The problem originates from program flow enters GeckoInputReaderPolicy::obtainPointerController(), which should never be called in our case (and returns NULL).
We might consider add MOZ_NOTREACHED() here to die early on such cases or add log print indicating something wrong happened.
(Assignee)

Comment 1

5 years ago
MOZ_NOT_REACHED() might be too over here because GeckoInputReaderPolicy::obtainPointerController () is in startup code.
(Assignee)

Updated

5 years ago
Assignee: nobody → cyu
(Assignee)

Comment 2

5 years ago
Created attachment 617832 [details] [diff] [review]
Add MOZ_NOT_REACHED() in code path that should never be reached
Attachment #617832 - Flags: review?(mwu)

Updated

5 years ago
Component: General → Widget
Product: Boot2Gecko → Core
QA Contact: general → general

Updated

5 years ago
Attachment #617832 - Flags: review?(mwu) → review+
(Assignee)

Updated

5 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/9dc532ce5de7
Flags: in-testsuite-
Keywords: checkin-needed
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/9dc532ce5de7
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.