Changeset 0b00599 in mainline


Ignore:
Timestamp:
2016-09-11T08:21:11Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
97b8ca9
Parents:
43e2cbc
Message:

Use correct answerbox to answer IPC_M_PHONE_HUNGUP in kbox thread

When ipc_kbox_cleanup() slams the phones connected to the kbox, it
requests answerbox notification. To that end,
ipc_answerbox_slam_phones() allocates a new IPC_M_PHONE_HUNGUP call per
each slammed phone and sends it directly to its own kbox. The allocation
of the call structure happens in the context of the debugee, not the
debugger, so call→callerbox is wrong because it is initialized with
&TASK→answerbox. This causes confusion in _ipc_answer_free_call()
invoked from kbox_proc_phone_hungup(), which picks a wrong answerbox for
the answer. The debugger, in turn, never sees the call answered and
lingers in its own ipc_cleanup() forever.

We correct this by allowing call→callerbox to be NULL, in which case
_ipc_answer_free_call() will use call→sender→answerbox instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    r43e2cbc r0b00599  
    7979        call->forget = false;
    8080        call->sender = NULL;
    81         call->callerbox = &TASK->answerbox;
     81        call->callerbox = NULL;
    8282        call->buffer = NULL;
    8383}
     
    292292        spinlock_unlock(&call->forget_lock);
    293293
    294         answerbox_t *callerbox = call->callerbox;
     294        answerbox_t *callerbox = call->callerbox ? call->callerbox :
     295            &call->sender->answerbox;
    295296        bool do_lock = ((!selflocked) || (callerbox != &TASK->answerbox));
    296297       
Note: See TracChangeset for help on using the changeset viewer.