[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] xen/privcmd: fix error exit of privcmd_ioctl_dm_op()
- To: Juergen Gross <jgross@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 25 Aug 2022 12:22:37 +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=qRydoAkaKXOhDms5UqmA8zzHTIkqILjL7ZD8DZsJqW4=; b=DQqjg92XeytlI9RBA5fRp9glP6AjRCnNLteQYN4ZJsr1rarDwXqWg2mahsGyMFnFVoiBaiedh27N3kWBJXvJyjT3/65KZH4Bf5wfrYouTl/ArflPVJPXGzbNcLEWvW8Jrc2cv7I0OLcKnY1AR8CkPOO2IE94myi62jJNtjOEf0hZIwSYb8XUg5KZ2BUoqDSTIBMtAiQ/nl5v5TJQ1CgMk0wZo/QnTp7JHnGozc50DokWOlgHuYpxAT2501YkkroCBZGBag9CW3KL74l6b56iUROw4JRVya4tdpmMVGQmsm8xuKKnBHY+HGxuEHb/LEHCrmKWvy7hNILppIPRdomuTQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eeF3s78Ogze5P3J6XslqYE/mXjeELvZOOXHRiZ/wRROs4NH2HvJqA/gEL55IPiY6wbOURemtbeoW3gEsR/OfWYsLw9DCZz5otLqmk7BY3hTQB6fkLkKpCxYY7FpunqLFBqsf12motA00v/hv+QLkLfbCMaenhbmu4/IVPFaFlg/IqUD8KDsEx8UEc20RJ7K4AVogGoN3DsheHeNHyV3UU5ovC8pKwHun+3XfvEZHOJ/RjafLS7CTqSbIlsy7C2ZoUgbVd1mtjddDIc/xp1xS5gywiwDfUIlibTsO+VDSpdGsU3txmDk/d4f9dncM/eiWHoVA8VexVoJfsa1ZXNT1Lw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, stable@xxxxxxxxxxxxxxx, Rustam Subkhankulov <subkhankulov@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- Delivery-date: Thu, 25 Aug 2022 10:22:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 25.08.2022 12:13, Juergen Gross wrote:
> On 25.08.22 11:50, Jan Beulich wrote:
>> On 25.08.2022 11:26, Juergen Gross wrote:
>>> --- a/drivers/xen/privcmd.c
>>> +++ b/drivers/xen/privcmd.c
>>> @@ -602,6 +602,10 @@ static int lock_pages(
>>> *pinned += page_count;
>>> nr_pages -= page_count;
>>> pages += page_count;
>>> +
>>> + /* Exact reason isn't known, EFAULT is one possibility. */
>>> + if (page_count < requested)
>>> + return -EFAULT;
>>> }
>>
>> I don't really know the inner workings of pin_user_pages_fast()
>> nor what future plans there are with it. To be as independent of
>> its behavior as possible, how about bailing here only when
>> page_count actually is zero (i.e. no forward progress)?
>
> This would require to rework the loop in lock_pages() to be able to
> handle only a partial buffer.
Oh, I see - I've misread the code as if the loop was capping each
iteration's count to the capacity of some internal buffer (as iirc
is being done elsewhere). So ...
> This would add some complexity, but OTOH I'd get an exact error code
> back in case of failure.
... perhaps not worth it then, ...
> I'll have a try and see how the result would look like.
... unless you think this might be relevant in certain cases.
Jan
|