From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10976132111; Sun, 3 Nov 2024 20:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730664127; cv=none; b=m9XNN9uIeH3wFF2SiWDPB8FqaR6EiyGIqvFI0Pe3/Xls/q4JygNzAb7VZ8o3I9OUqL3cl8NdHLAs/iiRlGvlzhqNhHTsHu9lmxxYVrSDuHH79xt4QOU8POr6Su8Gd0ceC0iai7fZK+Aaa9pfbBFwdNrSYGZQ/qOhulVp/07M8U0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730664127; c=relaxed/simple; bh=YCxOz70oKZPnlhnu6GEg/6POCPYTvT8YTEVBtqasbrs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o2Bg7vtIv3wNmrwlfZQn6AmE3naVeo3xfSKcSkw6JCbrVOubDiiPaYh8H7EedOOgWqXDa+NO4JH0/MdXcp84aQZIrhYCdFnrePida98lSHCjtrhYGIsy+U7H0cglZXAb1LzFtptjOja8ylnK5w9rWEubRxyP4665rR0NH3hOLIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20c77459558so29336925ad.0; 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=uGNrOMQ4dm9xp8MXpGlSUQamVoEooXFN7G02PbfeGG2k4/JbwrSyAFG8llLYW/AI70 12VJtLI5rMsoG8nyJflvflK7fM7xUd+IhiNDCx1vWpQFHiOvVojtWjiTzhbVQIbr3AWb /Lbr1OqE7xH7Ou9oXZWY2RoD8IjHaG2Y/te2CaQJMiHgWNfiRYLsKuodcH/vY/ylzOzb V39lYxBIGpgdLKmgzpe8e/eV7Baojb9kHegdJ1dF+VRHtE6eCkPT/hqbOhKz424DLVyz fhdrNqSuL9aQZF/Ii5+hZXAY5LQV9gfrp/BcaItT3htOiE7GVeSqgR6kMNaorc1Wm5ie qpzA== X-Forwarded-Encrypted: i=1; AJvYcCULdh4JZgZuh5035UOKN9OZ1MsmCSRrkUJPlLZL+uwgJDOowoC0pX+5IgQICRt7nLdPKCQoZNnKh13y@vger.kernel.org, AJvYcCUswTde0e/egC+9qrxz96rx1ILEABTB9jPtZWALCmObFrpwrP5iN8RyGegAXVACyePm252JZ0C5+ox0@vger.kernel.org, AJvYcCV8Vqg8InVLhSJnbZYFrhQSQMNDOGBQlCvSxshUWrXwsXZ5CFvoJ3G7pSDOcUPHad0gQjiIAE63Del5eksI@vger.kernel.org, AJvYcCVKRu7AneUDlA57t+H71T3KBzAe0pIrAd4CnuyDskr4LPPBetSS10OfdCd84YNQzYUP5SgWO7ZAAs5G@vger.kernel.org, AJvYcCVSL46z1oNyvyLgmMkzkBKy9Jt5G2HWGTDFeddLZwFrhW1c6EQd35OxbS8zTcDhwVG12TgMBguAYT0Tjwp5@vger.kernel.org, AJvYcCVe3yYfQ8GevQ1ThBqjH2I55xKIJc6V5X1YvUV+gtza5yUnM5qghUFba0tEXNrM6ekSkC6JZe7eLnCS5w==@vger.kernel.org, AJvYcCVgMYcQkTUPKdZchDiTeIQEgQ8dM+g3I8v96shUb7ndXm3DrPQS8hvRSVbIGidWiI8WWPxgJW8AAZYzlw==@vger.kernel.org, AJvYcCWh9kT9Qzxpe/fk7wWsF2SGPZxK33nc6dhdXOGK8Odg/Tdp3untVhYPQPL2Xf8sz7H3Al0CS4vyT77asqwBCVzDCtVNOA==@vger.kernel.org, AJvYcCXE39eYUIQOgiUJVRiIjT1dywG5i46BCaHSck4Cn06pRT/XaGk2IJ9f2yp7lwY72/fGJlxbqxNXzcD/kg==@vger.kernel.org X-Gm-Message-State: AOJu0YxXURua6melP2zZ3r6eag/I7r5Lu6F9TuaiZjk5/zMRig8YJIeC T9CiGGBfuQL8sJuAxC1rupDVdDFg8KNje1WbXWBwt14ZAMx8f0V1 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> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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> 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