-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3.7 branch] shell: fix unsafe API calls and add configurable autoflush behavior #84589
Conversation
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow configuring the autoflush behavior of shell printing functions. Updated `Z_SHELL_FPRINTF_DEFINE` to use the `CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding the autoflush behavior to `true`. Signed-off-by: Jakub Rzeszutko <[email protected]> (cherry picked from commit 8991b95)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the link reference in the second commit.
The backport label is to automate it, no need to add this here. |
Fixes an issue where the shell API could block indefinitely when called from threads other than the shell's processing thread, especially when the transport (e.g. USB CDC ACM) was unavailable or inactive. Replaced `k_mutex_lock` calls with an indefinite timeout (`K_FOREVER`) by using a fixed timeout (`K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)`) in shell API functions to prevent indefinite blocking. Signed-off-by: Jakub Rzeszutko <[email protected]> (cherry picked from commit b0a0feb)
7685453
to
2145bb7
Compare
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a title that describes the change, not numbers and branches, also include a body in the PR with more details, beside the bug being fixed.
Nobody knows what 84290 is and similarly, nobody knows what #84439 fixes by just looking at numbers.
@nashif done |
should be fixing #84274? |
Yes, fixed it. |
Introduced a new Kconfig option
SHELL_PRINTF_AUTOFLUSH
to allowconfiguring the autoflush behavior of shell printing functions.
Updated
Z_SHELL_FPRINTF_DEFINE
to use theCONFIG_SHELL_PRINTF_AUTOFLUSH
setting instead of hardcodingthe autoflush behavior to
true
.Fixes an issue where the shell API could block indefinitely when called
from threads other than the shell's processing thread, especially when
the transport (e.g. USB CDC ACM) was unavailable or inactive.
Replaced
k_mutex_lock
calls with an indefinite timeout (K_FOREVER
)by using a fixed timeout (
K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)
) in shellAPI functions to prevent indefinite blocking.
Fixes #84274