public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] Prevent mmap command to map beyond EOF
Date: Thu, 7 Oct 2021 12:45:18 +0200	[thread overview]
Message-ID: <20211007104518.obsjrafsojryin7b@andromeda.lan> (raw)
In-Reply-To: <20211006165407.bplbdyfb66hbumk5@andromeda.lan>

On Wed, Oct 06, 2021 at 06:54:07PM +0200, Carlos Maiolino wrote:
> > > My biggest motivation was actually seeing xfs_io crashing due a sigbus
> > > while running generic/172 and generic/173. And personally, I'd rather see an
> > > error message like "attempt to mmap/mwrite beyond EOF" than seeing it crash.
> > > Also, as you mentioned, programs are allowed to set up such kind of
> > > configuration (IIUC what you mean, mixing mmap, extend, truncate, etc), so, I
> > > believe such userspace programs should also ensure they are not attempting to
> > > write to invalid memory.
> > 
> > This patch would /also/ prevent us from writing an fstest to check that
> > a process /does/ get SIGBUS when writing to a mapping beyond EOF.  Huh,
> > we don't have a test for that...

After looking closer into g/173, I see what you mean now.
> 
> The whole command that ends up receiving a SIGBUS is:
> 
> xfs_io -i -f -c 'mmap -rw 0 41943040' -c 'mwrite -S 0x62 0 41943040'

And...

> At a later point, I just did some tests using an empty, 0
> sized file.

And playing around with a 0 sized file without coming back to look closer into
g/173 was what had been blinding me.
Please just disregard this patch and my apologies for the noise.

-- 
Carlos


      reply	other threads:[~2021-10-07 10:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 14:11 [PATCH] Prevent mmap command to map beyond EOF Carlos Maiolino
2021-10-05 22:36 ` Darrick J. Wong
2021-10-06 11:34   ` Carlos Maiolino
2021-10-06 15:54     ` Darrick J. Wong
2021-10-06 16:54       ` Carlos Maiolino
2021-10-07 10:45         ` Carlos Maiolino [this message]

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=20211007104518.obsjrafsojryin7b@andromeda.lan \
    --to=cmaiolino@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.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