linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jordy Zomer <jordy@pwning.systems>,
	"Ahmed S. Darwish" <a.darwish@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v2] fs: make d_path-like functions all have unsigned size
Date: Tue, 27 Jul 2021 15:30:55 +0200	[thread overview]
Message-ID: <YQAKj4LFifmlVi0q@kroah.com> (raw)
In-Reply-To: <YQAGvTZPex3mxrD/@casper.infradead.org>

On Tue, Jul 27, 2021 at 02:14:37PM +0100, Matthew Wilcox wrote:
> On Tue, Jul 27, 2021 at 02:56:53PM +0200, Greg Kroah-Hartman wrote:
> > And my mistake from earlier, size_t is the same as unsigned int, not
> > unsigned long.
> 
> No.
> 
> include/linux/types.h:typedef __kernel_size_t           size_t;
> 
> include/uapi/asm-generic/posix_types.h:
> 
> #ifndef __kernel_size_t
> #if __BITS_PER_LONG != 64
> typedef unsigned int    __kernel_size_t;
> #else
> typedef __kernel_ulong_t __kernel_size_t;
> #endif
> #endif
> 
> size_t is an unsigned long on 64-bit, unless otherwise defined by the
> arch.

ugh, ok, so there really is a problem, as we have a size_t value being
passed in as an int, and then it could be treated as a negative value
for some fun pointer math to copy buffers around.

How is this not causing problems now already?  Are we just getting
lucky?

thanks,

greg k-h

  reply	other threads:[~2021-07-27 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 12:07 [PATCH v2] fs: make d_path-like functions all have unsigned size Greg Kroah-Hartman
2021-07-27 12:39 ` Andy Shevchenko
2021-07-27 12:56   ` Greg Kroah-Hartman
2021-07-27 13:14     ` Matthew Wilcox
2021-07-27 13:30       ` Greg Kroah-Hartman [this message]
2021-07-27 13:53         ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQAKj4LFifmlVi0q@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=a.darwish@linutronix.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ebiggers@google.com \
    --cc=jordy@pwning.systems \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).