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] [day] [month] [year] [list]
Date:   Thu, 25 Aug 2022 13:14:20 +0200
From:   Juergen Gross <jgross@...e.com>
To:     Jan Beulich <jbeulich@...e.com>
Cc:     Stefano Stabellini <sstabellini@...nel.org>,
        Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
        stable@...r.kernel.org,
        Rustam Subkhankulov <subkhankulov@...ras.ru>,
        xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] xen/privcmd: fix error exit of privcmd_ioctl_dm_op()

On 25.08.22 12:22, Jan Beulich wrote:
> 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.

Not sure, but the resulting code is looking fine IMO.


Juergen

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists