Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp979182iob; Fri, 13 May 2022 18:24:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpuStWTIon46qYrj8sW1jO3fVBYTvraPFmIK1fnxqKnVSA0jGzcKWG5yCt9gxJgxRujFhE X-Received: by 2002:a7b:c017:0:b0:394:5631:62bc with SMTP id c23-20020a7bc017000000b00394563162bcmr17575749wmb.190.1652491481723; Fri, 13 May 2022 18:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652491481; cv=none; d=google.com; s=arc-20160816; b=I8vMUu9i4h4/h5jOTMXD52RpHzZpE8bXaEG8p2Qx0z6I3eh2vP11WGtGczjpX4boOf MXKBgh4Z0s93nvs+PUuo5nmzbQYXtozR1UjLLp8T1EstTzbeBMcKSWwWCyaqxwDkIT6e k66/iqz/zhHdkkFZF1vWvWUiFT+grBLRSHRsiFNKNLWLYAsZGv0mA/Jp1UV6I6jkpkpC nY08lQsRHSItvc3lRud75bkI2xkdZjliNsPwxwk8V00TyiAyopzJkIh5XARbvmJvGSk/ RjOjYbUVcRk6ZZDkJIYvW51sDAODnDnIByZbBs+OLoveHg6VnjKpmBKSGjg3DIc0MJj9 JYfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=pKT3YUr9qUs5uIKesgT4K81uwyX4AaWN4Ut0eYxyI8g=; b=T8W9jq/6JSuMxRBMIWnKCHNmRVrW0oLKOBQizMGK6UjbidF42DNsJfxFwEv4SZPCNl 1ojj4eewwaPtf85s3+drc6f/Fcbl3wULQ7wTdpQ5YPRIdnXeuGCFhw3TfhhSNuuDuim8 3FxlETCM1/1cLqGBqSjbU7cg9e06WxkxSXpEb5daQNDqJ0QnLI8ZHlrZbFnAecZkjsjx /RDb3ROUk3uMlkipK9sqJ22i1VHtZlliwd5Tplnl5fZe/6iOEg0CJE1hj6LFkZSfoJfx L6BANlGS3+fM367yVPCgK28QY25CQVgzlkNLafP6nrXGkYM7128QIJ87WHNMxO+kHEj+ 4bjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RCo2zMXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o13-20020a5d648d000000b0020cf3e68b38si3316468wri.272.2022.05.13.18.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RCo2zMXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF2B93D786A; Fri, 13 May 2022 16:53:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356114AbiELPu7 (ORCPT + 99 others); Thu, 12 May 2022 11:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345425AbiELPu4 (ORCPT ); Thu, 12 May 2022 11:50:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 41DE7515A2 for ; Thu, 12 May 2022 08:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652370654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pKT3YUr9qUs5uIKesgT4K81uwyX4AaWN4Ut0eYxyI8g=; b=RCo2zMXITe136qThmUio30+rxlhQBbyOXY8N7zxLW1vDDW8Tf+2AfY+HxbIbaN2WTGfW7r rwGq2ZmgraKc/sqkay8oFc9hu9csP29kxPBEBizO8cR7IDTvBIBOQBESnBVdb2Ew6oFMmP CHooTxUB1ejkvIFNA41GFR0nQTQp8LM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-UK6gYOdKM3aHld1IDjAV_Q-1; Thu, 12 May 2022 11:50:53 -0400 X-MC-Unique: UK6gYOdKM3aHld1IDjAV_Q-1 Received: by mail-wr1-f70.google.com with SMTP id o18-20020adfcf12000000b0020cdc76ea11so2203034wrj.3 for ; Thu, 12 May 2022 08:50:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=pKT3YUr9qUs5uIKesgT4K81uwyX4AaWN4Ut0eYxyI8g=; b=7iS5Cs2iDgBFOiYj/JHvzogbCg6hb6tRxnQJr78R3ctSJ1V/CS+FWYQGBgEw2Dq9hT RzS+9ogX+//Cjr/O0qdFOs0IW3+XjtjZcOdF/kBKvI9ycDIkf6KLkZlPeqoPMXvzhZw8 Z3LJO5p2TSeVZnOC683c8Adz8gvSpUAp+w/4mC5QJZOm+xPZyWGsPd8MQP12X5JqNP1G /6UOCNNTEAJfIIBkarQ56/upGhFN5G+caY9pqG//HSs19g6iIIz6MMcjhEr5moOFwYT9 CdpuEMFnnhOQ8iycUJq17nB/egJJ92nRXAzPOtQjO1hRtu7qkJh5wlxTlWsHcAjvX7V8 ZwKw== X-Gm-Message-State: AOAM530eI/m0s2hyDeYIW6vBvuh47Xvzy6d7HDn0Ezyq/bq9eiiDl6jl 6W/QYI5LxekZees2QtS8ziR55ApUSkGyNwRRU0z+ZbWOR/1q2SrBaY6BsUpHp/b3RYGER2oc0xi l1YqWpw0apzIjNU81gRuH6nTZ X-Received: by 2002:a05:600c:a06:b0:394:8d3d:de68 with SMTP id z6-20020a05600c0a0600b003948d3dde68mr11078932wmp.18.1652370652076; Thu, 12 May 2022 08:50:52 -0700 (PDT) X-Received: by 2002:a05:600c:a06:b0:394:8d3d:de68 with SMTP id z6-20020a05600c0a0600b003948d3dde68mr11078905wmp.18.1652370651822; Thu, 12 May 2022 08:50:51 -0700 (PDT) Received: from ?IPV6:2003:cb:c701:d200:ee5d:1275:f171:136d? (p200300cbc701d200ee5d1275f171136d.dip0.t-ipconnect.de. [2003:cb:c701:d200:ee5d:1275:f171:136d]) by smtp.gmail.com with ESMTPSA id d13-20020a5d4f8d000000b0020c5253d911sm4326778wru.93.2022.05.12.08.50.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 May 2022 08:50:51 -0700 (PDT) Message-ID: <701033df-49c5-987e-b316-40835ad83d16@redhat.com> Date: Thu, 12 May 2022 17:50:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v3 1/2] KVM: s390: Don't indicate suppression on dirtying, failing memop Content-Language: en-US To: Christian Borntraeger , Janis Schoetterl-Glausch , Paolo Bonzini , Jonathan Corbet , Janosch Frank , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Sven Schnelle , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org References: <20220512131019.2594948-1-scgl@linux.ibm.com> <20220512131019.2594948-2-scgl@linux.ibm.com> <77f6f5e7-5945-c478-0e41-affed62252eb@redhat.com> <4a06e3e8-4453-9204-eb66-d435860c5714@linux.ibm.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <4a06e3e8-4453-9204-eb66-d435860c5714@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.05.22 15:51, Christian Borntraeger wrote: > > > Am 12.05.22 um 15:22 schrieb David Hildenbrand: >> On 12.05.22 15:10, Janis Schoetterl-Glausch wrote: >>> If user space uses a memop to emulate an instruction and that >>> memop fails, the execution of the instruction ends. >>> Instruction execution can end in different ways, one of which is >>> suppression, which requires that the instruction execute like a no-op. >>> A writing memop that spans multiple pages and fails due to key >>> protection may have modified guest memory, as a result, the likely >>> correct ending is termination. Therefore, do not indicate a >>> suppressing instruction ending in this case. >> >> I think that is possibly problematic handling. >> >> In TCG we stumbled in similar issues in the past for MVC when crossing >> page boundaries. Failing after modifying the first page already >> seriously broke some user space, because the guest would retry the >> instruction after fixing up the fault reason on the second page: if >> source and destination operands overlap, you'll be in trouble because >> the input parameters already changed. >> >> For this reason, in TCG we make sure that all accesses are valid before >> starting modifications. >> >> See target/s390x/tcg/mem_helper.c:do_helper_mvc with access_prepare() >> and friends as an example. >> >> Now, I don't know how to tackle that for KVM, I just wanted to raise >> awareness that injecting an interrupt after modifying page content is >> possible dodgy and dangerous. > > this is really special and only for key protection crossing pages. > Its been done since the 70ies in that way on z/VM. The architecture > is and was always written in a way to allow termination for this > case for hypervisors. Just so I understand correctly: all instructions that a hypervisor with hardware virtualization is supposed to emulate are "written in a way to allow termination", correct? That makes things a lot easier. -- Thanks, David / dhildenb