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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 183FDC4332F for ; Mon, 26 Dec 2022 07:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbiLZH0q (ORCPT ); Mon, 26 Dec 2022 02:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiLZH0m (ORCPT ); Mon, 26 Dec 2022 02:26:42 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CF54CE5; Sun, 25 Dec 2022 23:26:41 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id 7so6798283pga.1; Sun, 25 Dec 2022 23:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5BP28ThNDrV2+rj7tyFrglRNo5Mo/dZrYmPpGBSiwqg=; b=J9xkOrFjRuPH/wQYbTXZd86iNKUmAZCtUK8mRWuXKGimVW+cix1U7UmdkbEelLbyqA udrffEjJy6YF+oHuN94bvwxsO1PRXL3UesBT752P6lgGBxHBestN3hu3yg2aET+DEdah MHlVZw5qDx8oeM/9k8RlcRdWrjr/SCfj6n8SKRRc2MBwaM+CuUkxXvEBsfW3u4ZeZdbp iuP1e+aVAXTCVMTrZOh2IPJ4WBbRNH4b+HgWWbgymuGAq3VhMMdjgc9mWjsr+BWHvE9c sihA3I2RdPuZJMpxWLNLhU8JT4hHjHcK17GySMtrDK5hJ79PTdurllIqiltLzjboyyoy ppSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5BP28ThNDrV2+rj7tyFrglRNo5Mo/dZrYmPpGBSiwqg=; b=b0/BbMFbLrFjEAAX4/svR+t/rNQDRzC9ylXXDVzfytvQXkMRK71m+EVWXeNUcXLMbD xZEkU951VzwEnUM6it/Z13ws4GHr7MJAfKQNtqcLzU1l9z9bHZ4YrTCr89z1jnim77vY 2qgGFAPPh7zulM2hTQGjo8sBv7pcMsfa4aceCPG3zs5SaPIvLcBlwFBcV/ZBDNRcequf EP/ZABMi/IQpDZZZLVi3GszDUtfO4X4s9pdfl964mKo3kofwlfzbRkN0/d/bj+zOFj/V 2Vl2iyJlV1OaDj47REtRYEWsgQ9Zjb6isPDWDSmznaE+PtCm/ci/tv2zd6WN8JqMC92s fMsw== X-Gm-Message-State: AFqh2kqafDJwGcdeIWbHetHMlnj3KDVRciCMdVELugBDANb9jQboQz8w uroIez8IeB0oS6AnBhBPbsw= X-Google-Smtp-Source: AMrXdXuyr5O0DLExCO9wALqIc5t/+SNGh1usm32pp45Z+S6V5/Is/1z5fyykemBBcsB1O66woqdJUQ== X-Received: by 2002:a62:4e93:0:b0:57f:ef11:acf9 with SMTP id c141-20020a624e93000000b0057fef11acf9mr18045290pfb.10.1672039600680; Sun, 25 Dec 2022 23:26:40 -0800 (PST) Received: from ?IPV6:2404:f801:0:5:8000::75b? ([2404:f801:9000:1a:efea::75b]) by smtp.gmail.com with ESMTPSA id a7-20020aa795a7000000b0056cea9530b6sm1845037pfk.202.2022.12.25.23.26.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Dec 2022 23:26:40 -0800 (PST) Message-ID: Date: Mon, 26 Dec 2022 15:26:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [RFC PATCH V2 10/18] drivers: hv: Decrypt percpu hvcall input arg page in sev-snp enlightened guest Content-Language: en-US To: "Michael Kelley (LINUX)" , "luto@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "seanjc@google.com" , "pbonzini@redhat.com" , "jgross@suse.com" , Tianyu Lan , "kirill@shutemov.name" , "jiangshan.ljs@antgroup.com" , "peterz@infradead.org" , "ashish.kalra@amd.com" , "srutherford@google.com" , "akpm@linux-foundation.org" , "anshuman.khandual@arm.com" , "pawan.kumar.gupta@linux.intel.com" , "adrian.hunter@intel.com" , "daniel.sneddon@linux.intel.com" , "alexander.shishkin@linux.intel.com" , "sandipan.das@amd.com" , "ray.huang@amd.com" , "brijesh.singh@amd.com" , "michael.roth@amd.com" , "thomas.lendacky@amd.com" , "venu.busireddy@oracle.com" , "sterritt@google.com" , "tony.luck@intel.com" , "samitolvanen@google.com" , "fenghua.yu@intel.com" Cc: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-arch@vger.kernel.org" References: <20221119034633.1728632-1-ltykernel@gmail.com> <20221119034633.1728632-11-ltykernel@gmail.com> From: Tianyu Lan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/15/2022 2:16 AM, Michael Kelley (LINUX) wrote: >> @@ -134,6 +136,16 @@ int hv_common_cpu_init(unsigned int cpu) >> if (!(*inputarg)) >> return -ENOMEM; >> >> + if (hv_isolation_type_en_snp()) { >> + ret = set_memory_decrypted((unsigned long)*inputarg, 1); >> + if (ret) { >> + kfree(*inputarg); > After the kfree(), set *inputarg back to NULL. There's other code that > tests the value of *inputarg to know if the per-CPU hypercall page has > been successfully allocated. > Good point! Will add in the next version.