lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 29 Sep 2022 22:15:26 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     David Laight <David.Laight@...lab.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        "Serge E. Hallyn" <serge@...lyn.com>
Subject: Re: [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net
 instead of /proc/self/net

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@...iv.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}/@...d}/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.

Powered by blists - more mailing lists