From patchwork Tue Apr 11 18:52:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9675957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD5C5600CB for ; Tue, 11 Apr 2017 18:52:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDE7928565 for ; Tue, 11 Apr 2017 18:52:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C12ED28579; Tue, 11 Apr 2017 18:52:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65FA428565 for ; Tue, 11 Apr 2017 18:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752385AbdDKSwh (ORCPT ); Tue, 11 Apr 2017 14:52:37 -0400 Received: from mga07.intel.com ([134.134.136.100]:22607 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752224AbdDKSwh (ORCPT ); Tue, 11 Apr 2017 14:52:37 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 11 Apr 2017 11:52:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,186,1488873600"; d="scan'208";a="1118285599" Received: from theros.lm.intel.com (HELO linux.intel.com) ([10.232.112.77]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2017 11:52:35 -0700 Date: Tue, 11 Apr 2017 12:52:35 -0600 From: Ross Zwisler To: Jeff Moyer Cc: Eryu Guan , Xiong Zhou , fstests@vger.kernel.org, ross.zwisler@linux.intel.com, dan.j.williams@intel.com Subject: Re: [PATCH v2 3/3] DAX: mmap write readonly file Message-ID: <20170411185235.GA32027@linux.intel.com> References: <20170407171600.GA29489@linux.intel.com> <1491804353-1326-1-git-send-email-xzhou@redhat.com> <1491804353-1326-3-git-send-email-xzhou@redhat.com> <20170411114619.GK22845@eguan.usersys.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 11, 2017 at 09:56:14AM -0400, Jeff Moyer wrote: > Eryu Guan writes: > > > On Mon, Apr 10, 2017 at 02:05:53PM +0800, Xiong Zhou wrote: > >> Regression case that one can write to read-only > >> file in a DAX mountpoint. > >> > >> Signed-off-by: Xiong Zhou > >> --- > >> > >> v2: > >> compile test programme manually in this test because default > >> cc option -O2 prevents this issue reproduction; > > > > Hmm, this looks.. ugly to me :) Better to find out the exact reason that > > prevents the bug from reproducing and update the c program accordingly. > > The compiler probably optimizes this bit out: > > + /* fault in the page */ > + foo = *buf; Yep, verified this with objdump. You can prevent the compiler from optimizing out this bit by making 'foo' volatile. Patch at the end of this mail, and I also verified that this works with objdump. In my setup at least this test passes both with v4.10.0 (which does not contain the fix we are testing for, and should fail) and with v4.10.3 (which does contain the kernel fix, and should pass). So, I think the test still needs a little love. :) --- -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/t_mmap_write_ro.c b/src/t_mmap_write_ro.c index cce6e0d..3960815 100644 --- a/src/t_mmap_write_ro.c +++ b/src/t_mmap_write_ro.c @@ -11,7 +11,8 @@ int main(int argc, char **argv) { int fd, pfd, ret; - char *buf, foo; + char *buf; + volatile char foo; int pagesize = getpagesize(); if (argc < 2) {