[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150921140615.GA30755@node.dhcp.inet.fi>
Date: Mon, 21 Sep 2015 17:06:15 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
kirill.shutemov@...ux.intel.com, riel@...hat.com, mhocko@...e.cz,
oleg@...hat.com, sasha.levin@...cle.com, gang.chen.5i5j@...il.com,
pfeiner@...gle.com, aarcange@...hat.com, vishnu.ps@...sung.com,
linux-mm@...ck.org, glider@...gle.com, kcc@...gle.com,
andreyknvl@...gle.com, ktsan@...glegroups.com,
paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH] fs: fix data race on mnt.mnt_flags
On Mon, Sep 21, 2015 at 02:16:47PM +0200, Dmitry Vyukov wrote:
> do_remount() does:
>
> mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK;
> mnt->mnt.mnt_flags = mnt_flags;
>
> This can easily be compiled as:
>
> mnt->mnt.mnt_flags &= ~MNT_USER_SETTABLE_MASK;
> mnt->mnt.mnt_flags |= mnt_flags;
>
> (also 2 memory accesses, less register pressure)
> The flags are being concurrently read by e.g. do_mmap_pgoff()
> which does:
>
> if (file->f_path.mnt->mnt_flags & MNT_NOEXEC)
>
> As the result we can allow to mmap a MNT_NOEXEC mount
> as VM_EXEC.
>
> Use WRITE_ONCE() to set new flags.
>
> The data race was found with KernelThreadSanitizer (KTSAN).
>
> Signed-off-by: Dmitry Vyukov <dvyukov@...gle.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
--
Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists