Open zvi-code opened 4 months ago
I haven't explored enough ASAN, especially with jemalloc, but I think that at least some of the options that involve application "knowledge" will be relevant even in the presence of asan
Yeah I guess this is my main question. It's hard for me to grasp what new protections your proposal provides on top of what the various sanitizers provide.
I haven't explored enough ASAN, especially with jemalloc, but I think that at least some of the options that involve application "knowledge" will be relevant even in the presence of asan
Yeah I guess this is my main question. It's hard for me to grasp what new protections your proposal provides on top of what the various sanitizers provide.
Yea, will take the time to check what is exactly available. I guess that if the only additional valprop is application level memory protection (app knows it is not supposed to write), the effort/complexity is not justified
The problem/use-case that the feature addresses
As a memory db, we aim to reduce as much as possible the risk of memory corruptions/illegal-memory-access and have fail-fast approach to early detect potential issues, hopefully during testing. In some cases the code defect that causes the corruption exists long before there is an actual visible impact (crash\corrupted data), but because the actual impact requires usage of the corrupted memory before it is set again, we don't see the impact most of the time. When we have a crash, the backtrace will usually point to the code that did the valid access and not the offender, this makes corruptions harder to debug. Looking forward on valkey, the likeliness, of a timing/order dependent corruption, increases as we scale threads usage cross valkey. The proposal is to add ability for valkey to run in a mode that, at some configurable cost of memory&cpu, will help find these issues proactively[by crashing when corruption happens and not on the following valid access and regarding to if such access occur].
Description of the feature
The main suggestion is introduce a configurable running mode that will interleave
mportected pages
all over the memory allocations from the os (themmap
ed extents in jemalloc).There are several options I am thinking of[considering that
mprotect
can be applied on pages only):Alternatives(incremental) you've considered
Incremental to this are these techniques:
export MALLOC_CONF="san_guard_large:1,san_guard_small:1"
enable-debug
pthread_attr_setguardsize