Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 22 Mar 2003 07:02:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 22 Mar 2003 07:02:14 -0500 Received: from packet.digeo.com ([12.110.80.53]:48356 "EHLO packet.digeo.com") by vger.kernel.org with ESMTP id ; Sat, 22 Mar 2003 07:02:13 -0500 Date: Sat, 22 Mar 2003 04:12:51 -0800 From: Andrew Morton To: Dawson Engler Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [CHECKER] races in 2.5.65/mm/swapfile.c? Message-Id: <20030322041251.7720e42f.akpm@digeo.com> In-Reply-To: <200303221145.h2MBjAW09391@csl.stanford.edu> References: <200303221145.h2MBjAW09391@csl.stanford.edu> X-Mailer: Sylpheed version 0.8.9 (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Mar 2003 12:12:47.0302 (UTC) FILETIME=[59C51E60:01C2F06C] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1301 Lines: 41 Dawson Engler wrote: > > Hi All, > > mm/swapfile.c seems to have three potential races. > > The first two are in > linux-2.5.62/mm/swap_state.c:87:add_to_swap_cache > > which seems reachable without a lock from the callchain: > > mm/swapfile.c:sys_swapoff:998-> > sys_swapoff:1026-> > try_to_unuse:591-> > mm/swap_state.c:read_swap_cache_async:377-> > add_to_swap_cache > > add_to_swap_cache increments two global variables without a lock: > INC_CACHE_INFO(add_total); > and > INC_CACHE_INFO(exist_race); These are just instrumentation. If they're a bit inaccurate nobody cares, and they're not worth locking. So yes, that is a positive. > The final one is in > linux-2.5.62/mm/swapfile.c:213:swap_entry_free > which seems to increment > nr_swap_pages++; > without a lock. swap_entry_free() is called after swap_info_get(), which locks the swap device list and the particular swap device. - 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/