Re: [PATCH bpf-next v4 02/20] lsm: Refactor return value of LSM hook inode_need_killpriv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/11/2024 10:15 PM, Serge Hallyn wrote:
Jul 11, 2024 06:14:09 Xu Kuohai <xukuohai@xxxxxxxxxxxxxxx>:

From: Xu Kuohai <xukuohai@xxxxxxxxxx>

To be consistent with most LSM hooks, convert the return value of
hook inode_need_killpriv to 0 or a negative error code.

Before:
- Both hook inode_need_killpriv and func security_inode_need_killpriv
   return > 0 if security_inode_killpriv is required, 0 if not, and < 0
   to abort the operation.

After:
- Both hook inode_need_killpriv and func security_inode_need_killpriv
   return 0 on success and a negative error code on failure.
   On success, hook inode_need_killpriv sets output param @need to true
   if security_inode_killpriv is required, and false if not. When @need
   is true, func security_inode_need_killpriv sets ATTR_KILL_PRIV flag
   in @attr; when false, it clears the flag.
   On failure, @need and @attr remains unchanged.

Signed-off-by: Xu Kuohai <xukuohai@xxxxxxxxxx>

It looks ok - though unnecessary (I'm assuming a later patch works better with this) - , but I'd be more comfortable if it was documented that any callers of the need_killpriv hook must set need to false before calling. Or if the hooks set need to false at start.



I believe this is the only patch in the set that modifies 'inode_need_killpriv'.
I'll add an explanation for the initial value of '@need'.
Thanks.





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux