Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Backport OOM fixes to v2.5 #156

Merged
merged 14 commits into from
Feb 28, 2024
Merged

Conversation

krish2718
Copy link
Collaborator

Many customers are on v2.5 branch, and as these fixes help with Stress and Stability, backport for next point release.

fixup! [nrf noup] Monitor supplicant state and inform applications

Even though the payload is of fixed size, move it to the end for easier
parsing.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] Monitor supplicant state and inform applications

Incoming message has a pre-defined structure and isn't a arbitrary blob,
so, use the structure to parse properly.

This was working earlier as the payload was in the beginning of the
structure, but if we ever end up with a longer message then we would see
issues.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] Monitor supplicant state and inform applications

The incoming message is payload + length, so, need to include size of
the "length" field.

Fixes SHEL-2250.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] Monitor supplicant state and inform applications

Sender is sending the entire structure, and receiving one byte lesser
results in two receive calls per-message, this screws up the message
parsing.

Fixes SHEL-2250.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] zephyr: Add support for global control interface

The below fixes from non-global control interface are ported:

1. Dummy receive in case of memory allocation failures
2. Identify EoF and close the socket.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] zephyr: Add support for WPA CLI zephyr

In some cases (interface is disabled) the control interface socket is
closed but as we don't handle EoF control interface keeps receiving
zero bytes from the socket continuously and this causes an infinite
loop and starving other threads (even SHELL thread).

So, treat 0 bytes recv as EoF as its a connected socket and unregister
from eloop to avoid infinite loop of recv failures.

Fixes SHEL-2320.

Signed-off-by: Chaitanya Tata <[email protected]>
Relying on heap during OOM is bad, esp. for critical module like WPA
supplicant, this can break the Wi-Fi.

As the WPA supplicant stack is large enough and we have reduced the
control interface sizes, move the buffers for control interface to
stack or use static variable.

The static variable is used to keep the changes to the common code of
the WPA supplicant to a minimum compared to using stack.

Fixes SHEL-2283.

Signed-off-by: Chaitanya Tata <[email protected]>
This can be same as non-global control interface, for interface command
the output is limited to 1024.

Signed-off-by: Chaitanya Tata <[email protected]>
Relying on heap during OOM is bad, esp. for critical module like WPA
supplicant, this can break the Wi-Fi.

As the WPA supplicant stack is large enough and this buffer is free
immediately after use, just use the stack.

Fixes SHEL-2283.

Signed-off-by: Chaitanya Tata <[email protected]>
@krish2718 krish2718 force-pushed the backport_oom_25 branch 2 times, most recently from 4884203 to f926cca Compare February 26, 2024 20:45
@krish2718 krish2718 force-pushed the backport_oom_25 branch 9 times, most recently from 2e3c801 to bffd005 Compare February 27, 2024 21:20
@krish2718 krish2718 force-pushed the backport_oom_25 branch 3 times, most recently from 6ce2863 to d00fa7f Compare February 28, 2024 06:08
@krish2718 krish2718 force-pushed the backport_oom_25 branch 2 times, most recently from e9b02d5 to db89851 Compare February 28, 2024 20:14
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver

The management frame structure in the WPA supplicant only has a pointer,
so, it need a deep-copy before passing it to WPA supplicant, else driver
ends up freeing causing invalid memory contents.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver

Fix a crash where the stack pointer from the driver call is passed
directly over the socket for async processing and if its delayed then
driver stack frame is destroyed, causing a crash.

Copy the buffer from driver stack before passing over socket.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver

Perform a deep copy of all pointers in the association response event.

Fixes SHEL-2515.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver

The dynamic data for these events are not deep copied.

Fixes SHEL-2515.

Signed-off-by: Chaitanya Tata <[email protected]>
fixup![nrf noup] ci: Fix the paths

The compliance should be run from hostap repo and not sdk-zephyr. And
also disable few tests that won't work reliably.

Signed-off-by: Chaitanya Tata <[email protected]>
@krish2718 krish2718 merged commit b4a54f5 into nrfconnect:v2.5-branch Feb 28, 2024
1 check passed
@krish2718 krish2718 deleted the backport_oom_25 branch February 28, 2024 20:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants