[PATCH] selinux: remove redundant msg_msg_alloc_security

Huaisheng HS1 Ye yehs1 at lenovo.com
Fri Jan 10 16:46:34 UTC 2020


> -----Original Message-----
> From: Stephen Smalley <sds at tycho.nsa.gov>
> Sent: Friday, January 10, 2020 11:14 PM
> 
> On 1/10/20 4:58 AM, Huaisheng Ye wrote:
> > From: Huaisheng Ye <yehs1 at lenovo.com>
> >
> > 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 at lenovo.com>
> 
> Acked-by: Stephen Smalley <sds at tycho.nsa.gov>

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




More information about the Linux-security-module-archive mailing list