[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023060820-atom-doorstep-9442@gregkh>
Date: Thu, 8 Jun 2023 18:19:32 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Petr Mladek <pmladek@...e.com>
Cc: Kees Cook <keescook@...omium.org>,
Richard Weinberger <richard@....at>,
linux-hardening@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>
Subject: Re: [RFC PATCH 0/1] Integer overflows while scanning for integers
On Thu, Jun 08, 2023 at 05:27:40PM +0200, Petr Mladek wrote:
> On Wed 2023-06-07 16:36:12, Kees Cook wrote:
> > On Thu, Jun 08, 2023 at 12:37:54AM +0200, Richard Weinberger wrote:
> > > Hi!
> > >
> > > Lately I wondered whether users of integer scanning functions check
> > > for overflows.
> > > To detect such overflows around scanf I came up with the following
> > > patch. It simply triggers a WARN_ON_ONCE() upon an overflow.
> > >
> > > After digging into various scanf users I found that the network device
> > > naming code can trigger an overflow.
> > >
> > > e.g:
> > > $ ip link add 1 type veth peer name 9999999999
> > > $ ip link set name "%d" dev 1
> > >
> > > It will trigger the following WARN_ON_ONCE():
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 2 PID: 433 at lib/vsprintf.c:3701 vsscanf+0x6ce/0x990
> >
> > Hm, it's considered a bug if a WARN or BUG can be reached from
> > userspace,
>
> Good point. WARN() does not look like the right way in this case.
>
> Another problem is that some users use panic_on_warn. In this case,
> the above "ip" command calls would trigger panic(). And it does not
> look like an optimal behavior.
"some users" == "most major cloud providers and a few billion Android
phones" So in pure numbers, the huge majority of Linux systems running
in the world have that option enabled.
So please don't use WARN() to catch issues that can be triggered by
userspace, that can cause data loss and worse at times.
thanks,
greg k-h
Powered by blists - more mailing lists