Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp81439ybr; Fri, 22 May 2020 01:20:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjznB0GEdOgSoootE7l79gsfe22eW9OlllK2rsysDOn2MIIXELdPPVvhAXYUV//DmnbOZS X-Received: by 2002:a17:906:3607:: with SMTP id q7mr6778492ejb.81.1590135626302; Fri, 22 May 2020 01:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590135626; cv=none; d=google.com; s=arc-20160816; b=xdpFbZiRS4dORvu36ZLhO4N6hadW+gFvqtXKW4/0I2kZbSr2+YGplWlyxhU9g/ELW9 sOs62M212DbVMhVU3CvyQ0S+e08g7incyjaOSZ+UFoa8HjZbxqrdKR+OPq2VL7jz6KJ3 H6ZLAGYuosWk7TwaPRjpjVeJGV7jnU5d8HQ8Ueot3/cqHERZrtjIFn1s7ugPnHd6JA43 tZGKgZwRc0jDHWMl42VTvFJmv9LqPmp1BCTliDZYddSkeM1WmGYoEbR1jaAaw4HR2Z98 gOCVDuw4udIUoeSeBeogiFLVdVkWfZlZd8YSrVclKtDrje5jnKjgM/EHBLXZOTs8UTh/ 1/NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=m/JOkatS5SJEbAvSASoNdTTfn/FpR6ktaJ4l/qZSS+A=; b=iqQnx2KqZg7DAsLmy40GAQLSTJkcR4vp/6f3y4VCxio/ilbIwLCGlyJPK4zSgHpaJ5 8LTiC6Y6NcyA0DrNMmOza1PAQiCDel8Ll/KCKejyLIUDyYUgY0Uz4n+Hm9niYMssjeja +B3oK7aht4IF4c0S5SiBKw9z6RmCv2JMxb1U3OEI5Dchoa9EicW74PbwcfesuaY/ZJWU PfbItISUeZynU8wVEBp5fiiOZIAbQZ9eQZlJjAhylVRIvvgn4JYX7oKoFHXO6l5pDhI9 SvY2/zXpxIwTppEcXHJRkK54TCYSaH+OrYSHJJVwogNGKHPIPNMluP/TOMkpUn4M1n/O 8z4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si4606809ejr.97.2020.05.22.01.20.03; Fri, 22 May 2020 01:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbgEVIS1 (ORCPT + 99 others); Fri, 22 May 2020 04:18:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:55020 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgEVIS0 (ORCPT ); Fri, 22 May 2020 04:18:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BF3A7BE73; Fri, 22 May 2020 08:18:27 +0000 (UTC) Subject: Re: [PATCH] xen/events: avoid NULL pointer dereference in evtchn_from_irq() To: Boris Ostrovsky , =?UTF-8?Q?Marek_Marczykowski-G=c3=b3recki?= Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Stefano Stabellini , stable@vger.kernel.org References: <20200319071428.12115-1-jgross@suse.com> <30719c35-6de7-d400-7bb8-cff4570f8971@oracle.com> <20200521184602.GP98582@mail-itl> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <5839ff92-92e4-667a-8ed1-f5f9f3453299@suse.com> Date: Fri, 22 May 2020 10:18:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.05.20 23:57, Boris Ostrovsky wrote: > On 5/21/20 2:46 PM, Marek Marczykowski-Górecki wrote: >> On Thu, May 21, 2020 at 01:22:03PM -0400, Boris Ostrovsky wrote: >>> On 3/19/20 3:14 AM, Juergen Gross wrote: >>>> There have been reports of races in evtchn_from_irq() where the info >>>> pointer has been NULL. >>>> >>>> Avoid that case by testing info before dereferencing it. >>>> >>>> In order to avoid accessing a just freed info structure do the kfree() >>>> via kfree_rcu(). >>> >>> Looks like noone ever responded to this. >>> >>> >>> This change looks fine but is there a background on the problem? I >>> looked in the archives and didn't find the relevant discussion. >> Here is the original bug report: >> https://xen.markmail.org/thread/44apwkwzeme4uavo >> > > > Thanks. Do we know what the race is? Is it because an event is being > delivered from a dying guest who is in the process of tearing down event > channels? Missing synchronization between event channel (de-)allocation and handling. I have a patch sitting here, just didn't have the time to do some proper testing and sending it out. Juergen