Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208945

Re: Potential data race in SyS_swapon

From Hugh Dickins <hughd@google.com>
Newsgroups linux.kernel
Subject Re: Potential data race in SyS_swapon
Date 2015-08-18 01:30 +0200
Message-ID <pYC0O-5ab-5@gated-at.bofh.it> (permalink)
References <pUSxe-4FO-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Potential data race in SyS_swapon Andrey Konovalov <andreyknvl@google.com> - 2015-08-07 18:20 +0200
  Re: Potential data race in SyS_swapon Cesar Eduardo Barros <cesarb@cesarb.eti.br> - 2015-08-08 01:50 +0200
  Re: Potential data race in SyS_swapon Hugh Dickins <hughd@google.com> - 2015-08-18 01:30 +0200
    [PATCH] mm: fix potential data race in SyS_swapon Hugh Dickins <hughd@google.com> - 2015-08-18 02:40 +0200

csiph-web