* 4.18-rc1 regression in /proc/self xattr handling
@ 2018-06-22 14:37 Casey Schaufler
2018-06-22 14:52 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Casey Schaufler @ 2018-06-22 14:37 UTC (permalink / raw)
To: linux-security-module
There is a regression in behavior regarding xattrs in /proc after:
commit 1bbc55131e59bd099fdc568d3aa0b42634dbd188
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Wed May 2 21:26:16 2018 -0400
procfs: get rid of ancient BS in pid_revalidate() uses
Prior to this change lgetxattr() would provide the correct attributes
for entries in /proc. With this change I see that while the behavior
remains correct if the procid is specified, it is not when "self" is
used. On a system with Smack enabled, where the shell has the Smack label
"Crackle" I see:
[root at localhost linux]# attr -S -g SMACK64 /proc/self/attr/current
Attribute "SMACK64" had a 1 byte value for /proc/self/attr/current:
_
[root at localhost linux]# attr -S -g SMACK64 /proc/$BASHPID/attr/current
Attribute "SMACK64" had a 7 byte value for /proc/1716/attr/current:
Crackle
These should be the same, and in the past have been. I don't know
what SELinux expects as far as attributes in /proc, so I can't say
if the problem is manifest with SELinux.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* 4.18-rc1 regression in /proc/self xattr handling
2018-06-22 14:37 4.18-rc1 regression in /proc/self xattr handling Casey Schaufler
@ 2018-06-22 14:52 ` Al Viro
2018-06-22 17:54 ` [PATCH] Smack: Mark inode instant in smack_task_to_inode Casey Schaufler
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2018-06-22 14:52 UTC (permalink / raw)
To: linux-security-module
On Fri, Jun 22, 2018 at 07:37:00AM -0700, Casey Schaufler wrote:
> There is a regression in behavior regarding xattrs in /proc after:
>
> commit 1bbc55131e59bd099fdc568d3aa0b42634dbd188
> Author: Al Viro <viro@zeniv.linux.org.uk>
> Date: Wed May 2 21:26:16 2018 -0400
>
> procfs: get rid of ancient BS in pid_revalidate() uses
>
>
> Prior to this change lgetxattr() would provide the correct attributes
> for entries in /proc. With this change I see that while the behavior
> remains correct if the procid is specified, it is not when "self" is
> used. On a system with Smack enabled, where the shell has the Smack label
> "Crackle" I see:
>
> [root at localhost linux]# attr -S -g SMACK64 /proc/self/attr/current
> Attribute "SMACK64" had a 1 byte value for /proc/self/attr/current:
> _
> [root at localhost linux]# attr -S -g SMACK64 /proc/$BASHPID/attr/current
> Attribute "SMACK64" had a 7 byte value for /proc/1716/attr/current:
> Crackle
Wait a sec - the former will be that of attr, the latter - of bash;
it's not the same file at all.
> These should be the same, and in the past have been. I don't know
> what SELinux expects as far as attributes in /proc, so I can't say
> if the problem is manifest with SELinux.
Very interesting... About the only thing changed here seems to be
the relative order of smack_d_instantiate() and smack_task_to_inode()...
Would setting SMK_INODE_INSTANT in isp->smk_flags in smack_task_to_inode()
be the right thing to do, anyway?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Smack: Mark inode instant in smack_task_to_inode
2018-06-22 14:52 ` Al Viro
@ 2018-06-22 17:54 ` Casey Schaufler
0 siblings, 0 replies; 3+ messages in thread
From: Casey Schaufler @ 2018-06-22 17:54 UTC (permalink / raw)
To: linux-security-module
Smack: Mark inode instant in smack_task_to_inode
/proc clean-up in commit 1bbc55131e59bd099fdc568d3aa0b42634dbd188
resulted in smack_task_to_inode() being called before smack_d_instantiate.
This resulted in the smk_inode value being ignored, even while present
for files in /proc/self. Marking the inode as instant here fixes that.
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
security/smack/smack_lsm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 7ad226018f51..19de675d4504 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -2296,6 +2296,7 @@ static void smack_task_to_inode(struct task_struct *p, struct inode *inode)
struct smack_known *skp = smk_of_task_struct(p);
isp->smk_inode = skp;
+ isp->smk_flags |= SMK_INODE_INSTANT;
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-22 17:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-22 14:37 4.18-rc1 regression in /proc/self xattr handling Casey Schaufler
2018-06-22 14:52 ` Al Viro
2018-06-22 17:54 ` [PATCH] Smack: Mark inode instant in smack_task_to_inode Casey Schaufler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).