Re: [PATCH] selinux: remove redundant msg_msg_alloc_security
From: Huaisheng HS1 Ye
Date: Fri Jan 10 2020 - 11:46:56 EST
> -----Original Message-----
> From: Stephen Smalley <sds@xxxxxxxxxxxxx>
> Sent: Friday, January 10, 2020 11:14 PM
>
> On 1/10/20 4:58 AM, Huaisheng Ye wrote:
> > From: Huaisheng Ye <yehs1@xxxxxxxxxx>
> >
> > selinux_msg_msg_alloc_security only calls msg_msg_alloc_security but
> > do nothing else. And also msg_msg_alloc_security is just used by the
> > former.
> >
> > Remove the redundant function to simplify the code.
>
> This seems to also be true of other _alloc_security functions, probably due to
> historical reasons. Further, at least some of these functions no longer perform
> any allocation; they are just initialization functions now that allocation has
> been taken to the LSM framework, so possibly could be renamed and made to return
> void at some point.
>
> >
> > Signed-off-by: Huaisheng Ye <yehs1@xxxxxxxxxx>
>
> Acked-by: Stephen Smalley <sds@xxxxxxxxxxxxx>
Many thanks for the Acked-by.
Yes, you are right, selinux_msg_msg_alloc_security only can return 0 in any case.
I think that should be modified to void instead of int.
And also, the fact is no module needs to implement msg_msg_free_security, because
LSM would take the responsibility for freeing msg->security.
I think we could delete the hook call of msg_msg_free_security, but I am cautious
to modify the existing interfaces, that just worry to break traditional rules.
Cheers,
Huaisheng Ye
Lenovo