[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202405131629.9C315328C1@keescook>
Date: Mon, 13 May 2024 16:29:55 -0700
From: Kees Cook <keescook@...omium.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Nathan Chancellor <nathan@...nel.org>,
Bill Wendling <morbo@...gle.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] fs: fix unintentional arithmetic wraparound in offset
calculation
On Mon, May 13, 2024 at 10:06:59PM +0000, Justin Stitt wrote:
> On Mon, May 13, 2024 at 01:01:57PM -0700, Kees Cook wrote:
> > On Thu, May 09, 2024 at 11:42:07PM +0000, Justin Stitt wrote:
> > > fs/read_write.c | 18 +++++++++++-------
> > > fs/remap_range.c | 12 ++++++------
> > > 2 files changed, 17 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/fs/read_write.c b/fs/read_write.c
> > > index d4c036e82b6c..d116e6e3eb3d 100644
> > > --- a/fs/read_write.c
> > > +++ b/fs/read_write.c
> > > @@ -88,7 +88,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,
> > > {
> > > switch (whence) {
> > > case SEEK_END:
> > > - offset += eof;
> > > + offset = min(offset, maxsize - eof) + eof;
> >
> > This seems effectively unchanged compared to v1?
> >
> > https://lore.kernel.org/all/CAFhGd8qbUYXmgiFuLGQ7dWXFUtZacvT82wD4jSS-xNTvtzXKGQ@mail.gmail.com/
> >
>
> Right, please note the timestamps of Jan's review of v1 and when I sent
> v2. Essentially, I sent v2 before Jan's review of v1 and as such v2 does
> not fix the problem pointed out by Jan (the behavior of seek is
> technically different for VERY LARGE offsets).
Oh! Heh. I was tricked by versioning! ;)
--
Kees Cook
Powered by blists - more mailing lists