Repository navigation
Unsanitized IPC input is used for memory flags #8832
Description
Activity
Debugging this is much easier with zephyrproject-rtos/zephyr#68494 and a bit easier with #8831
- changed the title
[-]I debugged this a bit. This PR is probably just the messenger but this fuzzing failure looks like a "good catch" to me.[/-][+]Unsanitized IPC input is used for memory flags[/+]on Feb 2, 2024 - addedbugSomething isn't working as expectedSomething isn't working as expectedP1Blocker bugs or important featuresBlocker bugs or important features
on Feb 2, 2024 What is the reason we are just not reverting the change?
The change looks like just the messenger to me. Commit 58a42e5 adds a
k_panic()which stops the fuzzer now but I believe the unsanitized IPC input has always been used for memory flags even before thatk_panic().Fuzzing is great but it's not a silver bullet. In this case, fuzzing never seemed to notice the unsanitized flags because they never caused any obvious corruption?
Reacted by Curtis MalaineyAgreed, I thought the commit added the fallthrough case not just expressing already broken logic, I was under a bad assumption.
@marc-hb can you fix and add validation checks around the memory types passed to IPC. Thanks.
Reacted by Marc HerbertI have a quick and dirty hack that is passing all the tests in #8850 but it will break again whenever we add a new MEM_CAPS bit.
What is the reason we are just not reverting the change?
I still don't think this L3 heap should be reverted but @jxstelter I think it should be reworked to better handle invalid inputs.
k_panic()is simply too extreme to handle invalid inputs (and fuzzing is just the messenger).In the meantime I submitted a major rework of fuzz.sh because it was good enough for CI but really too inconvenient and too slow for interactive use. With #8851 it's great for both, please review.
- added 2 commits that reference this issue
on Feb 12, 2024 3 remaining items
- added a commit that references this issue
on Feb 28, 2024 - added a commit that references this issue
on Feb 28, 2024 One last open PR on this topic and then we can close:
Stable-v2.9 branched, this didn't make the cut, bumping to 2.10.
- added a commit that references this issue
on Mar 5, 2024 @kv2019i given this is a security issue, can we not hotfix?
@cujomalainey wrote:
@kv2019i given this is a security issue, can we not hotfix?
I actually thought this was a follow-up and the primary issue was already fixed (and thus the P3 priority).
But if not, let's indeed backport. The main PR is merged yesterday, @marc-hb can you submit a backport to stable-v2.9?
I think we can then close this issue, right? Or anything else pending?
I think this was a potential security issue. But it's most likely not as long as unknown flags are ignored or rejected. #8853 is already in stable-v2.9 so I think it's enough.
./scripts/fuzz.sh -o fuzz-stdout.txt -t 600fails systematically after L3_HEAP commit 58a42e5Example: https://github.com/thesofproject/sof/actions/runs/7763189541/job/21174929628
This may take a few minutes but never much longer.
P1 because this is affecting daily tests and our ability to fuzz.
Originally posted by @marc-hb in #8632 (comment)
PR #8632 is probably just the messenger but this fuzzing failure looks like a "good catch" to me.
Since #8632 was merged, one of the new k_panic() gets triggered because
caps & SOF_MEM_CAPS_L3is true even whenCONFIG_L3_HEAPis false.I think the reason
caps & SOF_MEM_CAPS_L3is true is because...capscomes directly from untrusted IPC input!? Why would IPCs be able to setcapsdirectly?The panic happens when
ipc_glb_tplg_buffer_new()does this:At this point
comp_datalooks like it came straight from the fuzzer's untrusted input: