[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/vPIC: check values loaded from state save record


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 25 Oct 2023 13:51:05 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=82Lhg9odyrMlZFTzxre2T8Uvu12G9p9xI52b9P7f340=; b=CzLQZkBCqizOlvAgWuCoqrC5DbkXhq/rLdEztKRTV7ArhwJwwKBjVx9sX3as1S87iiblGV3IXL2Jq5jjUc8m6UXujI4wkO/GARX+Co15K4G0Lgi29I2owBZEcFrgj9qvfVlBVSCQrUWY/ms5D6nSNPL9C4cvTOKXdSGd+x1iLDsTqcNRhAlzhhMtq9uZAvLp1iYZyM+bgyr2WizNsFme3ZBpSxk/N1NFWH12sLgV77Jpb+9cOfB3qvHJeeMaSjAa7oYvgqyxYmcnjTZJWKEsR3a/NACfn3ROtNjIcKZ8bo21jRFq5ekNjr68MBUKPSA9y/8UXBAOZVOHxuT85TegvA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CotFTkRmF92uCXQvhvMuK1lXuvNnnRnTKWgmVuvHZuu5/Cx1En84VkaC69VivJjd3nueYXRvfZB5GzdLhPT8Snrddh1davTTQdAhDElusfcSi36GVgnR1ZypBzy4jXtX+QVfyLXiLSnJXFTmNzwCOy45x6jGOFSeBE8n32yYD7J7N5HuB6h7tVv+CIxhrPrPj8eGbnkH2r6XsW8n2xv8vlb2yuXBSvVxr1jv272tM+FScSjzHdIFEH1LDK1D2D3UVagZUQapJaL4nme7JEjImVw+DKL+UjECKOJzxtl/0ZWj4PiEN6t+usXKNgKa3RsH/v1vYXwn0XSv/Ckt4f59ng==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 25 Oct 2023 11:51:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.10.2023 12:12, Roger Pau Monné wrote:
> On Thu, May 11, 2023 at 01:50:33PM +0200, Jan Beulich wrote:
>> Loading is_master from the state save record can lead to out-of-bounds
>> accesses via at least the two container_of() uses by vpic_domain() and
>> __vpic_lock(). Calculate the field from the supplied instance number
>> instead. Adjust the public header comment accordingly.
>>
>> For ELCR follow what vpic_intercept_elcr_io()'s write path and
>> vpic_reset() do.
>>
>> Convert ->int_output (which for whatever reason isn't a 1-bit bitfield)
>> to boolean, also taking ->init_state into account.
>>
>> While there also correct vpic_domain() itself, to use its parameter in
>> both places.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> Of course an alternative would be to simply reject state save records
>> with bogus values.
> 
> Likewise on the vPIC one, I feel it might be better to just reject
> such bogus entries, instead of attempting to amend them.

Perhaps we should discuss which route to take on the next x86 meeting?
Then also Andrew would have a chance to voice concerns; not sure if
he's following the thread.

> This one however just unconditionally reset some values, but might be
> simpler to just test if is_master == !inst and if it's master than bit
> 2 in s->elcr is set?

vpic_elcr_mask() also wants applying (or a respective check carrying
out). Plus int_output can't be left alone, I thunk.

> Also if we are serious about doing some sanity checks in the loaded
> records, we could introduce a checker function for the load machinery.

If we were to check rather than override, then yes, perhaps running
through all check functions first would be desirable.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.