Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1067047rwr; Wed, 26 Apr 2023 09:41:31 -0700 (PDT) X-Google-Smtp-Source: AKy350Z59b4b9jXi2CXyLeBZOqhp9s8i0rF78V7H10ogx5uhlIhmeLGHNgUHTPAXlaDDWuXoqeE8 X-Received: by 2002:a05:6a20:a104:b0:f2:7dd:2753 with SMTP id q4-20020a056a20a10400b000f207dd2753mr32728134pzk.33.1682527290898; Wed, 26 Apr 2023 09:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682527290; cv=none; d=google.com; s=arc-20160816; b=WbFoZX33cQsGNh+jQeyFie7OVJzlBh5HuQaqjnV5e+SCWdMOo9GEgxe5o0PanUYnry a6YKxDBwMaDAl744CqjleH/58C4pHXPPa4okrnF9t/M3UNgv7qI98oWliMIdesZ4ACCQ ixTApOUDDqPz8DTHyv0wLsqoUnX6diW1LnJylQbVl6RVG0n3k46z1DPrekJx68ns2UU5 s6ymdY+F5uQZewlLd4oYiaG448dkbQyxLRGG57/0rGRxjhXXI0j0HfmNi7O8Wt2lVBrM 8W9smss3D81mTxScluiORYxbbgoAHObVmJHnL4CO8VmS00+aXRMvtEy0siBlDYprywXS 8wnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=HCy1R5MnFh5/przdIOjVbXj0o/kcMiTwBlBpNSBNctU=; b=GMB2bi20epXDvqPyQXP34MQib36lf30zZdPMnx8l5XyzdoOm/UNWSKBXvcYNzpS364 2bJBMU1E7dEEjncPLOL+ZUj76Zvae5laum5TnxoDof4ihChMqRf/PIDhutNn2YIsDaKi fNoRIWZxMteYYE9Y5kmwMjjUoOVlfnWgZIfV0S5LgpDR8Pem5DmHqLtpzREArPA6avfO nFOVkJKO7aa/6hf4yV7aTcu9ZQE3i3xhNP81B0SGzUkPmbh9oiYewzmaxEZnD9kBRh3Q PEi1utzzfU/FnCQr7beserFGkFOufdslEBSPu6QP198hyAWFTaMldmdOTPLgnXAb6q/h S5UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=DQdlf1mG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 187-20020a6306c4000000b0050be7b93e73si18090877pgg.694.2023.04.26.09.41.18; Wed, 26 Apr 2023 09:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=DQdlf1mG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjDZQbc (ORCPT + 99 others); Wed, 26 Apr 2023 12:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232123AbjDZQbb (ORCPT ); Wed, 26 Apr 2023 12:31:31 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45A6D7A9D for ; Wed, 26 Apr 2023 09:31:30 -0700 (PDT) Received: from skinsburskii.localdomain (c-67-170-100-148.hsd1.wa.comcast.net [67.170.100.148]) by linux.microsoft.com (Postfix) with ESMTPSA id 37EB521C2B3E; Wed, 26 Apr 2023 09:31:29 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 37EB521C2B3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682526689; bh=HCy1R5MnFh5/przdIOjVbXj0o/kcMiTwBlBpNSBNctU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DQdlf1mGc1Ah3oR3oaQPf7GXYkyWuhtf7WCx3yBb19Q098yf2bVGhD28Edrz/D7SJ ZZwCuUg2/yxqsZ+wzVz9+I4BLZs5uLa7mcaAi7uNjxs42qnXKPEUbQ7nCRMuLUWZ4T kPe9q67Lsrwx3zT8hpZ4u5AD1rU6U4Hf2mVWSYX8= Date: Fri, 14 Apr 2023 20:23:39 -0700 From: Stanislav Kinsburskii To: Arnd Bergmann Cc: Stanislav Kinsburskii , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Geert Uytterhoeven , Chris Down , Helge Deller , Omar Sandoval , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86: asm/io.h: Harden virt_to_phys/isa_virt_to_bus prototypes Message-ID: <20230415032339.GA8240@skinsburskii.localdomain> References: <168146523405.6279.3632248068235163346.stgit@skinsburskii.localdomain> <7d0389aa-4fc0-499b-8f2e-5a96102efa24@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7d0389aa-4fc0-499b-8f2e-5a96102efa24@app.fastmail.com> X-Spam-Status: No, score=-16.4 required=5.0 tests=BAYES_00,DATE_IN_PAST_96_XX, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 22, 2023 at 11:02:33AM +0200, Arnd Bergmann wrote: > On Fri, Apr 14, 2023, at 11:40, Stanislav Kinsburskii wrote: > > From: Stanislav Kinsburskii > > > > These two helper functions - virt_to_phys and isa_virt_to_bus - don't need the > > address pointer to be mutable. > > > > In the same time expecting it to be mutable leads to the following build > > warning for constant pointers: > > > > warning: passing argument 1 of ‘virt_to_phys’ discards ‘const’ > > qualifier from pointer target type > > > > The change looks fine, and this is clearly useful for spreading > more 'const' annotations, but I have two concerns: > > - I'd really like this to be done consistently across architectures, > so at least the asm-generic/io.h version should get the same > annotation, or ideally all of them in one patch. > Sure, let me come up with the a series to cover other architectures. > - I would not describe this change itself as "hardening", as it > also does the opposite, when you have a pointer that is actually > "const" but converting it through virt_to_phys() and back > through phys_to_virt() ends up losing the annotation. > Indeen, I didn't think about this way. Let me then just state what the change does (i.e. "Make virt_to_phys to allow unmutable pointers"), unless you have a better option to advice. Thanks, Stanislav > Arnd