-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Possible Weakness with locking in the GNRC network stack #5656
Copy link
Copy link
Closed
Labels
Area: networkArea: NetworkingArea: NetworkingType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
In the IPv6/6loWPAN stack there are sometimes statements like this: (e.g.: sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c:95ff)
mutex_unlock(&entry->mutex); /* function below relocks mutex */
gnrc_ndp_internal_send_nbr_sol(entry->pid, &tmp_addr->addr, router, router);
mutex_lock(&entry->mutex); /* relock mutex */
Releasing the lock and relocking it again later however breaks the atomicity of those functions, because the memory which is protected by the lock might change while the lock is not held.
I propose two possible solutions:
- implement local function for _send_nbr_sol which do not try to lock the mutex
- add a reentrant mutex implementation
Reactions are currently unavailable
Metadata
Metadata
Labels
Area: networkArea: NetworkingArea: NetworkingType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)