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] [thread-next>] [day] [month] [year] [list]
Message-ID: <e18fb171-726e-dc28-7a09-3c110bb97ff8@linux.ibm.com>
Date:   Tue, 12 Oct 2021 14:31:00 +0200
From:   Janosch Frank <frankja@...ux.ibm.com>
To:     Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc:     kvm@...r.kernel.org, cohuck@...hat.com, borntraeger@...ibm.com,
        thuth@...hat.com, pasic@...ux.ibm.com, david@...hat.com,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        Ulrich.Weigand@...ibm.com
Subject: Re: [PATCH v5 08/14] KVM: s390: pv: handle secure storage exceptions
 for normal guests

On 10/12/21 10:35, Claudio Imbrenda wrote:
> On Tue, 12 Oct 2021 10:16:26 +0200
> Janosch Frank <frankja@...ux.ibm.com> wrote:
> 
>> On 9/20/21 15:24, Claudio Imbrenda wrote:
>>> With upcoming patches, normal guests might touch secure pages.
>>>
>>> This patch extends the existing exception handler to convert the pages
>>> to non secure also when the exception is triggered by a normal guest.
>>>
>>> This can happen for example when a secure guest reboots; the first
>>> stage of a secure guest is non secure, and in general a secure guest
>>> can reboot into non-secure mode.
>>>
>>> If the secure memory of the previous boot has not been cleared up
>>> completely yet, a non-secure guest might touch secure memory, which
>>> will need to be handled properly.
>>>
>>> Signed-off-by: Claudio Imbrenda <imbrenda@...ux.ibm.com>
>>> ---
>>>    arch/s390/mm/fault.c | 10 +++++++++-
>>>    1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
>>> index eb68b4f36927..74784581f42d 100644
>>> --- a/arch/s390/mm/fault.c
>>> +++ b/arch/s390/mm/fault.c
>>> @@ -767,6 +767,7 @@ void do_secure_storage_access(struct pt_regs *regs)
>>>    	struct vm_area_struct *vma;
>>>    	struct mm_struct *mm;
>>>    	struct page *page;
>>> +	struct gmap *gmap;
>>>    	int rc;
>>>    
>>>    	/*
>>> @@ -796,6 +797,14 @@ void do_secure_storage_access(struct pt_regs *regs)
>>>    	}
>>>    
>>>    	switch (get_fault_type(regs)) {
>>> +	case GMAP_FAULT:
>>> +		gmap = (struct gmap *)S390_lowcore.gmap;
>>> +		addr = __gmap_translate(gmap, addr);
>>> +		if (IS_ERR_VALUE(addr)) {
>>> +			do_fault_error(regs, VM_ACCESS_FLAGS, VM_FAULT_BADMAP);
>>> +			break;
>>> +		}
>>> +		fallthrough;
>>
>> This would trigger an export and not a destroy, right?
> 
> correct. but this would only happen for leftover secure pages touched
> by non-secure guests, before the background thread could clean them up.

I.e. we don't expect to need the destroy speed boost?

> 
>>
>>>    	case USER_FAULT:
>>>    		mm = current->mm;
>>>    		mmap_read_lock(mm);
>>> @@ -824,7 +833,6 @@ void do_secure_storage_access(struct pt_regs *regs)
>>>    		if (rc)
>>>    			BUG();
>>>    		break;
>>> -	case GMAP_FAULT:
>>>    	default:
>>>    		do_fault_error(regs, VM_READ | VM_WRITE, VM_FAULT_BADMAP);
>>>    		WARN_ON_ONCE(1);
>>>    
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ