-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
get FAULT when fuzzing sys_ring_buf_ put and sys_ring_bug_get APIs #7638
Comments
the ring buffer APIs aren't system calls, they don't do privilege elevation. |
Correction, looking at the RB code again it does return error codes when problems are detected. For your test case, I suggest using %u for the output as all the API arguments are treated as unsigned. Not sure I understand this bit:
How do we know for sure getsize is larger than the destination space if it is random? Anyway this all looks like a bug. |
@stuartly I'm having trouble getting your sample code fragment to compile. |
@ManojSubbarao please assign to your team |
@andrewboie Sorry to response late. The sample code is in the attachment. |
@varun-sha , Please look into this issue. |
I tried it on qemu _x86, and got page fault with null ptr exception consistently. Error:- prj.conf is not shared with test code, so i used below one:- looking into it, to find root cause. |
@stuartly Hi, i have gone through your sample fuzzy app, during fuzzing its fine to pass random values, but you are initializing smaller buffer(u32_t getdata[6] in your sample) and passing random getsize value, getsize should be limited to max buffer in which you want to copy data from ring_buf_item_get sometimes when you do ring_buf_item_get you are overwriting memory, which is wrong and causing panic. Just change your code to limit random value of getsize to max buffer you initialized, it will work fine with all fuzzing you are trying with type/value/size. Please retest and close if it works fine at your end. |
@varun-sha Thanks, it is fine. |
@stuartly : can you close this issue then , thanks |
@stuartly : please close this issue, since we are good with analysis. |
I am trying to fuzzing the kernel APIs, and I wrote a simple application to call the APIs: sys_ring_buf_put and sys_ring_buf_get.
the code is as below
when I run the application, it result in USEAGE FAULT as following:
Should zephyr add some checks like type and bound check in the implementation of syscall API code ?
The text was updated successfully, but these errors were encountered: