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

Re: [PATCH 2/3] xen/common: llc-coloring: Fix off-by-one in parse_color_config()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 9 Apr 2026 13:34:10 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=suse.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kJxmIbH/V5ihvYVlfBvtw2jG2B22mOAIxpJuH2Ozr3A=; b=xaUvSV7BN9t/hSsNu94sqaUzEv5z3d35mpTcu8yu6JqVD/hUXQE1IbMXfzSpV2BLuo39ob1/2YduykU4nn2CcNfrHyjBTxVdWumJR42WrrUzQji7JCthti4NxZK6BoKtOu1itj52b2yLe8tKfVWys8VAn1Q0Zi6gNXWHPP0RwCkQ97HM0HAiF6VhD+Xzv3hPO+Hdp2Bk+c3Ogv9exTjBhAczRD4qxVs7vDcRAR18QKHBNWPDujFTrTh2qXor9MDwTZOoeUyml+pfxBxWLscoVTuC00TfeoNPGrccVn+w+4CC1kTmUTzcY63R9pMGWlIvpcfNDn1MlZrioihhdCAZeQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kJxmIbH/V5ihvYVlfBvtw2jG2B22mOAIxpJuH2Ozr3A=; b=UxRXpsp+/kSZw65le+lekwzUx8U78wImsNkxGiRKrMm1YFYJXgggrFjgl8wcIa2J5/LCyyiqiM7eChZsA/pfmt50sJid3z8vSg8v8royEkIqHKENECzosRBfnl1EokG4n+J+OZz888tgtU3GsolvY/UaETk2suErMi4N51R4T9inzIRgvjLs8IKlh2JKdyxwreYn4zFg1D21WsJruNaIkgWaTm9sHCq8YWCFD+BFfjsYhKgyzagJ0/QuS2fl7+TliBj15G4/2VOSMigAQbeLfWJHhsRGO9CjZmz0fqyhByYrJlSViWvI9nAtAL9UQCzn8dTXuLn0EDkUqO+xRaDbQw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=eqSdQRW3FEYMCkcKXecsqWiqsBdbMmrh7ItJn98Ni90ClIhateJysjCr6MKcX1fKnbDBtHc5xVVwhrBJaIZkS+FtXD0M9sJwLMUFGXzadlBRbXXFgbggzzO74glNnp1Z+NGHurOP0wEtxAaY7Ra3YE2wYzVvL+igmrOkLTADyS169piKKLYZn9aqJcfxDt5TClv33fqffwxNVmz33IfN5dNLccirvxnkHMHt6VBEXDfhseZYbmwbCxoDIyEDu6CIm47jZQDuvNyizPppgX5bTYaj6jb8YQeGvkGk2udRKrH6PQdKjFJjKucyMyfBmF3CSzsB/M9YX4IElW6OD2eIug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cji2P5R/aCruvdtJzmPeOLmtSsnbtv52FOo/0pwwnmyq7DJraUtWng8dfeZi1x1hZs0XrDbIG0f2RFosHdK/F3xM4Zb/TcUdlLjFjIEhDvOXgmP+qa5I+9pcinqxLCx8QHwF9qw2wzz5SY2nlv1GoXV1apTIkLheYLtR/rZL4GF/9i66VV5NxFAwtpMux6OtfLyJTWSPyRGEBs1Iq7rtE06uPz5GXJ2DvQV+lq1zthVqD5WjwyOi5BnehlyHPexaBLOpBVd8Llqxoe+zFRt+NZ9xHZ3ClHWQeoykoy5D/hGjRfmpDQ+w5C3NtVhJBnGHwk2MQx1vcpXPuCLOpB/jxQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 13:35:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcyBWdW2bjkWPifku6XWocvaXOWrXWpuWAgAAHZ4CAAADggIAAC5wA
  • Thread-topic: [PATCH 2/3] xen/common: llc-coloring: Fix off-by-one in parse_color_config()

Hi Jan,

> On 9 Apr 2026, at 13:52, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
> 
> 
> 
>> On 9 Apr 2026, at 13:48, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> 
>> On 09.04.2026 14:22, Luca Fancellu wrote:
>>>> On 9 Apr 2026, at 12:39, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>>>> 
>>>> The check uses >= to compare the total number of colors against
>>>> max_num_colors (which is ARRAY_SIZE of the colors array).  This
>>>> incorrectly rejects input that would exactly fill the array.
>>>> 
>>>> For example, with NR_LLC_COLORS=16, specifying 1 color for Xen and 15
>>>> for dom0 would fail.
>>>> 
>>>> Change >= to > so that exactly filling the array is permitted.
>>>> 
>>>> Fixes: 95ef5ddf8a ("xen/arm: add Dom0 cache coloring support")
>>>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>>>> ---
>>> 
>>> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>> 
>> Did you see Andrew's reply? If that earlier (recent) commit was wrong, I
>> think a 2nd Fixes: tag may be needed here. For now I can't help the
>> impression though that there might have been a re-basing mistake, where
>> that re-base may have wanted to result in this patch dissolving into
>> nothing. Yet of course I'm all ears to learn otherwise.
>> 
>> Jan
> 
> Oh, no I didn’t see that! Thanks for pointing that out, I will have a closer 
> look.


I had a closer look, I feel that the patch is ok and commit 
cba8a584de171c8c4510709c2edc9f1cf86b21ab
was missing this corner case.

Let’s say max_num_colors = 8 (array capacity), *num_colors = 4 so we stored 
already 4 entries and the
next parsed range gives start = 4, end = 7: 

(*num_colors + (end - start + 1)) >= max_num_colors will compute as
(4 + (7 - 4 + 1)) >= 8 which will be
8 >= 8 that will be true and the input will be rejected, instead of being a 
valid entry.

Did I miss anything?

Cheers,
Luca


 


Rackspace

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