From: Keir Fraser Subject: Re: Re: [PATCH 2/3] xenoprof fixes: active_domains races Date: Tue, 16 May 2006 09:09:01 +0100 Message-ID: References: <87hd3r2qst.fsf@pike.pond.sub.org> <878xp32qqf.fsf@pike.pond.sub.org> <87ac9j19b1.fsf@pike.pond.sub.org> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <87ac9j19b1.fsf@pike.pond.sub.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Markus Armbruster Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 15 May 2006, at 18:34, Markus Armbruster wrote: > The active_domains code has race conditions: > > * oprofile_set_active() calls set_active() method without holding > start_sem. This is clearly wrong, as xenoprof_set_active() makes > several hypercalls. oprofile_start(), for instance, could run in > the middle of xenoprof_set_active(). > > * adomain_write(), adomain_read() and xenoprof_set_active() access > global active_domains[] and adomains without synchronization. I > went for a simple, obvious fix and created another mutex. Instead, > one could move the shared data into oprof.c and protect it with > start_sem, but that's more invasive. > > Signed-off-by: Markus Armbruster Apart from updating to use the new mutex operations, patches 2 and 3 of your submitted set should be applied to patches/linux-2.6.16.13/xenoprof-generic.patch (yes, they need to be a patch of patch: sorry about that!). However, feel free to submit one mega-patch that merges both patches into one patch-of-a-patch. -- Keir