From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 56583E6F07E for ; Mon, 4 Nov 2024 09:05:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C2D5810E3AA; Mon, 4 Nov 2024 09:05:03 +0000 (UTC) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id E307610E0AA; Sun, 3 Nov 2024 20:02:05 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20cdbe608b3so34483735ad.1; Sun, 03 Nov 2024 12:02:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730664125; x=1731268925; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VjfQvqCHHfDeXG4GMQuNHaE4bkPmkI1XqjnN8lstP2Q=; b=B9ksgQUWMm4edPb2eWP6UTUv+MzvLGDVmUC3e8+x6/2O0PaExYdslBKyp2XfAyLDwK d2tPQv1UX5lcoDIFkidplm6HegmiK4sWmWjxGiZq5N2UzqofKQDiUBQWHzEMu0d13QuC tBEAW8zrf+/Garr8IAgE4kW2pRqGATzRohQ+JFR3iCnbB+bnv02TFC87M5fCs+I0+PjI Swx+iYdaBEh06JBGLULHkp+NwcubvvEPk40yOecsjBumkRtq9YzUDvD3Txd0T+NpjzhS kjmKsvBZksbyTFlkkidKhJJRrxrH3Krq8FxWklLDaqVbZiAbKmvxZazWADI8St38TXxQ 2cFA== X-Forwarded-Encrypted: i=1; AJvYcCWyBAoB8U3GdDAVPzw9ejiBsgEdqbwunAjftlAleHuQuN7n1NivlAsBOPTBs9wcx/YC0GCGFuo7@lists.freedesktop.org, AJvYcCXqLhaR3s/2h/fBh1wfOBcgjzYbbIeiCmWs5BtU5GjxAZUpOtFo4c2Ip1tswX1TgEeoUxP4d4tZce6O@lists.freedesktop.org X-Gm-Message-State: AOJu0YyNUAqSSNb/F+IPxzIVzGiBfZwSBpp+bngzeShQobURFajlMWJC EBWKRTPEW/g1XO3YajkGQjUDFMzoZBxKtm5d9LtxXuCKvI2r2nxD X-Google-Smtp-Source: AGHT+IHAS+v1ffLBb+GI+ZNM4/mlV92TQI2AYHoaDbWsFSd1zPZgooqCqKQWbVDQVnW3KjMuxbyzsA== X-Received: by 2002:a17:902:ce91:b0:20b:6624:70b2 with SMTP id d9443c01a7336-210f75154e9mr256357005ad.19.1730664125219; Sun, 03 Nov 2024 12:02:05 -0800 (PST) Received: from localhost (fpd11144dd.ap.nuro.jp. [209.17.68.221]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21105707059sm49877745ad.81.2024.11.03.12.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 12:02:04 -0800 (PST) Date: Mon, 4 Nov 2024 05:02:03 +0900 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Srinivas Kandagatla , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , Xinhui Pan , David Airlie , Simona Vetter , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Naveen Krishna Chatradhi , Carlos Bilbao , Hans de Goede , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , "David E. Box" , "James E.J. Bottomley" , "Martin K. Petersen" , Richard Henderson , Matt Turner , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Logan Gunthorpe , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Dan Williams , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-mtd@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org Subject: Re: [PATCH v2 00/10] sysfs: constify struct bin_attribute (Part 1) Message-ID: <20241103200203.GA183945@rocinante> References: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> X-Mailman-Approved-At: Mon, 04 Nov 2024 09:05:01 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" Hello, > struct bin_attribute contains a bunch of pointer members, which when > overwritten by accident or malice can lead to system instability and > security problems. > Moving the definitions of struct bin_attribute to read-only memory > makes these modifications impossible. > The same change has been performed for many other structures in the > past. (struct class, struct ctl_table...) > > For the structure definitions throughout the core to be moved to > read-only memory the following steps are necessary. > > 1) Change all callbacks invoked from the sysfs core to only pass const > pointers > 2) Adapt the sysfs core to only work in terms of const pointers > 3) Adapt the sysfs core APIs to allow const pointers > 4) Change all structure definitions through the core to const > > This series provides the foundation for step 1) above. > It converts some callbacks in a single step to const and provides a > foundation for those callbacks where a single step is not possible. > > Patches 1-5 change the bin_attribute callbacks of 'struct > attribute_group'. The remaining ones touch 'struct bin_attribute' itself. > > The techniques employed by this series can later be reused for the > same change for other sysfs attributes. > > This series is intended to be merged through the driver core tree. This is very nice. Thank you! For PCI changes: Acked-by: Krzysztof WilczyƄski This reminded me of an old discussions with Greg and Bjorn about how to set size correctly for our ROM and BAR sysfs objects. Nice to see a very nice approach here, indeed. Krzysztof