[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4165f531-9d8a-4378-812f-41baa5665097@huaweicloud.com>
Date: Sat, 13 Jul 2024 16:06:59 +0800
From: Xu Kuohai <xukuohai@...weicloud.com>
To: Serge Hallyn <serge@...lyn.com>, Xu Kuohai <xukuohai@...weicloud.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-integrity@...r.kernel.org, apparmor@...ts.ubuntu.com,
selinux@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman
<eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Matt Bobrowski <mattbobrowski@...gle.com>,
Brendan Jackman <jackmanb@...omium.org>, Paul Moore <paul@...l-moore.com>,
James Morris <jmorris@...ei.org>, Khadija Kamran
<kamrankhadijadj@...il.com>, Casey Schaufler <casey@...aufler-ca.com>,
Ondrej Mosnacek <omosnace@...hat.com>, Kees Cook <keescook@...omium.org>,
John Johansen <john.johansen@...onical.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Roberto Sassu <roberto.sassu@...wei.com>,
Shung-Hsi Yu <shung-hsi.yu@...e.com>, Edward Cree <ecree.xilinx@...il.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Stephen Smalley <stephen.smalley.work@...il.com>
Subject: Re: [PATCH bpf-next v4 02/20] lsm: Refactor return value of LSM hook
inode_need_killpriv
On 7/11/2024 10:15 PM, Serge Hallyn wrote:
> Jul 11, 2024 06:14:09 Xu Kuohai <xukuohai@...weicloud.com>:
>
>> From: Xu Kuohai <xukuohai@...wei.com>
>>
>> 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@...wei.com>
>
> 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 '@...d'.
Thanks.
Powered by blists - more mailing lists