lua-lsm: expose kernel file load ids#17
Closed
chenzongyao200127 wants to merge 2 commits into
Closed
Conversation
Lua-LSM left the id arguments for kernel_load_data(), kernel_post_load_data(), kernel_read_file(), and kernel_post_read_file() as nil placeholders. Expose those ids as the stable strings returned by kernel_load_data_id_str() and kernel_read_file_id_str(). Lua policies can compare descriptive values such as "kernel-module" or "security-policy" without depending on kernel enum numbers. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
kernel_post_load_data() and kernel_post_read_file() expose file data to Lua as binary-safe strings. Lua policy can get the byte length with the Lua length operator, so passing a separate size argument duplicates information already carried by the string. Drop the Lua-visible size argument from those hooks while keeping the kernel hook signatures unchanged. Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Collaborator
Author
|
Recreated this PR from the dedicated head branch : #18 |
Collaborator
Author
|
Recreated this PR from the dedicated head branch lua-lsm-file-load-ids: #18 |
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
Expose kernel file/load ids to Lua policies and remove the redundant size
argument from post file data hooks.
The id arguments are now stable strings from the kernel helpers, so Lua policy
can compare readable values instead of enum numbers. The post hooks continue to
pass binary-safe Lua strings for the data buffer; policy can use the Lua length
operator when it needs the byte length.
Lua examples
Testing
git diff --check origin/lua-lsm..HEAD./scripts/checkpatch.pl --git origin/lua-lsm..HEAD