Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1867652rwi; Thu, 3 Nov 2022 09:56:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/B5Ob0EIaWkwlVxHIA/ZTohZFPuv/fOQyvUchBpr1K5viDOEpsvpZKnUVZLPfGyEWZALH X-Received: by 2002:a17:907:1c88:b0:7ad:8f76:699e with SMTP id nb8-20020a1709071c8800b007ad8f76699emr29665902ejc.114.1667494590505; Thu, 03 Nov 2022 09:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667494590; cv=none; d=google.com; s=arc-20160816; b=sR3tNNZeJlG6YtoEFoVP4xjw5bvD9m7S3rneh+pMJcxFpXMBCIOOT17QI7b/vXEjGU 70OqaBRGrSLJJTfc0RqEulnKOjg2K8rfuGq+Im07vAI2mmImIbqe+ci+dmhZ73EB8EZ+ nR4pd3FYuezUKwfyqdyEqdaju0U8O4zlWueorkIuKiW49DaWKmfnfbJKkSSFpoa3l2fq Kcfn4YIZI4cZBR4IYTR2kme3O6R9UzfbDxJoNwMGtK5jMJKtqbPTiODSTSJplVc9OfY5 tq2/tQVvdr+dMzm14tVZG73BUswjpNG6rtm7OR9AlM0tHKtQqDA71eXXpSj27wCVDNfi 2Wog== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2ASRoXT4dNz3rsz3g7wk4DQzgAno9/V5MAy7ltfZSS0=; b=C6amJBIOWarV0NVMCkiWRbdBcFkmaXTi62Lc9ioAVoJ1xp9vpm+bm204JF78HQqMec dDC/VBqvY1xkM5eCW28M7Y+ws5nZvlH3IdtAta/h/ILWAd/xUTbcJhqizs4Xp2Zjku3Y ZSckugiKdNsLeTVpHs9SxGALcLXucbmwfmfvyQD13/QvaKOBtKAJcu2s5vaqn2bQ2ZKI M2b6TSPlPaopSP73WIQmCrVCqoD24zEfZFM5ZdHQTRtmZPYXZyG8IjR51QUbfsWxobXH Clrbr3uV5IiBhELqe0J1H/34giExl8acf4pIUwnM8vNnwJTZzBJH2i/rmNuUJy+jSmHG P1lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=GEBGVYys; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb3-20020a1709071c8300b007adcf865405si1849707ejc.601.2022.11.03.09.56.06; Thu, 03 Nov 2022 09:56: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=@alien8.de header.s=dkim header.b=GEBGVYys; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231160AbiKCQuJ (ORCPT + 97 others); Thu, 3 Nov 2022 12:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231991AbiKCQtv (ORCPT ); Thu, 3 Nov 2022 12:49:51 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF3832739; Thu, 3 Nov 2022 09:49:11 -0700 (PDT) Received: from zn.tnic (p200300ea9733e7e7329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e7e7:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E3F291EC04F0; Thu, 3 Nov 2022 17:49:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1667494150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=2ASRoXT4dNz3rsz3g7wk4DQzgAno9/V5MAy7ltfZSS0=; b=GEBGVYysxzMU6LGJTmZd7M+/R/6mbCD6zp4ZSzgggbaUSAV0SVqDm2Gc6AAhFjue3w91tt IAhvE9D7fZ+NRgIf5TsYL8evNAQClXdM104Vgktn6WclPvN36r3al1OF9AVLqkFvz+Oj+i 92QAmiYx47vWftNfKrMeen4/XGStEic= Date: Thu, 3 Nov 2022 17:49:06 +0100 From: Borislav Petkov To: yury.norov@gmail.com Cc: x86@kernel.org, linux-riscv , Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar , Dave Hansen , Palmer Dabbelt , Paul Walmsley , Albert Ou , Jonas Bonn , Stefan Kristiansson , Stafford Horne , openrisc@lists.librecores.org, Michael Ellerman , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , linux-s390@vger.kernel.org Subject: Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning Message-ID: References: <20221031080604.6xei6c4e3ckhsvmy@kamzik> <20221031100327.r7tswmpszvs5ot5n@kamzik> <20221103125945.lrr5oxxmylwpam53@kamzik> <20221103153404.uh77nrdkowrxj6cr@kamzik> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Thu, Nov 03, 2022 at 09:30:54AM -0700, yury.norov@gmail.com wrote:a > Callers should pass sane arguments into internal functions if they > expect sane output. What internal function? It's in a global header. > The API not exported to userspace shouldn't sanity-check all inputs > arguments. That doesn't have anything to do with userspace at all. APIs exported to the rest of the kernel should very well check their inputs. Otherwise they're not APIs - just some random functions which are visible to the compiler. > So, the portable code shouldn't expect from cpumasks more than > documentation said: for a _valid_ offset cpumask_next() returns next > set bit or >= nr_cpu_ids. Lemme quote from my previous mail: "First make sure cpumask_next()'s valid accepted range has been settled upon, has been explicitly documented" So where is that valid range documented? > cpumask_check() has been broken for years. Attempting to fix it faced > so much resistance, that I had to revert the patch. The suggestion on that thread made sense: you first fix the callers and then the interface. Just like any other "broken" kernel API. Nothing's stopping you from fixing it properly - it'll just take a while and if it is such a widely used interface, you probably should come up with a strategy first how to fix it without impacting current use. Interfaces and their in-kernel users get refactored constantly. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette