Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 30B05EB64DC for ; Mon, 17 Jul 2023 14:17:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.564614.882153 (Exim 4.92) (envelope-from ) id 1qLP2i-0003AC-Sp; Mon, 17 Jul 2023 14:17:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 564614.882153; Mon, 17 Jul 2023 14:17:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qLP2i-0003A5-Q0; Mon, 17 Jul 2023 14:17:40 +0000 Received: by outflank-mailman (input) for mailman id 564614; Mon, 17 Jul 2023 14:17:39 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qLP2h-00039z-0g for xen-devel@lists.xenproject.org; Mon, 17 Jul 2023 14:17:39 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ae18138f-24ac-11ee-8611-37d641c3527e; Mon, 17 Jul 2023 16:17:37 +0200 (CEST) Received: from [192.168.1.100] (unknown [37.163.206.54]) by support.bugseng.com (Postfix) with ESMTPSA id 1661B4EE0737; Mon, 17 Jul 2023 16:17:31 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ae18138f-24ac-11ee-8611-37d641c3527e Message-ID: Date: Mon, 17 Jul 2023 16:17:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC PATCH 2/4] xen/arm64: bitops: justify uninitialized variable inside a macro Content-Language: en-US To: Jan Beulich Cc: Xen-devel , Stefano Stabellini , "michal.orzel@amd.com" , "xenia.ragiadakou@amd.com" , "ayan.kumar.halder@amd.com" , "consulting@bugseng.com" , Andrew Cooper , George Dunlap , Wei Liu , Bertrand Marquis , Volodymyr Babchuk , Luca Fancellu , Julien Grall References: <299D0BAE-D15E-4260-AF3E-8D84CF058083@arm.com> <528fb310-f469-e449-d1c3-269fa7dec750@xen.org> <2bc64be1-10c0-d064-a5a2-1f076b596e6e@bugseng.com> From: Nicola Vetrini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 17/07/23 16:06, Jan Beulich wrote: > On 17.07.2023 14:16, Nicola Vetrini wrote: >> On 16/07/23 18:50, Julien Grall wrote: >>> On 16/07/2023 10:20, Luca Fancellu wrote: >>>>> On 14 Jul 2023, at 14:05, Julien Grall wrote: >>>>> On 14/07/2023 12:49, Nicola Vetrini wrote: >>>>>> The macro 'testop' expands to a function that declares the local >>>>>> variable 'oldbit', which is written before being set, but is such a >>>>>> way that is not amenable to automatic checking. >>>>> >>>>> The code is pretty straightforward. So I am not entirely sure why >>>>> Eclair is not happy. Is it because the value is set by assembly code? >> >> Exactly. The reason why I didn't just state that oldbit is always >> written or never read before being written in that function is that I >> was unsure about the meaning of the assembly. > > So I'm pretty sure the tool wouldn't take apart the string literal passed > first to the asm(). Instead I expect it goes from the operands specified, > which for oldbit is "=&r". There's nothing conditional here, so if the > tool didn't trust that outputs are written, it would need to flag such an > issue on about any asm() having outputs. > > I hope the issue isn't that the tool doesn't properly deal with the > do/while. > > In any event: I may misremember earlier discussions, but isn't this a > pretty obvious false positive? In which case didn't we mean to flag > those as such (because really an improved checking tool could avoid them)? > > Jan > Actually, given that the function indeed always writes oldbit in the asm instruction, I can state that this post-condition holds for the function. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)