From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D0BCC43381 for ; Wed, 27 Mar 2019 18:56:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7821C205C9 for ; Wed, 27 Mar 2019 18:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390362AbfC0S4S (ORCPT ); Wed, 27 Mar 2019 14:56:18 -0400 Received: from foss.arm.com ([217.140.101.70]:59632 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390046AbfC0SQ0 (ORCPT ); Wed, 27 Mar 2019 14:16:26 -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 49C52A78; Wed, 27 Mar 2019 11:16:26 -0700 (PDT) Received: from [10.1.196.105] (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5A253F557; Wed, 27 Mar 2019 11:16:23 -0700 (PDT) Subject: Re: [PATCH v7 7/10] KVM: arm/arm64: context-switch ptrauth registers To: Amit Daniel Kachhap , Kristina Martsenko Cc: linux-arm-kernel@lists.infradead.org, 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 , 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> <949327ae-081c-0964-3315-ac2695243b5f@arm.com> <536f518d-5425-cb94-3f64-4c56e5cd65c1@arm.com> From: James Morse Message-ID: <13ab02cf-db27-d604-6e5f-d276dec0779b@arm.com> Date: Wed, 27 Mar 2019 18:16:22 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <536f518d-5425-cb94-3f64-4c56e5cd65c1@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amit, Kristina, On 27/03/2019 03:21, Amit Daniel Kachhap wrote: > On 3/26/19 11:31 PM, Kristina Martsenko wrote: >> On 26/03/2019 04:03, Amit Daniel Kachhap wrote: >>> 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; >>>>> +    } >> 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). > > The documentation makes sense so in this case a pr_err like message will suffice. (could it be a kvm_debug() at most?) Do we need to print anything at all? User-space asked us for something we can't do. Filling up the kernel log with user-space's mistakes makes it harder to debug the kernel when something goes wrong. kvm_arm_pmu_v3_init() returns -ENODEV if you ask if for the PMU and the platform can't support it. Isn't the returned error enough? > Btw > there is one WARN in the function kvm_set_ipa_limit in the same file. That is called once via kvm_arch_init(), it can't be triggered repeatedly from user-space. Thanks, James