From: Heiko Carstens Subject: Re: [patch 10/12] [PATCH] kvm-s390: storage key interface Date: Thu, 15 Dec 2011 18:18:04 +0100 Message-ID: <20111215171804.GA3431@osiris.boeblingen.de.ibm.com> References: <20111214122347.275452567@de.ibm.com> <20111214123127.030416104@de.ibm.com> <4EE9CBB3.3000707@de.ibm.com> <20111215161106.GA2742@osiris.boeblingen.de.ibm.com> <4EEA250F.9030703@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Carsten Otte , 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: Christian Borntraeger Return-path: Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:44849 "EHLO e06smtp14.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759032Ab1LORSJ (ORCPT ); Thu, 15 Dec 2011 12:18:09 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Dec 2011 17:18:08 -0000 Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBFHI5vP1925220 for ; Thu, 15 Dec 2011 17:18:05 GMT Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBFHHuLu012212 for ; Thu, 15 Dec 2011 10:17:57 -0700 Content-Disposition: inline In-Reply-To: <4EEA250F.9030703@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Dec 15, 2011 at 05:49:19PM +0100, Christian Borntraeger wrote: > On 15/12/11 17:11, Heiko Carstens wrote: > > Why again is this needed? Or put in other words: what prevents a guest to > > change the storage key contents via sske of a page that is mapped read-only > > into the guest address space? > > As far as I can see: nothing. Interestingly I could -in theory- do some nice > > stuff like: > > - map a file from a read-only filesystem (which doesn't have a writepage > > aops function) into guest address space > > - let the guest set the change bit in the storage key of a page that belongs > > to that file mapping via sske > > - watch the fun that happens when the host tries to write the page back > > Huh? > The guest itself can neither set the dirty bit of the real storage key nor > set the dirty bit the host change bit of the pgste via guest SSKE. The transition > 0->1 will only be done in the guest change bit of the pgste. (Otherwise > we would not have a separate guest/host view of change/referenced) Yeah, I had a major braino.. > This interface here is for userspace (to change the guest storage key on behalf > of the guest, e.g. for life guest relocation). Since we might have to touch the > real storage key and this is host code millicode will not protect us from doing > stupid things like it does for guest code, we better check before we touch the > real storage key. > > Or did I misread your question? No, you did not. However, I still think it's wrong to have an early exit if the vma is not writable. Since the guest can set the guest change bit, but it is is not possible with this interface, but I can see now that the purpose was to avoid an overindication of the change bit. oh well...