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]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux