Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4121887ybb; Tue, 7 Apr 2020 00:54:26 -0700 (PDT) X-Google-Smtp-Source: APiQypKd+ZUqmQT+U2f4nwIfb28ECR9ZySRb6WU+LSl7NfUcaTiiIwg448C7n6zg5DcNkuzJmYPU X-Received: by 2002:aca:abcd:: with SMTP id u196mr747546oie.86.1586246066870; Tue, 07 Apr 2020 00:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586246066; cv=none; d=google.com; s=arc-20160816; b=VL0KXR4tlq/RO6+CGYd/bXiItgdZa9JpKEWPnZaU8swCCUdf2C2CS2nZmmFb3clGIT TBDVv8qeSIl9kwvqz8SBd3C9r1T/vYiHqC/XOkoP7tueRTOdZTzbOxRz48z5qIkJAc23 FZp1x/AMf1JdZ7gdx1MjJ8sO+CzPHylaRYcWr6upG3EFzTx3BYS6h2n6K47nT6GFInTG NBuUnOdWjFOtlZjGyNMbBF3KroT1hZ9K1ukwvx5iC+SaEm8lg+zcpTUc3J2lgGdO+uzs zKf6kalmEPiCy3P0YcWTzAnBP4LnLpjV3DXDCmKJDmDUmWMN3NIfP34ZJoSuq3vxT2F5 FKpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:from:references:cc:to:subject :dkim-signature; bh=nIYsIZPXiHieV9Dh0ocKF/YL3RcRtDNlRgZocgRWKGc=; b=b5pKLHePsBkVfqOwXMsJsae5LaBDzkOTnp1yZTjiWFnztnx8qGgLCKN+SbcOk2W2cE XDJfU4h1YpJ+RR1OIDJ0V523YK3taqlMfJ5Oh6E+UtczjYnqJJlaxO/1/o8RE6xTpBr2 HKGliHQ087MeRMMSDEvDru+SmbMINekq7uJDJUida04HYd9ocTqnKg8vFy86sK7vz7HG cb7jeBBpIl41E+G5/rz+PB8t5tjvigvHCEFxruvSLWmExDd2P2d3PrM09Utn2dvD4je1 SZZCfSZxmBIZ+BvZNJGNgzvD+UyoE+/AE85iCxO9oPlr9qtNPgJo1XhPYWvTHo5c4V/L SbxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aNhzIICP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k66si860211oif.29.2020.04.07.00.54.15; Tue, 07 Apr 2020 00:54:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aNhzIICP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbgDGHxj (ORCPT + 99 others); Tue, 7 Apr 2020 03:53:39 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37242 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726635AbgDGHxi (ORCPT ); Tue, 7 Apr 2020 03:53:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586246018; 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:autocrypt:autocrypt; bh=nIYsIZPXiHieV9Dh0ocKF/YL3RcRtDNlRgZocgRWKGc=; b=aNhzIICPSpQ8+gsG+bDzSIX5XMGTd+t4QM2m/ax9PP7yZXR02lIy7ceEFzUTy3dLWd/arA E2G+VRSPPRuy8EaeLScr7yGwBUfzZCJLHzFdopFb+bL9+s3iTo9j05+d/g27RfQ0O5KmjA MoZHcj+XPQlRJyljsdppr9rYtavQLQ0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-d4VzF3mbOziE2DJlC2U40w-1; Tue, 07 Apr 2020 03:53:36 -0400 X-MC-Unique: d4VzF3mbOziE2DJlC2U40w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B872C8017F6; Tue, 7 Apr 2020 07:53:34 +0000 (UTC) Received: from [10.36.114.167] (ovpn-114-167.ams2.redhat.com [10.36.114.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2F7919C6A; Tue, 7 Apr 2020 07:53:32 +0000 (UTC) Subject: Re: [PATCH v2 1/5] KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks To: Christian Borntraeger , kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Vasily Gorbik , Heiko Carstens , Cornelia Huck , Janosch Frank , stable@vger.kernel.org References: <20200403153050.20569-1-david@redhat.com> <20200403153050.20569-2-david@redhat.com> <3431ccbb-25b2-66fc-5e07-3f449c03b087@de.ibm.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; prefer-encrypt=mutual; keydata= mQINBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy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ECAA8FAlXLn5ECGwwFCQlmAYAACgkQTd4Q 9wD/g1qA6w/+M+ggFv+JdVsz5+ZIc6MSyGUozASX+bmIuPeIecc9UsFRatc91LuJCKMkD9Uv GOcWSeFpLrSGRQ1Z7EMzFVU//qVs6uzhsNk0RYMyS0B6oloW3FpyQ+zOVylFWQCzoyyf227y GW8HnXunJSC+4PtlL2AY4yZjAVAPLK2l6mhgClVXTQ/S7cBoTQKP+jvVJOoYkpnFxWE9pn4t H5QIFk7Ip8TKr5k3fXVWk4lnUi9MTF/5L/mWqdyIO1s7cjharQCstfWCzWrVeVctpVoDfJWp 4LwTuQ5yEM2KcPeElLg5fR7WB2zH97oI6/Ko2DlovmfQqXh9xWozQt0iGy5tWzh6I0JrlcxJ ileZWLccC4XKD1037Hy2FLAjzfoWgwBLA6ULu0exOOdIa58H4PsXtkFPrUF980EEibUp0zFz GotRVekFAceUaRvAj7dh76cToeZkfsjAvBVb4COXuhgX6N4pofgNkW2AtgYu1nUsPAo+NftU CxrhjHtLn4QEBpkbErnXQyMjHpIatlYGutVMS91XTQXYydCh5crMPs7hYVsvnmGHIaB9ZMfB njnuI31KBiLUks+paRkHQlFcgS2N3gkRBzH7xSZ+t7Re3jvXdXEzKBbQ+dC3lpJB0wPnyMcX FOTT3aZT7IgePkt5iC/BKBk3hqKteTnJFeVIT7EC+a6YUFg= Organization: Red Hat GmbH Message-ID: Date: Tue, 7 Apr 2020 09:53:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <3431ccbb-25b2-66fc-5e07-3f449c03b087@de.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.04.20 09:52, Christian Borntraeger wrote: > > > On 07.04.20 09:49, David Hildenbrand wrote: >> On 07.04.20 09:33, Christian Borntraeger wrote: >>> >>> On 03.04.20 17:30, David Hildenbrand wrote: >>>> In case we have a region 1 ASCE, our shadow/g3 address can have any value. >>>> Unfortunately, (-1UL << 64) is undefined and triggers sometimes, >>>> rejecting valid shadow addresses when trying to walk our shadow table >>>> hierarchy. >>>> >>>> The result is that the prefix cannot get mapped and will loop basically >>>> forever trying to map it (-EAGAIN loop). >>>> >>>> After all, the broken check is only a sanity check, our table shadowing >>>> code in kvm_s390_shadow_tables() already checks these conditions, injecting >>>> proper translation exceptions. Turn it into a WARN_ON_ONCE(). >>> >>> After some testing I now triggered this warning: >>> >>> [ 541.633114] ------------[ cut here ]------------ >>> [ 541.633128] WARNING: CPU: 38 PID: 2812 at arch/s390/mm/gmap.c:799 gmap_shadow_pgt_lookup+0x98/0x1a0 >>> [ 541.633129] Modules linked in: vhost_net vhost macvtap macvlan tap kvm xt_CHECKSUM xt_MASQUERADE nf_nat_tftp nf_conntrack_tftp xt_CT tun bridge stp llc xt_tcpudp ip6t_REJECT nf_reject_ipv6 ip6t_rpfilter ipt_REJECT nf_reject_ipv4 xt_conntrack ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nfnetlink ip6table_filter ip6_tables iptable_filter rpcrdma sunrpc rdma_ucm rdma_cm iw_cm ib_cm configfs mlx5_ib s390_trng ghash_s390 prng aes_s390 ib_uverbs des_s390 ib_core libdes sha3_512_s390 genwqe_card sha3_256_s390 vfio_ccw crc_itu_t vfio_mdev sha512_s390 mdev vfio_iommu_type1 sha1_s390 vfio eadm_sch zcrypt_cex4 sch_fq_codel ip_tables x_tables mlx5_core sha256_s390 sha_common pkey zcrypt rng_core autofs4 >>> [ 541.633164] CPU: 38 PID: 2812 Comm: CPU 0/KVM Not tainted 5.6.0+ #354 >>> [ 541.633166] Hardware name: IBM 3906 M04 704 (LPAR) >>> [ 541.633167] Krnl PSW : 0704d00180000000 00000014e05dc454 (gmap_shadow_pgt_lookup+0x9c/0x1a0) >>> [ 541.633169] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 RI:0 EA:3 >>> [ 541.633171] Krnl GPRS: 0000000000000000 0000001f00000000 0000001f487b8000 ffffffff80000000 >>> [ 541.633172] ffffffffffffffff 000003e003defa18 000003e003defa1c 000003e003defa18 >>> [ 541.633173] fffffffffffff000 000003e003defa18 000003e003defa28 0000001f70e06300 >>> [ 541.633174] 0000001f43484000 00000000043ed200 000003e003def978 000003e003def920 >>> [ 541.633203] Krnl Code: 00000014e05dc448: b9800038 ngr %r3,%r8 >>> 00000014e05dc44c: a7840014 brc 8,00000014e05dc474 >>> #00000014e05dc450: af000000 mc 0,0 >>> >00000014e05dc454: a728fff5 lhi %r2,-11 >>> 00000014e05dc458: a7180000 lhi %r1,0 >>> 00000014e05dc45c: b2fa0070 niai 7,0 >>> 00000014e05dc460: 4010b04a sth %r1,74(%r11) >>> 00000014e05dc464: b9140022 lgfr %r2,%r2 >>> [ 541.633215] Call Trace: >>> [ 541.633218] [<00000014e05dc454>] gmap_shadow_pgt_lookup+0x9c/0x1a0 >>> [ 541.633257] [<000003ff804c57d6>] kvm_s390_shadow_fault+0x66/0x1e8 [kvm] >>> [ 541.633265] [<000003ff804c72dc>] vsie_run+0x43c/0x710 [kvm] >>> [ 541.633273] [<000003ff804c85ca>] kvm_s390_handle_vsie+0x632/0x750 [kvm] >>> [ 541.633281] [<000003ff804c123c>] kvm_s390_handle_b2+0x84/0x4e0 [kvm] >>> [ 541.633289] [<000003ff804b46b2>] kvm_handle_sie_intercept+0x172/0xcb8 [kvm] >>> [ 541.633297] [<000003ff804b18a8>] __vcpu_run+0x658/0xc90 [kvm] >>> [ 541.633305] [<000003ff804b2920>] kvm_arch_vcpu_ioctl_run+0x248/0x858 [kvm] >>> [ 541.633313] [<000003ff8049d454>] kvm_vcpu_ioctl+0x284/0x7b0 [kvm] >>> [ 541.633316] [<00000014e087d5ae>] ksys_ioctl+0xae/0xe8 >>> [ 541.633318] [<00000014e087d652>] __s390x_sys_ioctl+0x2a/0x38 >>> [ 541.633323] [<00000014e0ff02a2>] system_call+0x2a6/0x2c8 >>> [ 541.633323] Last Breaking-Event-Address: >>> [ 541.633334] [<000003ff804983e0>] kvm_running_vcpu+0x3ea9ee997d8/0x3ea9ee99950 [kvm] >>> [ 541.633335] ---[ end trace f69b6021855ea189 ]--- >>> >>> >>> Unfortunately no dump at that point in time. >>> I have other tests which are clearly fixed by this patch, so we should propbably go forward anyway. >>> Question is, is this just another bug we need to fix or is the assumption that somebody else checked >>> all conditions so we can warn false? >> >> Yeah, I think it is via >> >> kvm_s390_shadow_fault()->gmap_shadow_pgt_lookup()->gmap_table_walk() >> >> where we just peek if there is already something shadowed. If not, we go >> via the full kvm_s390_shadow_tables() path. >> >> So we could either do sanity checks in gmap_shadow_pgt_lookup(), or >> rather drop the WARN_ON_ONCE. I think the latter makes sense, now that >> we understood the problem. > > Ok, so I will drop the WARN_ON_ONCE and fixup the commit message. > Perfect, thanks! -- Thanks, David / dhildenb