Skip to content

Commit

Permalink
mac80211: add KCOV remote annotations to incoming frame processing
Browse files Browse the repository at this point in the history
Add KCOV remote annotations to ieee80211_iface_work() and
ieee80211_rx_list(). This will enable coverage-guided fuzzing of
mac80211 code that processes incoming 802.11 frames.

Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Aleksandr Nogikh authored and Jakub Kicinski committed Nov 3, 2020
1 parent 6370cc3 commit 261e411
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,7 @@ static void ieee80211_iface_work(struct work_struct *work)
while ((skb = skb_dequeue(&sdata->skb_queue))) {
struct ieee80211_mgmt *mgmt = (void *)skb->data;

kcov_remote_start_common(skb_get_kcov_handle(skb));
if (ieee80211_is_action(mgmt->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK) {
int len = skb->len;
Expand Down Expand Up @@ -1465,6 +1466,7 @@ static void ieee80211_iface_work(struct work_struct *work)
}

kfree_skb(skb);
kcov_remote_stop();
}

/* then other type-dependent work */
Expand Down
16 changes: 9 additions & 7 deletions net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -4742,22 +4742,24 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,

status->rx_flags = 0;

kcov_remote_start_common(skb_get_kcov_handle(skb));

/*
* Frames with failed FCS/PLCP checksum are not returned,
* all other frames are returned without radiotap header
* if it was previously present.
* Also, frames with less than 16 bytes are dropped.
*/
skb = ieee80211_rx_monitor(local, skb, rate);
if (!skb)
return;

ieee80211_tpt_led_trig_rx(local,
((struct ieee80211_hdr *)skb->data)->frame_control,
skb->len);
if (skb) {
ieee80211_tpt_led_trig_rx(local,
((struct ieee80211_hdr *)skb->data)->frame_control,
skb->len);

__ieee80211_rx_handle_packet(hw, pubsta, skb, list);
__ieee80211_rx_handle_packet(hw, pubsta, skb, list);
}

kcov_remote_stop();
return;
drop:
kfree_skb(skb);
Expand Down

0 comments on commit 261e411

Please sign in to comment.