Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44E41C433E1 for ; Tue, 18 Aug 2020 08:36:52 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F1542067C for ; Tue, 18 Aug 2020 08:36:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Wbsio8Hy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F1542067C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k7x6m-0001qs-Ok; Tue, 18 Aug 2020 08:36:40 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k7x6k-0001qi-Pw for xen-devel@lists.xenproject.org; Tue, 18 Aug 2020 08:36:38 +0000 X-Inumbo-ID: b00ef5b5-4fde-4437-8123-d13ed935007a Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b00ef5b5-4fde-4437-8123-d13ed935007a; Tue, 18 Aug 2020 08:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1597739797; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=02irrjygnVlE9mzK5xqI+Am879Afo4diMX05U7Q1tR8=; b=Wbsio8Hy7A9CrZd3gGBui3Pwtxrcn+2YHiarV0ppQvzuBEfp/6PX/iyO S4qDWRx6/VdO4AK9MehGX/yvDxNaxz28V1LRFtQpYh/F6KJC35E4dZjGP ROvp3/2kOaAvGoon1qLR75wrJRNacEs2bGYgMtmSe6EUW0oZZwM4SEfLT o=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: SNAk1/gmMEVLxcqnLwNTWkAQjAu2086RryKL1HcF/zko64L1O8UD5k7KrBeGgfAr0iDGjyoYfq ZUgORpOtqgDT7DctkLE3K+kjzAhbbgSpPwZ3bu/xTWtI6PtImwcgooNd3zZJ6o4u4ePlpj4DE+ unAcs/aYJfLRFmkBqkGXQojGXodjeNzp3lMIQPZxXhGg9lKqJvXu4ya87xdG4mJ8UKSC47S3sd Lz/LSkTtIqKtLJxCHaQCQJiCwHuspclyIHUuMMEm0KW6aIE9xXDdL2+FnFLlk+0l7gEsudQgCr XuI= X-SBRS: 2.7 X-MesageID: 25063952 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.76,326,1592884800"; d="scan'208";a="25063952" Date: Tue, 18 Aug 2020 10:36:29 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Julien Grall CC: , Julien Grall , "Jan Beulich" , Andrew Cooper , "Wei Liu" Subject: Re: [PATCH] xen/x86: irq: Avoid a TOCTOU race in pirq_spin_lock_irq_desc() Message-ID: <20200818083629.GI828@Air-de-Roger> References: <20200722165300.22655-1-julien@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200722165300.22655-1-julien@xen.org> X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Wed, Jul 22, 2020 at 05:53:00PM +0100, Julien Grall wrote: > From: Julien Grall > > Even if we assigned pirq->arch.irq to a variable, a compile is still > allowed to read pirq->arch.irq multiple time. This means that the value > checked may be different from the value used to get the desc. > > Force the compiler to only do one read access by using read_atomic(). > > Signed-off-by: Julien Grall Reviewed-by: Roger Pau Monné The whole discussion about renaming {write/read}_atomic is orthogonal to this patch IMO. Thanks, Roger.