-
Notifications
You must be signed in to change notification settings - Fork 103
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
[PROPOSAL] Memory allocation for debugging #2211
Comments
This is a reliability issue. Relatively crucial since KASAN could reveal the bug #2208 , which took quite a time to find. Must be solved in 0.9. The thing is that TfwPool is a pool allocator, which frees many items at once and there is no such allocator in the Linux kernel. So just using @RomanBelozerov probably we'll need a separate CI workflow, maybe periodic, to run all our test suite with as much as possible kernel sanitizers and checkers. |
One more thing: TfwPool-allocated pages can be moved to skb and sent as paged data, so using Also would be good to make the system also work with kmemleak and other memory debugging tools |
The tool is required to have to reveal further bugs and regressions, but it does take significant development effort, so I have to move it to the next milestone |
As known, we use our home-brewed memory allocation for performance, e.g.
tfw_pool_new
, but the drawback is that it bypasses the KASAN. So we must ensure memory safety ourselves and cannot rely on general sanitizers.kmalloc/kmem_cache
, so KASAN does not shadow the heap memory.memcpy
are written in assembly code by ourselves, so no asan instrumentation is generated by GCC, as well as some overflow checks (through some compiler tricks e.g.__builtin_object_size
).If we forge the same bug like #2208 but using
kmalloc
and the kernel'smemcpy
:Then KASAN will report it, we can explicitly know the bug.
We should make a unified API to manage memory but with different implementations for debug or release. We can enable the kernel's implementation automatically at the compile time if
CONFIG_KASAN
is 1.The text was updated successfully, but these errors were encountered: