Skip to content

lua-lsm: return nil for missing wrapped objects#14

Open
chenzongyao200127 wants to merge 2 commits into
openanolis:lua-lsmfrom
chenzongyao200127:lua-lsm-96cfcf8-null-wrapped-objects
Open

lua-lsm: return nil for missing wrapped objects#14
chenzongyao200127 wants to merge 2 commits into
openanolis:lua-lsmfrom
chenzongyao200127:lua-lsm-96cfcf8-null-wrapped-objects

Conversation

@chenzongyao200127
Copy link
Copy Markdown
Collaborator

Some Lua accessors expose optional kernel pointers. d_backing_inode(), sk->sk_socket, sock->sk, skb->sk, and skb_to_full_sk() can return NULL, but the accessors wrapped those values as typed userdata.

Lua policy then sees a non-nil object and can call methods that dereference the stored pointer without another NULL check.

Return nil for missing optional objects, matching the existing convention used by Lua-LSM hook argument marshalling.

Validation:

  • ./scripts/checkpatch.pl --git origin/lua-lsm..lua-lsm-96cfcf8-null-wrapped-objects
  • git diff --check origin/lua-lsm..lua-lsm-96cfcf8-null-wrapped-objects

Signed-off-by: Zongyao Chen ZongYao.Chen@linux.alibaba.com

* lua-lsm: validate inode_init_security xattr output
* lua-lsm: own inode_init_security xattr name storage
* lua-lsm: document OCFS2 xattr name lifetime issue

---------

Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Some Lua accessors expose optional kernel pointers. d_backing_inode(),
sk->sk_socket, sock->sk, skb->sk, and skb_to_full_sk() can return
NULL, but the accessors wrapped those values as typed userdata.

Lua policy then sees a non-nil object and can call methods that
dereference the stored pointer without another NULL check.

Return nil for missing optional objects, matching the existing
convention used by Lua-LSM hook argument marshalling.

Signed-off-by: Zongyao Chen <ZongYao.Chen@linux.alibaba.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant