fix: Patch stack size for prevent potential thread stack size overflow vulnerability in telemetryTxTask, telemetryRxTask#70
Conversation
…w vulnerability in telemetryTxTask, telemetryRxTask
|
And I know, this git is just mirror and not maintained, But there are no way to report any bug reports. Forums cannot registrate (cause email verification not work), Jira and bitbucket doesn't accept issues(PRs) with guest privilege, irc and gitter chat are abandoned.. That's why I make this PR |
|
Thanks for putting that here. Librepilot development is pretty much dead atm. Bitbucket doesn't work because of the terms and condition changes by Atlassian - you can't even access the code anymore without an Atlassian account, they really screwed open source projects that used it. So for documentation purposes this is probably the best place. This is interesting. RadioCOMBridge is only used on the OPLinkMini boards to forward telemetry from and to the flightside. It doesn't expose its own system alarms when in this mode, so potental stack usage warnings might have gotten unnoticed (if the canary protection is even active on that board). Nice catch!!! |
|
Hey Eric - hope you're well! Perhaps we should move the code to another git service, and off Bitbucket? I don't think any of the original developers of LibrePilot are doing anything with it at the moment, but at least those wishing to continue working with it have a chance to take over? I did consider updating Qt to the latest version, but - well, it's a lot of work, and I don't have the time, nor to be honest, the inclination. |
|
I currently don't have much spare time to help with that, but generally I agree with that. Github sounds like the best bet atm unless you have a better suggestion. I think @AlessioMorale has control over the github organisation here I think, so we should have him on board for that. |
|
From documentation
Thus 150 words are 600 bytes in this case. |
Summary
There are potential thread stack overflow in thread function
telemetryTxTask,telemetryRxTask, So I patch this by changing stack size.Details
LibrePilot/flight/modules/RadioComBridge/RadioComBridge.c
Line 51 in 8c101ad
LibrePilot/flight/modules/RadioComBridge/RadioComBridge.c
Lines 171 to 176 in 8c101ad
Cause of both this line,
telemetryTxTaskandtelemetryRxTaskallows stack size by 150 bytes, but after manually checking there might be allow 392, 232 bytes for each function and it can be an stack overflow.Steps to reproduce
makefileand add CFLAGS, CXXFLAGSand
Now we can get stack usage file (*.su) for each source file, So we can manually check stack size of each function.
PoC
In case of
telemetryTxTaskIn case of
telemetryRxTaskCode changed
LibrePilot/flight/modules/Telemetry/telemetry.c
Lines 187 to 202 in 8c101ad
=> Other thread functions that use same function have 800 size, so I change this thread function's stack size to 800.