[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94b893ef37fe0cc0bcc52e8b54c62be3853a7bbb.camel@redhat.com>
Date: Thu, 31 Aug 2023 14:22:08 +0200
From: Philipp Stanner <pstanner@...hat.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Kees Cook <keescook@...omium.org>,
Andy Shevchenko <andy@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>,
Christian Brauner <brauner@...nel.org>,
David Disseldorp <ddiss@...e.de>,
Luis Chamberlain <mcgrof@...nel.org>,
Siddh Raman Pant <code@...dh.me>,
Nick Alcock <nick.alcock@...cle.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Zack Rusin <zackr@...are.com>,
VMware Graphics Reviewers
<linux-graphics-maintainer@...are.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, linux-hardening@...r.kernel.org,
David Airlie <airlied@...hat.com>
Subject: Re: [PATCH 1/5] string.h: add array-wrappers for (v)memdup_user()
On Wed, 2023-08-30 at 17:11 +0300, Andy Shevchenko wrote:
> On Wed, Aug 30, 2023 at 4:46 PM Philipp Stanner <pstanner@...hat.com>
> wrote:
> >
> > Currently, user array duplications are sometimes done without an
> > overflow check. Sometimes the checks are done manually; sometimes
> > the
> > array size is calculated with array_size() and sometimes by
> > calculating
> > n * size directly in code.
> >
> > Introduce wrappers for arrays for memdup_user() and vmemdup_user()
> > to
> > provide a standardized and safe way for duplicating user arrays.
> >
> > This is both for new code as well as replacing usage of
> > (v)memdup_user()
> > in existing code that uses, e.g., n * size to calculate array
> > sizes.
>
> ...
>
> > --- a/include/linux/string.h
> > +++ b/include/linux/string.h
>
> I'm wondering if this has no side-effects as string.h/string.c IIRC
> is
> used also for early stages where some of the APIs are not available.
>
I forgot to address this point in my previous reply.
Who's going to decide whether this is a problem or not?
My personal guess is that this is unlikely to be a problem because
A. either (v)memdup_user() is available, in which case
(v)memdup_array_user() will always work –
B. or (v)memdup_user() is not available, which would cause the code
that currently uses (v)memdup_user() for copying arrays to fail
anyways.
P.
Powered by blists - more mailing lists