au-ts / sddf

A collection of interfaces, libraries and tools for writing device drivers for seL4 that allow accessing devices securely and with low overhead.
Other
16 stars 12 forks source link

Do not access Microkit variables directly #76

Open Ivan-Velickovic opened 5 months ago

Ivan-Velickovic commented 5 months ago

Currently in the networking sub-system it is common to see snippets of code like this:

    if (notify_tx && net_require_signal(state.tx_queue.active)) {
        net_cancel_signal(state.tx_queue.active);
        notify_tx = false;
        if (!have_signal) microkit_notify_delayed(TX_CH);
        else if (signal_cap != BASE_OUTPUT_NOTIFICATION_CAP + TX_CH) microkit_notify(TX_CH);
    }

have_signal and signal_cap are Microkit globals that should not be accessed by user-code and we also do things like BASE_OUTPUT_NOTIFICATION_CAP + TX_CH.

The root issue is that the Microkit API is lacking regarding delayed/deferred IRQ acks/notifies.

Opening this issue so that we remember to update sDDF once Microkit figures out the API. We should also update any projects that might have this pattern as well such as LionsOS and libvmm.