[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v2] libxc/x86: avoid overflow in CPUID APIC ID adjustments
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Jan Beulich <JBeulich@xxxxxxxx>
- Date: Wed, 25 Sep 2019 05:56:40 +0000
- Accept-language: en-US
- 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-SenderADCheck; bh=wodzHuPBNB1ZWZ7YwIqvmi4jF5y38krjQD22ra20jCM=; b=XwUBNj39HSmRvpRiLFLVXfXFyja7DFEaB1z9jx+OgSL8Y72M4UfxoCPuzjpw9NOZIQhzf6CslNn3LxAkmu7mMqchhsu4PBZ0EP7rZ0Xp0RaB3SRBbRmB5Am9Wvo6cLJr9IHYn0FR6fMQ+hQFwXCAoGvUkqtczsyQ/APYe+vhXC8vYoMETyJJsRaWsqxfyesT5hIFHhWr5KytB1zyFsvQ88ewjwN1D67q9z1+gpJkeVVAB8ukOOnkBbXZrjwju+IybPtvgaDvRvDbryb91daCqWCiqYz+hSz/RNXae1KUAfX6u/4onhCZ5W+sHvWjD6wgFJBd6FWXY049JRt8QNxqEQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=klN0VIx4HQh6VERIs9dV4/LDvc8zj9m6wxBj8/28SNnA3mI5XsWn4qrLK4o4MGq0WGvV1h7VL2BRQMetgAKdwDeFvIHoWEk3Jvw9DwryJPlvoBoanO2SrgbIj5EeIItpG0pUFkXB2vJsCtS+DGy4J/byFaNTsGc7HnHi4INm3Z/LmTkTxhbLWbentNbkrt8H3dID9JMH7H6XZPchBIWOeThHBVOvkp1TGHy638cpDrFUQ0kSUYaLTw7W2ixENsmMGFzhMoPq1CWWa4OU8DTSuzqaUnVO+/FOlPl9jSh+dPyQv7KQvRlxXbiKB03FgwksvzhIw7uBUifN/UzDT8nd3A==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
- Cc: Juergen Gross <JGross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Wed, 25 Sep 2019 05:58:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVb7rdga0Iv13OHE+wW09XJH/8hqc7JCNCgADIXQA=
- Thread-topic: [PATCH v2] libxc/x86: avoid overflow in CPUID APIC ID adjustments
On 24.09.2019 19:58, Andrew Cooper wrote:
> On 20/09/2019 14:54, Jan Beulich wrote:
>> @@ -395,11 +395,20 @@ static void amd_xc_cpuid_policy(const st
>>
>> case 0x80000008:
>> /*
>> - * ECX[15:12] is ApicIdCoreSize: ECX[7:0] is NumberOfCores (minus
>> one).
>> - * Update to reflect vLAPIC_ID = vCPU_ID * 2.
>> + * ECX[15:12] is ApicIdCoreSize.
>> + * ECX[7:0] is NumberOfCores (minus one).
>> + * Update to reflect vLAPIC_ID = vCPU_ID * 2. But make sure to
>> avoid
>> + * - overflow,
>> + * - going out of sync with leaf 1 EBX[23:16],
>> + * - incrementing ApicIdCoreSize when it's zero (which changes the
>> + * meaning of bits 7:0).
>> */
>> - regs[2] = ((regs[2] + (1u << 12)) & 0xf000u) |
>> - ((regs[2] & 0xffu) << 1) | 1u;
>> + if ( (regs[2] & 0x7fu) < 0x7fu )
>
> In attempting to rebase my series, there is a bug here. It should be &
> 0xff otherwise the top bit isn't included in the comparison, and a value
> of 128 will still be doubled.
Oh, indeed, thanks for spotting. Will send a fixup patch once in the
office, unless you did so already.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|