From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
"Zwisler, Ross <ross.zwisler@intel.com>,
linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [patch] dax: fix PMD faults on zero-length files
Date: Wed, 15 Nov 2017 12:16:37 -0700 [thread overview]
Message-ID: <20171115191637.GA30208@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4gnqfBs9MyZtW0hq9Ffv8N5XXfpDYGP8GzCHnDGXe-EVA@mail.gmail.com>
On Tue, Nov 14, 2017 at 05:47:51PM -0800, Dan Williams wrote:
> On Tue, Nov 14, 2017 at 5:37 PM, Jeff Moyer <jmoyer@redhat.com> wrote:
> > PMD faults on a zero length file on a file system mounted with -o dax
> > will not generate SIGBUS as expected.
> >
> > fd = open(...O_TRUNC);
> > addr = mmap(NULL, 2*1024*1024, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
> > *addr = 'a';
> > <expect SIGBUS>
> >
> > The problem is this code in dax_iomap_pmd_fault:
> >
> > max_pgoff = (i_size_read(inode) - 1) >> PAGE_SHIFT;
> >
> > If the inode size is zero, we end up with a max_pgoff that is way larger
> > than 0. :) Fix it by using DIV_ROUND_UP, as is done elsewhere in the
> > kernel.
> >
> > I tested this with some simple test code that ensured that SIGBUS was
> > received where expected.
> >
>
> I assume this needs:
>
> Fixes: 642261ac995e ("dax: add struct iomap based DAX PMD support")
> Cc: <stable@vger.kernel.org>
>
> ...otherwise looks good to me.
Yep, this fix looks good, thanks. You can add:
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
prev parent reply other threads:[~2017-11-15 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 1:37 [patch] dax: fix PMD faults on zero-length files Jeff Moyer
2017-11-15 1:47 ` Dan Williams
2017-11-15 19:16 ` Ross Zwisler [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=20171115191637.GA30208@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.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