Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp376814ybb; Thu, 28 Mar 2019 04:30:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLRxZPasghZvvuaj26PnBm4B6MpDBgLRz8T/QR8x1WeMeAf/L3GqkNkUFGfpxp/FrknqGM X-Received: by 2002:a63:db14:: with SMTP id e20mr15930481pgg.437.1553772614475; Thu, 28 Mar 2019 04:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553772614; cv=none; d=google.com; s=arc-20160816; b=x1suEDej+HDC/Z5Vp/rDFKI+SapMemDIUUJyJ4YU/e26GD/4ldJAYDi50V8X72ISdA y93k/411qYqU4TGtPZzxGAIinOE5TRaj1rGoUisjXMsz3TuRNvy3OA2Hy3aHxvj79Fbb CFW7CFjO49UFZXp9k8f+/5kvzx6OYTva5NOh0sU2CSDaU7fU1N2GJGA4PylzAyjc3jsS Lyw1lhl6qthvwhxaLxPHkOYBVAU4NIYHcWPN5D2Sg5YJJ56MChXBgtIJmUyClPCVYZik /ckRWgFu+fGb6KSSGsmMlhc5O+ZpNAMb2Tnt+J/tS80LQ3akUkNL/HFMHz1e6dcYN3qF aOSg== 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=mnxZfz9amdze7tpYLHKqMYU0WdaVFZhSUY+KMpg6PJE=; b=dEW0nG5r3AW6BOdVeu9ki38jVn0mXZ/0L9RZbpM04fV/s9AeY11UiPfb/uI+SPinUO Jla1xuV373IOSCYwulkmxKGiNUVVAkMgbDh76ECqF8MXxvV75jVO+2Tiw+HnNQyx4OFc RfnpJ+pTtuJjbI6aPivK+d05yoYEVGNHyn7CSJfM2+6VruzXGy3EayDnJgAEVdHv8xM3 MH16PL7iCUnYlbQjQuZ5cUinjnM2LCrS5glXlsFt1eoy4TEgNldoTowk/uiv/NVBqMXq SozB9uEYFz7Kq/F9PU7cCWiG1zmFEdHxvCQQ8BuJeluc/41RFhax/pVlq06n1GuiJfQ9 CDXQ== 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 d1si11079749pla.243.2019.03.28.04.29.58; Thu, 28 Mar 2019 04:30:14 -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 S1726704AbfC1L3Y (ORCPT + 99 others); Thu, 28 Mar 2019 07:29:24 -0400 Received: from foss.arm.com ([217.140.101.70]:42988 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbfC1L3Y (ORCPT ); Thu, 28 Mar 2019 07:29:24 -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 E51E415AB; Thu, 28 Mar 2019 04:29:23 -0700 (PDT) Received: from [10.162.0.144] (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C35D3F59C; Thu, 28 Mar 2019 04:29:19 -0700 (PDT) Subject: Re: [PATCH v7 7/10] KVM: arm/arm64: context-switch ptrauth registers To: James Morse , 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> <13ab02cf-db27-d604-6e5f-d276dec0779b@arm.com> From: Amit Daniel Kachhap Message-ID: <8c38a9fe-8310-4903-7042-e8b5eb3b5f1b@arm.com> Date: Thu, 28 Mar 2019 16:59:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <13ab02cf-db27-d604-6e5f-d276dec0779b@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 Hi James, On 3/27/19 11:46 PM, James Morse wrote: > 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? Yes Agree that most of the time the user invoked functions are just returned with error value in case of failure. Thanks for the details. Regards, Amit D > > >> 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 >