2024-03-15 17:31:20

by Christian Göttsche

[permalink] [raw]
Subject: [PATCH 1/2] selinux: avoid identifier using reserved name

Avoid using an identifier starting with double underscores, which
signals a reserved identifier.

Signed-off-by: Christian Göttsche <[email protected]>
---
security/selinux/hooks.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index a0fde0641f77..f9a61ff64b83 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -6347,16 +6347,16 @@ static void selinux_d_instantiate(struct dentry *dentry, struct inode *inode)
static int selinux_lsm_getattr(unsigned int attr, struct task_struct *p,
char **value)
{
- const struct task_security_struct *__tsec;
+ const struct task_security_struct *tsec;
u32 sid;
int error;
unsigned len;

rcu_read_lock();
- __tsec = selinux_cred(__task_cred(p));
+ tsec = selinux_cred(__task_cred(p));

if (current != p) {
- error = avc_has_perm(current_sid(), __tsec->sid,
+ error = avc_has_perm(current_sid(), tsec->sid,
SECCLASS_PROCESS, PROCESS__GETATTR, NULL);
if (error)
goto bad;
@@ -6364,22 +6364,22 @@ static int selinux_lsm_getattr(unsigned int attr, struct task_struct *p,

switch (attr) {
case LSM_ATTR_CURRENT:
- sid = __tsec->sid;
+ sid = tsec->sid;
break;
case LSM_ATTR_PREV:
- sid = __tsec->osid;
+ sid = tsec->osid;
break;
case LSM_ATTR_EXEC:
- sid = __tsec->exec_sid;
+ sid = tsec->exec_sid;
break;
case LSM_ATTR_FSCREATE:
- sid = __tsec->create_sid;
+ sid = tsec->create_sid;
break;
case LSM_ATTR_KEYCREATE:
- sid = __tsec->keycreate_sid;
+ sid = tsec->keycreate_sid;
break;
case LSM_ATTR_SOCKCREATE:
- sid = __tsec->sockcreate_sid;
+ sid = tsec->sockcreate_sid;
break;
default:
error = -EOPNOTSUPP;
--
2.43.0



2024-03-26 21:07:52

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH 1/2] selinux: avoid identifier using reserved name

On Fri, Mar 15, 2024 at 1:31 PM Christian Göttsche
<[email protected]> wrote:
>
> Avoid using an identifier starting with double underscores, which
> signals a reserved identifier.
>
> Signed-off-by: Christian Göttsche <[email protected]>
> ---
> security/selinux/hooks.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)

Thank you for the patch, but this was addressed by the patch below
which was posted on February 23rd.

https://lore.kernel.org/selinux/[email protected]

--
paul-moore.com