public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Laight <David.Laight@aculab.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Serge E. Hallyn" <serge@hallyn.com>
Subject: Re: [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net
Date: Thu, 29 Sep 2022 22:15:26 +0100	[thread overview]
Message-ID: <YzYK7k3tgZy3Pwht@ZenIV> (raw)
In-Reply-To: <YzXzXNAgcJeJ3M0d@ZenIV>

On Thu, Sep 29, 2022 at 08:34:52PM +0100, Al Viro wrote:
> On Thu, Sep 29, 2022 at 12:05:32PM -0700, Linus Torvalds wrote:
> > On Thu, Sep 29, 2022 at 12:00 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > Which is insane, especially since the entire problem is due to wanting
> > > that directory to be different for different threads...
> > 
> > Absolutely. This is all due to Apparmor (a) basing things on pathnames
> > and (b) then getting those pathnames wrong.
> > 
> > Which is why I'm just suggesting we short-circuit the path-name part,
> > and not make this be a real symlink that actually walks a real path.
> > 
> > The proc <pid> handling uses "readlink" to make it *look* like a
> > symlink, but then "get_link" to actually look it up (and never walk it
> > as a path).
> > 
> > Something similar?
> 
> Apparmor takes mount+dentry and turns that into pathname.  Then acts
> upon the resulting string.  *AFTER* the original had been resolved.
> IOW, it doesn't see the symlink contents - only the location where the
> entire thing ends up.
> 
> AFAICS, the only way to make it STFU is either
> 	* fix the idiotic policy
> or
> 	* make the per-thread directory show up as /proc/<something>/net
> 
> As in "../.. from there lands you in /proc".  Because that's what
> apparmor does to generate the string it treats as the pathname...

FWIW, what e.g. debian profile for dhclient has is
  @{PROC}/@{pid}/net/dev      r,

Note that it's not
  @{PROC}/net/dev      r,

precisely because the rules are applied after the pathname got resolved.
*IF* we want that rule to allow opening /proc/net/dev, we'd better have
it yield a dentry in procfs that would have "dev" as ->d_name, with
its parent having "net" as ->d_name and its grandparent being the child
of procfs root with ->d_name containing decimal representation of PID.

Worse, original poster in _this_ thread wants the same /proc/net/dev to
to yield different files for different threads belonging to the same
process and we'd need _all_ of them to have identical chain of ->d_name
occuring on the way to root.

  parent reply	other threads:[~2022-09-29 21:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 15:22 [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net David Laight
2022-09-29 18:21 ` Linus Torvalds
2022-09-29 18:50   ` Al Viro
2022-09-29 19:00     ` Al Viro
2022-09-29 19:05       ` Linus Torvalds
2022-09-29 19:34         ` Al Viro
2022-09-29 21:13           ` Linus Torvalds
2022-09-29 21:21             ` Al Viro
2022-09-29 21:27               ` Al Viro
2022-09-29 21:31                 ` Linus Torvalds
2022-09-29 21:15           ` Al Viro [this message]
2022-09-29 21:29             ` Linus Torvalds
2022-09-29 22:14               ` Eric W. Biederman
2022-09-29 22:48                 ` [CFT][PATCH] proc: Update /proc/net to point at the accessing threads network namespace Eric W. Biederman
2022-09-29 23:38                   ` Al Viro
2022-09-30  3:19                   ` kernel test robot
2022-09-30  6:07                   ` kernel test robot
2022-09-30  9:30                   ` David Laight
2022-09-30 16:17                     ` Eric W. Biederman
2022-09-30 21:28                       ` David Laight
2022-10-01 23:11                         ` Al Viro
2022-10-03  9:36                           ` David Laight
2022-10-03 14:03                             ` Al Viro
2022-10-03 17:07                         ` Eric W. Biederman
2022-10-03 18:49                           ` Al Viro
2022-10-04  8:53                           ` David Laight
2022-10-05 13:10                   ` [proc] 5336f1902b: BUG:KASAN:global-out-of-bounds_in_memchr kernel test robot
2022-09-29 19:00     ` [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net Linus Torvalds

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=YzYK7k3tgZy3Pwht@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=David.Laight@aculab.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox