Skip to content

lua-lsm: fix AF_UNIX sockaddr marshalling lengths#12

Open
chenzongyao200127 wants to merge 2 commits into
openanolis:lua-lsmfrom
chenzongyao200127:lua-lsm-b13d9e8-af-unix-sockaddr-len
Open

lua-lsm: fix AF_UNIX sockaddr marshalling lengths#12
chenzongyao200127 wants to merge 2 commits into
openanolis:lua-lsmfrom
chenzongyao200127:lua-lsm-b13d9e8-af-unix-sockaddr-len

Conversation

@chenzongyao200127
Copy link
Copy Markdown
Collaborator

AF_UNIX socket addresses are not C strings in all cases. Abstract socket names may contain embedded NUL bytes and their usable length comes from the sockaddr length passed by the hook.

Carry the sockaddr length together with the pointer exposed to Lua and use that length when formatting AF_UNIX paths. This preserves abstract socket names and avoids reading past the supplied sockaddr.

Validation:

  • ./scripts/checkpatch.pl --git origin/lua-lsm..lua-lsm-b13d9e8-af-unix-sockaddr-len
  • git diff --check origin/lua-lsm..lua-lsm-b13d9e8-af-unix-sockaddr-len

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>
AF_UNIX socket addresses are not C strings in all cases. Abstract
socket names may contain embedded NUL bytes and their usable length
comes from the sockaddr length passed by the hook.

Carry the sockaddr length together with the pointer exposed to Lua and
use that length when formatting AF_UNIX paths. This preserves abstract
socket names and avoids reading past the supplied sockaddr.

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