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]
Message-Id: <E1N6jWB-0006gu-2u@pomaz-ex.szeredi.hu>
Date:	Sat, 07 Nov 2009 12:31:43 +0100
From:	Miklos Szeredi <miklos@...redi.hu>
To:	ebiederm@...ssion.com (Eric W. Biederman)
CC:	miklos@...redi.hu, pavel@....cz, alan@...rguk.ukuu.org.uk,
	akpm@...ux-foundation.org, viro@...IV.linux.org.uk,
	dhowells@...hat.com, hch@...radead.org, adilger@....com,
	mtk.manpages@...il.com, torvalds@...ux-foundation.org,
	drepper@...il.com, jamie@...reable.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 resend] vfs: new O_NODE open flag

On Sat, 07 Nov 2009, ebiederm@...ssion.com (Eric W. Biederman wrote:
> Miklos Szeredi <miklos@...redi.hu> writes:
> 
> > On Fri, 06 Nov 2009, ebiederm@...ssion.com (Eric W. Biederman wrote:
> >> So far no one who believes this to be a security hole has found it
> >> worth their while to look at nd->intent.open in proc_pid_follow_link
> >> and write a patch.
> >
> > A rather disgusting patch that would be.  The fact is, checking
> > permissions on follow_link makes little to no sense.  Consider
> > truncate(2), for example.  Will we add another intent for that?  I
> > really hope not
> 
> No.  I was just thinking we have the open intent that is there for
> combining lookup and open. We can look test for LOOKUP_OPEN and do
> exactly what we need.

No, because you just covered half the cases.  truncate(2) will still
work fine on the /proc/PID/fd/FD belonging to a O_RDONLY file
descriptor.

> > I'm more and more convinced, that the current behavior is the right
> > one.
> 
> I think the 15 or so years we have had the current behavior without
> problems is persuasive.
> 
> I think it is an interesting puzzle on how to get dup instead of
> reopen as there are cases where that could be useful behavior as well.

Probably doable with ptrace().

> The usefulness of an O_NONE flag increases significantly if you can
> open the reference file later with more permissions.  Essentially
> making a hardlink into a running program.  Hmm.  Weird cases do seem
> to show up when the last dir entry is removed.  

Why are they more weird than files opened without O_NODE?

The only really weird case Alan spotted is device nodes, where the
actual device registered to a major/minor pair changes over time,
possibly allowing a re-open to access a device it otherwise was not
meant to.  BTW if the device number reuse happens really quickly, this
could even be a race for a plain open.  Real solution might actually
be in udev: when deregistering a device, change mode bits to all-zero
before removing the device node.

> I wonder if we want a rule that you can't open a file with link count
> of 0.  Reasoning may get truly strange otherwise.

Again, don't see why this would be different for O_NODE as for
non-O_NODE files descriptors.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ