Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4523749img; Tue, 26 Mar 2019 11:03:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOc9X1iBVwSbRbSKKdu+Hsmdomt1Hef0BNzdirTv2NZ8BQeyY6hJ8Ilc4iR5Z6wrt8r8Ok X-Received: by 2002:a63:c104:: with SMTP id w4mr2957496pgf.409.1553623432045; Tue, 26 Mar 2019 11:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553623432; cv=none; d=google.com; s=arc-20160816; b=FGnsjQSBvfNLEP9+xqkqoXGpcWChv9B9tLY9Gj73Kxe9WCqZMHMHvnPxJSK1q4CR6F u03ypJBrQ/FGnTgXlPEBqf1j2+yd0RGIBPo6+ot7qD+BvYk1FzZIhHhBd09YlnCnJZys 4mff3eKZgX8JNWeaDUegTU7jt/1j8p1m05umOyR+s0HQ+XiQAnGFrazVxQt2T8s+T9qc 4JWKhejvsyRBro9mre4qTljY+GvgkWO+2hxTn9X5AwWswzAnw8E2K0APWef08P7c6V4U lCTZ/bCpdJkpWfu876WFJ0lh3Iwmn0KDe4gIuFKAIKiSkT/5mjvshH8pvImULR91iFmA tw/g== 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:from:references:cc:to:subject; bh=o8IoSkR/XThCEb9f/KwU0aUFDzmeWl4QAEah3khR/xc=; b=heoKPtwKNKZ1pDxPpZaRou9SsnwZJ/pDgBok9TgO6v47iWQei0cduPrWvFgKqRDDKv WzuVrBWcJ8W8hetvTCwCpDKZCLluPXm4mWPnRUs/n5UcErnncC1XZiarJzwIfGak6tDH 6K+jX7pVuFuNo4mesigo0nQqvDeahpHUdOCVl72c9MNASGtP6ZYRXXLKQ+ZrtXfCtPwq Tjerl8/osW9ST5CoVd1hdcal0p0hVfaZixvC0cRonIF5Jkxw2lEgQFKiGvJ8lRcTPIpM zPigR4Swfv7H3gVxOwKmMdV+lYvJjQZ/RksmRcPFMkA76Y5fb8rY02mdkI8CVRyzOPBP fcdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f89si18470059plb.20.2019.03.26.11.03.35; Tue, 26 Mar 2019 11:03:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732319AbfCZSBt (ORCPT + 99 others); Tue, 26 Mar 2019 14:01:49 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41730 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732069AbfCZSBs (ORCPT ); Tue, 26 Mar 2019 14:01:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 685501596; Tue, 26 Mar 2019 11:01:48 -0700 (PDT) Received: from [10.1.197.21] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC9713F614; Tue, 26 Mar 2019 11:01:45 -0700 (PDT) Subject: Re: [PATCH v7 7/10] KVM: arm/arm64: context-switch ptrauth registers To: Amit Daniel Kachhap , linux-arm-kernel@lists.infradead.org Cc: Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Jones , Dave Martin , Ramana Radhakrishnan , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Mark Rutland , James Morse , Julien Thierry References: <1552984243-7689-1-git-send-email-amit.kachhap@arm.com> <1552984243-7689-8-git-send-email-amit.kachhap@arm.com> <64505666-8a1f-cf64-7067-4b2dd53b0b40@arm.com> From: Kristina Martsenko Message-ID: <949327ae-081c-0964-3315-ac2695243b5f@arm.com> Date: Tue, 26 Mar 2019 18:01:44 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/03/2019 04:03, Amit Daniel Kachhap wrote: > Hi, > > On 3/26/19 1:34 AM, Kristina Martsenko wrote: >> On 19/03/2019 08:30, Amit Daniel Kachhap wrote: >>> From: Mark Rutland >>> >>> When pointer authentication is supported, a guest may wish to use it. >>> This patch adds the necessary KVM infrastructure for this to work, with >>> a semi-lazy context switch of the pointer auth state. >> >> [...] >> >>> +    if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || >>> +        test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) { >>> +        /* Verify that KVM startup matches the conditions for ptrauth */ >>> +        if (WARN_ON(!vcpu_has_ptrauth(vcpu))) >>> +            return -EINVAL; >>> +    } >> >> I think this now needs to have "goto out;" instead of "return -EINVAL;", >> since 5.1-rcX contains commit e761a927bc9a ("KVM: arm/arm64: Reset the >> VCPU without preemption and vcpu state loaded") which changed some of >> this code. > ok missed the changes for this commit. One more thing - I think the WARN_ON() here should be removed. Otherwise if panic_on_warn is set then userspace can panic the kernel. I think WARN_ON is only for internal kernel errors (see comment in include/asm-generic/bug.h). Thanks, Kristina