[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200708133250.GH4332@42.do-not-panic.com>
Date: Wed, 8 Jul 2020 13:32:50 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
linux-kernel@...r.kernel.org, David Miller <davem@...emloft.net>,
Greg Kroah-Hartman <greg@...ah.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexei Starovoitov <ast@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>, bpf <bpf@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jakub Kicinski <kuba@...nel.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Gary Lin <GLin@...e.com>, Bruno Meneguele <bmeneg@...hat.com>,
LSM List <linux-security-module@...r.kernel.org>,
Casey Schaufler <casey@...aufler-ca.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v3 10/16] exec: Remove do_execve_file
On Wed, Jul 08, 2020 at 08:08:09AM -0500, Eric W. Biederman wrote:
> Luis Chamberlain <mcgrof@...nel.org> writes:
>
> > On Wed, Jul 08, 2020 at 06:35:25AM +0000, Luis Chamberlain wrote:
> >> On Thu, Jul 02, 2020 at 11:41:34AM -0500, Eric W. Biederman wrote:
> >> > Now that the last callser has been removed remove this code from exec.
> >> >
> >> > For anyone thinking of resurrecing do_execve_file please note that
> >> > the code was buggy in several fundamental ways.
> >> >
> >> > - It did not ensure the file it was passed was read-only and that
> >> > deny_write_access had been called on it. Which subtlely breaks
> >> > invaniants in exec.
> >> >
> >> > - The caller of do_execve_file was expected to hold and put a
> >> > reference to the file, but an extra reference for use by exec was
> >> > not taken so that when exec put it's reference to the file an
> >> > underflow occured on the file reference count.
> >>
> >> Maybe its my growing love with testing, but I'm going to have to partly
> >> blame here that we added a new API without any respective testing.
> >> Granted, I recall this this patch set could have used more wider review
> >> and a bit more patience... but just mentioning this so we try to avoid
> >> new api-without-testing with more reason in the future.
> >>
> >> But more importantly, *how* could we have caught this? Or how can we
> >> catch this sort of stuff better in the future?
> >
> > Of all the issues you pointed out with do_execve_file(), since upon
> > review the assumption *by design* was that LSMs/etc would pick up issues
> > with the file *prior* to processing, I think that this file reference
> > count issue comes to my attention as the more serious issue which I
> > wish we could address *first* before this crusade.
> >
> > So I have to ask, has anyone *really tried* to give a crack at fixing
> > this refcount issue in a smaller way first? Alexei?
> >
> > I'm not opposed to the removal of do_execve_file(), however if there
> > is a reproducible crash / issue with the existing user, this sledge
> > hammer seems a bit overkill for older kernels.
>
> It does not matter for older kernels because there is exactly one user.
> That one user is just a place holder keeping the code alive until a real
> user comes along.
>
> For older kernels the solution is to just mark the bpfilter code broken
> in Kconfig and refuse to compile it. That is the trivial backportable
> fix if anyone wants one.
This seals the deal for me, thanks! Carry on, but hey, please add
yourself to MAINTAINERS too :)
Luis
Powered by blists - more mailing lists