All of lore.kernel.org
 help / color / mirror / Atom feed
From: viro@ZenIV.linux.org.uk (Al Viro)
To: linux-security-module@vger.kernel.org
Subject: 4.18-rc1 regression in /proc/self xattr handling
Date: Fri, 22 Jun 2018 15:52:59 +0100	[thread overview]
Message-ID: <20180622145259.GZ30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <020be8a4-961b-b92f-7ee9-3c439d629338@schaufler-ca.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: LKLM <linux-kernel@vger.kernel.org>,
	LSM <linux-security-module@vger.kernel.org>
Subject: Re: 4.18-rc1 regression in /proc/self xattr handling
Date: Fri, 22 Jun 2018 15:52:59 +0100	[thread overview]
Message-ID: <20180622145259.GZ30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <020be8a4-961b-b92f-7ee9-3c439d629338@schaufler-ca.com>

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@localhost linux]# attr -S -g SMACK64 /proc/self/attr/current
> Attribute "SMACK64" had a 1 byte value for /proc/self/attr/current:
> _
> [root@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?

  reply	other threads:[~2018-06-22 14:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 14:37 4.18-rc1 regression in /proc/self xattr handling Casey Schaufler
2018-06-22 14:37 ` Casey Schaufler
2018-06-22 14:52 ` Al Viro [this message]
2018-06-22 14:52   ` Al Viro
2018-06-22 17:54   ` [PATCH] Smack: Mark inode instant in smack_task_to_inode Casey Schaufler
2018-06-22 17:54     ` Casey Schaufler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180622145259.GZ30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-security-module@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.