[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.11.1508171610190.2618@eggly.anvils>
Date: Mon, 17 Aug 2015 16:22:21 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Andrey Konovalov <andreyknvl@...gle.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.cz>,
Johannes Weiner <hannes@...xchg.org>,
Vladimir Davydov <vdavydov@...allels.com>,
Hugh Dickins <hughd@...gle.com>,
Miklos Szeredi <mszeredi@...e.cz>,
Jason Low <jason.low2@...com>,
Cesar Eduardo Barros <cesarb@...arb.net>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Dmitry Vyukov <dvyukov@...gle.com>,
Kostya Serebryany <kcc@...gle.com>,
Alexander Potapenko <glider@...gle.com>
Subject: Re: Potential data race in SyS_swapon
On Fri, 7 Aug 2015, Andrey Konovalov wrote:
>
> We are working on a dynamic data race detector for the Linux kernel
> called KernelThreadSanitizer (ktsan)
> (https://github.com/google/ktsan/wiki).
>
> While running ktsan on the upstream revision 21bdb584af8c with trinity
> we got a few reports from SyS_swapon, here is one of them:
>
> ==================================================================
> ThreadSanitizer: data-race in SyS_swapon
>
> Read of size 8 by thread T307 (K7621):
> [< inlined >] SyS_swapon+0x3c0/0x1850 SYSC_swapon mm/swapfile.c:2395
> [<ffffffff812242c0>] SyS_swapon+0x3c0/0x1850 mm/swapfile.c:2345
> [<ffffffff81e97c8a>] ia32_do_call+0x1b/0x25
>
> Looks like the swap_lock should be taken when iterating through the
> swap_info array on lines 2392 - 2401.
Thanks for the report. Actually, lines 2392 to 2401 just look redundant
to me: it looks as if claim_swapfile() should do all that's needed,
though in fact it doesn't quite. I'll send akpm a patch and Cc you,
no need to retest since the offending lines just won't be there.
Hugh
--
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