lua-lsm: expose kernel file load ids#18
Open
chenzongyao200127 wants to merge 2 commits into
Open
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>
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.
Lua-LSM currently leaves the file/load id arguments for kernel_load_data(), kernel_post_load_data(), kernel_read_file(), and kernel_post_read_file() as nil placeholders. This makes Lua policy unable to distinguish kernel modules, firmware, security policy loads, and other kernel file/load users without looking at unrelated context.
Expose those ids as the stable strings returned by kernel_load_data_id_str() and kernel_read_file_id_str(), and drop the separate Lua-visible size argument from the post hooks. The post hooks already expose the data as binary-safe Lua strings, so policy can use the Lua length operator instead.
Example Lua policy:
The series contains these commits:
Validation:
Signed-off-by: Zongyao Chen ZongYao.Chen@linux.alibaba.com