lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <409e3dc7-b122-4979-8a24-b0f0fbc0855f@intel.com>
Date: Fri, 3 Oct 2025 08:28:43 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
 Wieczor-Retman" <maciej.wieczor-retman@...el.com>, Peter Newman
	<peternewman@...gle.com>, James Morse <james.morse@....com>, Babu Moger
	<babu.moger@....com>, Drew Fustini <dfustini@...libre.com>, Dave Martin
	<Dave.Martin@....com>, Chen Yu <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
	<patches@...ts.linux.dev>
Subject: Re: [PATCH v11 01/31] x86,fs/resctrl: Improve domain type checking

Hi Tony,

On 9/25/25 1:02 PM, Tony Luck wrote:
> Each resctrl resource has a list of domain structures. These all begin
> with a common rdt_domain_hdr.
> 
> Improve type checking of these headers by adding the resource id. Add
> domain_header_is_valid() before each call to container_of() to ensure
> the domain is the expected type.

Apart from the "short and sweet" part of the guidance [1] followed in the
changelog above the same guidance concluded with summary (in bold)
that the *why* of the patch should be clear. This changelog is missing
the "why".

Here is an attempt to address that, please feel free to rewrite and improve:
	Every resctrl resource has a list of domain structures. struct rdt_ctrl_domain
	and struct rdt_mon_domain both begin with struct rdt_domain_hdr
	with rdt_domain_hdr::type used in validity checks before accessing
	the domain of a particular type.                                                         
                                                                                
	Add the resource id to struct rdt_domain_hdr in preparation for a new
	monitoring domain structure that will be associated with a new monitoring
	resource. Improve existing domain validity checks with a new helper
	domain_header_is_valid() that checks both domain type and resource id.
	domain_header_is_valid() should be used before every call to container_of()
	that accesses a domain structure.                

[1] https://lore.kernel.org/all/20250923100956.GAaNJx9BYhXKkfNJ71@fat_crate.local/

> 
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---

Patch looks good to me.

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ