Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp887577ybl; Wed, 21 Aug 2019 07:04:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYKf8E3gmpHOKuXnvSUj6XngLeHtHt2UezbLazzqL7lnA6lkjXd1/0M/vBmzdY4caT/uum X-Received: by 2002:aa7:8b11:: with SMTP id f17mr35861639pfd.19.1566396267867; Wed, 21 Aug 2019 07:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566396267; cv=none; d=google.com; s=arc-20160816; b=nyKyu+//4/guOthqaNlUjLSx77iVNeDfCM2X+ITM/+qMxEr+F3nFHdOMH+R0ZYOcWx vaGDpX75WL50oST8KC8lL/5AF+lXVRhTVLbMGoSdC+0EBLOFUUUm6aMzW84BgFTdzgX+ ApF7T+vP4+d2dx7r8XvuxsEJRdHMO11O2p3Ix+PTDFX4n/qdiNHwMFigVakYegdDaj1w V/hEdquNTVHTJAKl+/McjxsAOmwyCWQLtVVVI5W9vfQpsGvMc1Dy2HYCPUA/9Kl3TN7S KqJuqUhKXxJWuSjEJEufmo5zdbq+BEezf1gye31lbvvh0fvE/+EIgUxpdKu1abBuqGxN m98A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=veD3dUOoZCwbHqx+ndRsuJnz561ImAVKLcbP7AW1QAI=; b=lmNxjD/UCqr8J+E5HED7tH7j5Uu5YTSY9/c6o6p3g503Rb78tDCWWKEqqSY9sgUYnM Pseee3wCP9Y7Lr5a8d3XHYi8SyCKpuW0lMJTdTCDk8XYU0JrHJkaORx2bSlm1rL4dYC3 YAA8pl62CIRz3dpYfi+TD/0b6Mo7cr2b2t12ffmRMVntfUPZWtore5Xc3nKrPUlfCHp9 Tt8cLFjeREotQOY0QSi23RDcB7kUOFNapah/ZhC8dV2rTTvVs4/pvHy+mwG/oORQWg08 VeJRl5iFODVGXbpEa3uyT8pDrRlmUosSrykoXSXtPMUG43U9CbWaCH1g9oQa6F8SdFY9 K1Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si25228pjq.109.2019.08.21.07.04.09; Wed, 21 Aug 2019 07:04:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbfHUOC6 (ORCPT + 99 others); Wed, 21 Aug 2019 10:02:58 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:55800 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726484AbfHUOC5 (ORCPT ); Wed, 21 Aug 2019 10:02:57 -0400 Received: from p5de0b6c5.dip0.t-ipconnect.de ([93.224.182.197] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1i0RCQ-0005xS-UK; Wed, 21 Aug 2019 16:02:55 +0200 Date: Wed, 21 Aug 2019 16:02:54 +0200 (CEST) From: Thomas Gleixner To: Julien Grall cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org, bigeasy@linutronix.de, rostedt@goodmis.org Subject: Re: [RT PATCH 3/3] hrtimer: Prevent using uninitialized spin_lock in hrtimer_grab_expiry_lock() In-Reply-To: <20190821092409.13225-4-julien.grall@arm.com> Message-ID: References: <20190821092409.13225-1-julien.grall@arm.com> <20190821092409.13225-4-julien.grall@arm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Aug 2019, Julien Grall wrote: > migration_base is used as a placeholder when an hrtimer is switching > between base (see switch_hrtimer_timer_base). It is possible > theoritically possible to have timer->base equal to migration_base. > > Even if it is a placeholder, it would pass all the current check in > hrtimer_grab_expiry_lock() leading to use softirq_expiry_lock > uninitialized. > > This is can be prevented by checking whether the base is equal to > the placeholder (i.e. migration_base). That's a lame argument. The point is that it does not make sense to do that on migration base, but not for the reason you are giving (uninitialized lock). If base == migration_base then there is no point to lock soft_expiry_lock simply because the timer is not executing the callback in soft irq context and the whole lock/unlock dance can be avoided. But, yes. Good catch. Thanks, tglx