lua-lsm: lazily allocate task and object dictionary state - #27
Open
chenzongyao200127 wants to merge 5 commits into
Open
lua-lsm: lazily allocate task and object dictionary state#27chenzongyao200127 wants to merge 5 commits into
chenzongyao200127 wants to merge 5 commits into
Conversation
Most tasks never use Lua VM or object property state. Once Lua hooks are active, however, each task carries an embedded kvcache dictionary and a separate teardown flag. This expands the task security blob and adds work to task allocation and teardown. Keep only the VM and dictionary pointers in the task blob and allocate each state on first use. Untouched tasks can now skip Lua teardown entirely. Publish ERR_PTR(-ESRCH) before reclaiming lazy state so reentrant hooks cannot recreate task state while Lua finalizers run. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Most kernel objects never store Lua policy properties, especially when no policy is loaded. Initializing every embedded dictionary during object allocation therefore performs unnecessary lock and tree setup. Leave zero-allocated object and shared dictionaries in the UNINIT state until their first write. Keep reads and teardown safe for uninitialized dictionaries, and report the default shared dictionary capacity before initialization. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Shrink object security blobs to a pointer and allocate dictionaries on first use. Centralize object teardown and preserve ENOMEM for task and object lazy allocation failures. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Group declarations by responsibility and order includes consistently. Keep related types, state, and interfaces adjacent. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Valid task and object kvcache reads can now see no dictionary after lazy allocation when the key has never been written. lua_object_get() returned no Lua values in that case, while a read from an initialized empty dictionary returns one nil. This changes observable Lua return arity in tail-return and multiret contexts. Push nil for the no-dictionary read path and keep the dictionary unallocated. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
chenzongyao200127
force-pushed
the
lua-lsm-task-blob-lazy-state
branch
from
July 20, 2026 07:16
eac3a77 to
7e3d971
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary