[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0ioc1t62C68g7twcJRQixiB2uxCpcW3QFu6Rpwu15jUzw@mail.gmail.com>
Date: Tue, 4 May 2021 17:06:10 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Mark Langsdorf <mlangsdo@...hat.com>,
Kees Cook <keescook@...omium.org>,
Wenwen Wang <wenwen@...uga.edu>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH] Revert "ACPI: custom_method: fix memory leaks"
On Mon, May 3, 2021 at 4:51 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Mon, May 03, 2021 at 08:17:14AM -0500, Mark Langsdorf wrote:
> > In 5/2/21 12:23 PM, Kees Cook wrote:
> > > This reverts commit 03d1571d9513369c17e6848476763ebbd10ec2cb.
> > >
> > > While /sys/kernel/debug/acpi/custom_method is already a privileged-only
> > > API providing proxied arbitrary write access to kernel memory[1][2],
> > > with existing race conditions[3] in buffer allocation and use that could
> > > lead to memory leaks and use-after-free conditions, the above commit
> > > appears to accidentally make the use-after-free conditions even easier
> > > to accomplish. ("buf" is a global variable and prior kfree()s would set
> > > buf back to NULL.)
> > >
> > > This entire interface needs to be reworked (if not entirely removed).
> > >
> > > [1] https://lore.kernel.org/lkml/20110222193250.GA23913@outflux.net/
> > > [2] https://lore.kernel.org/lkml/201906221659.B618D83@keescook/
> > > [3] https://lore.kernel.org/lkml/20170109231323.GA89642@beast/
> > >
> > > Cc: Wenwen Wang <wenwen@...uga.edu>
> > > Signed-off-by: Kees Cook <keescook@...omium.org>
> > > ---
> >
> > I have two patches submitted to linux-acpi to fix the most obvious bugs in
> > the current driver. I don't think that just reverting this patch in its
> > entirety is a good solution: it still leaves the buf allocated in -EINVAL,
> > as well as the weird case where a not fully consumed buffer can be
> > reallocated without being freed on a subsequent call.
> >
> > https://lore.kernel.org/linux-acpi/20210427185434.34885-1-mlangsdo@redhat.com/
> >
> > https://lore.kernel.org/linux-acpi/20210423152818.97077-1-mlangsdo@redhat.com/
> >
> > I support rewriting this driver in its entirety, but reverting one bad patch
> > to leave it in a different buggy state is less than ideal.
>
> It's buggy now, and root-only, so it's a low bar at the moment :)
So dropping it completely may be a better choice.
IMO let's let the Mark's commits go in now and we'll see later.
Thanks!
Powered by blists - more mailing lists