Changeset 8498915 in mainline


Ignore:
Timestamp:
2007-11-22T09:09:04Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0cc4313
Parents:
b74959bd
Message:

Be more deterministic when a user accidently uses fast version of IPC
call/answer instead of the full one and passes fewer arguments than required by
the recipient of the call/response.

and the recipient interprets arguments that
were actually not passed by the sender.

Files:
2 edited

Legend:

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

    rb74959bd r8498915  
    378378        IPC_SET_ARG2(call.data, arg2);
    379379        IPC_SET_ARG3(call.data, arg3);
     380        /*
     381         * To achieve deterministic behavior, zero out arguments that are beyond
     382         * the limits of the fast version.
     383         */
     384        IPC_SET_ARG4(call.data, 0);
     385        IPC_SET_ARG5(call.data, 0);
    380386
    381387        if (!(res = request_preprocess(&call))) {
     
    478484        IPC_SET_ARG3(call->data, arg3);
    479485        IPC_SET_ARG4(call->data, arg4);
     486        /*
     487         * To achieve deterministic behavior, zero out arguments that are beyond
     488         * the limits of the fast version.
     489         */
     490        IPC_SET_ARG5(call->data, 0);
    480491
    481492        if (!(res = request_preprocess(call)))
     
    624635        IPC_SET_ARG3(call->data, arg3);
    625636        IPC_SET_ARG4(call->data, arg4);
     637        /*
     638         * To achieve deterministic behavior, zero out arguments that are beyond
     639         * the limits of the fast version.
     640         */
     641        IPC_SET_ARG5(call->data, 0);
    626642        rc = answer_preprocess(call, saveddata ? &saved_data : NULL);
    627643
  • uspace/lib/libc/generic/ipc.c

    rb74959bd r8498915  
    321321                IPC_SET_ARG3(call->u.msg.data, arg3);
    322322                IPC_SET_ARG4(call->u.msg.data, arg4);
     323                /*
     324                 * To achieve deterministic behavior, we always zero out the
     325                 * arguments that are beyond the limits of the fast version.
     326                 */
     327                IPC_SET_ARG5(call->u.msg.data, 0);
    323328        }
    324329        ipc_finish_async(callid, phoneid, call, can_preempt);
     
    436441        while (!list_empty(&queued_calls)) {
    437442                call = list_get_instance(queued_calls.next, async_call_t, list);
    438                 callid = _ipc_call_async(call->u.msg.phoneid, &call->u.msg.data);
     443                callid = _ipc_call_async(call->u.msg.phoneid,
     444                    &call->u.msg.data);
    439445                if (callid == IPC_CALLRET_TEMPORARY) {
    440446                        break;
     
    646652 * For non-system methods, the old method and arg1 are rewritten by the new
    647653 * values. For system methods, the new method and arg1 are written to the old
    648  * arg1 and arg2, respectivelly.
    649  */
    650 int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1)
     654 * arg1 and arg2, respectivelly. Calls with immutable methods are forwarded
     655 * verbatim.
     656 */
     657int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
     658    ipcarg_t arg1)
    651659{
    652660        return __SYSCALL4(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1);
Note: See TracChangeset for help on using the changeset viewer.