From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Schwidefsky Subject: Re: [patch 10/12] [PATCH] kvm-s390: storage key interface Date: Thu, 15 Dec 2011 18:14:28 +0100 Message-ID: <20111215181428.0dca3f01@de.ibm.com> References: <20111214122347.275452567@de.ibm.com> <20111214123127.030416104@de.ibm.com> <4EE9CBB3.3000707@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tossati , borntrae@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com, mschwid2@linux.vnet.ibm.com, huckc@linux.vnet.ibm.com, KVM , Joachim von Buttlar , Jens Freimann , agraf@suse.de To: Carsten Otte Return-path: Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:56114 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759032Ab1LOROo (ORCPT ); Thu, 15 Dec 2011 12:14:44 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Dec 2011 17:14:37 -0000 Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBFHEVA22416756 for ; Thu, 15 Dec 2011 17:14:31 GMT Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBFHEUro019665 for ; Thu, 15 Dec 2011 10:14:30 -0700 In-Reply-To: <4EE9CBB3.3000707@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 15 Dec 2011 11:28:03 +0100 Carsten Otte wrote: > + case KVM_S390_KEYOP_SSKE: > + if (!(vma->vm_flags & (VM_WRITE | VM_MAYWRITE))) { > + r = -EACCES; > + break; > + } Unfortunately I just realized while discussing with Heiko that a check for VM_WRITE is not enough. We could still have a read-only pte that points to a file backed page which is purely read-only. A write access is allowed but would cause copy-on-write. But we set the storage key of the original page which would make the read-only page dirty. We need to solved the race on the dirty bit in a clean way, otherwise there always will be a corner case. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.