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]
Message-ID: <f98925f4-70f4-156b-0204-a50b2457de34@linux.ibm.com>
Date:   Thu, 19 Aug 2021 16:11:50 +0200
From:   Janosch Frank <frankja@...ux.ibm.com>
To:     Janis Schoetterl-Glausch <scgl@...ux.vnet.ibm.com>,
        David Hildenbrand <david@...hat.com>,
        Janis Schoetterl-Glausch <scgl@...ux.ibm.com>,
        kvm@...r.kernel.org, borntraeger@...ibm.com,
        imbrenda@...ux.ibm.com, Heiko Carstens <hca@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>
Cc:     cohuck@...hat.com, linux-s390@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] KVM: s390: gaccess: Cleanup access to guest frames

On 8/19/21 3:53 PM, Janis Schoetterl-Glausch wrote:
> On 8/18/21 10:06 AM, Janosch Frank wrote:
>> On 8/18/21 9:54 AM, David Hildenbrand wrote:
>>> On 16.08.21 17:07, Janis Schoetterl-Glausch wrote:
>>>> Introduce a helper function for guest frame access.
>>>> Rewrite the calculation of the gpa and the length of the segment
>>>> to be more readable.
>>>>
>>>> Signed-off-by: Janis Schoetterl-Glausch <scgl@...ux.ibm.com>
>> [...]
>>>> -	unsigned long _len, gpa;
>>>> +	unsigned long gpa;
>>>> +	unsigned int seg;
>>>>   	int rc = 0;
>>>>   
>>>>   	while (len && !rc) {
>>>>   		gpa = kvm_s390_real_to_abs(vcpu, gra);
>>>> -		_len = min(PAGE_SIZE - (gpa & ~PAGE_MASK), len);
>>>> -		if (mode)
>>>> -			rc = write_guest_abs(vcpu, gpa, data, _len);
>>>> -		else
>>>> -			rc = read_guest_abs(vcpu, gpa, data, _len);
>>>> -		len -= _len;
>>>> -		gra += _len;
>>>> -		data += _len;
>>>> +		seg = min(PAGE_SIZE - offset_in_page(gpa), len);
>>>
>>> What does "seg" mean? I certainly know when "len" means -- which is also 
>>> what the function eats.
>>
>> What does "_len" mean especially in contrast to "len"?
>>
>> "seg" is used in the common kvm guest access functions so it's at least
>> consistent although I share the sentiment that it's not a great name for
>> the length we access inside the page.
>>
>> Originally I suggested "len_in_page" if you have a better name I'd
>> expect we'll both be happy to discuss it :-)
> 
> fragment_len ? 

Sounds good to me

>>
>>>
>>>> +		rc = access_guest_frame(vcpu->kvm, mode, gpa, data, seg);
>>>> +		len -= seg;
>>>> +		gra += seg;
>>>> +		data += seg;
>>>>   	}
>>>>   	return rc;
>>>>   }
>>>>
>>>
>>>
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ