Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp969316rwl; Fri, 4 Nov 2022 08:21:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7A+7WP7QImpqNNJThQqz7uaIC936hDUeQND37CR2ef0SE+V/QLbiK/50kbO5jgNK2YG9CZ X-Received: by 2002:a05:6402:344:b0:461:7d4:9c9 with SMTP id r4-20020a056402034400b0046107d409c9mr37056806edw.141.1667575302083; Fri, 04 Nov 2022 08:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667575302; cv=none; d=google.com; s=arc-20160816; b=bbuTErBaxf9X2SBfe/7Pe4c+OgyYc9qHT4U6/rJWwXdeAxTL/SvWSa4SdgpOgygA3e ESHoMBG58FyF66GEAicyJkMDKjNMV2hSgnUw4B/g0L7c3muOBr55jQNgmedLL6ZmuCIz 1/SQM/4ic2jPimzghfnmvQdpMQn2YxUfrNomRS2KzmZTsADISGaAylTNuzJ9QeQc4ls4 qQ/wXgw2s7uRSLDbkPrFwJ8zF6keBELbVfcalulhKY/y4qgLTgi4KlsnJveI0cAU6lZS Y3Avp1Fy32/N43qaYA7B3VDOlVGxwaPscQ6ZXPg8HtM0k7WESx+KIgnT7qHhi6hcIS30 ibMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1an+J99zqjFHVTAI9XIMhNyYuftxnv8dpBjmzzebhqg=; b=g4wMiU6EozxDiqGxalZA6vLFvrhrw+hHTkBtWpchmBDXspqUz+682b00vjt6t6Mp6m usGu7d4/KRjOwIMrw9z9aupmulTKI9hDWavImm7QtVXiO96GzmKYBPrr4oUnrBrowKNs 49323y+/kjEOStUk91bWNklGhG6QzJ6jly1JlHsDuiXlLob6PCjvFDVqnamHf2h58F47 pyEluY5Ovxqjs4ygqyhUThMCD2temeVNND2ASPUz1FDnPBLxEelNRlgLeQ1VQZtAviSe h8UAKCBn8mQVNbozbxW5VQtK5JztpevPhX+Axi1A8IYSWCCTljWR5HFrZv3lmOlCmWBc jgHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KT20S8E6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz13-20020a170906cd0d00b00781df60a2c8si3172734ejb.342.2022.11.04.08.21.18; Fri, 04 Nov 2022 08:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KT20S8E6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbiKDOkb (ORCPT + 96 others); Fri, 4 Nov 2022 10:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiKDOkK (ORCPT ); Fri, 4 Nov 2022 10:40:10 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C87132BB2 for ; Fri, 4 Nov 2022 07:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667572699; x=1699108699; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+BDW2rlh59H9OsdW2Tw7Cz4tXSOMyT1tD39twyGaGg0=; b=KT20S8E63IuuPGyCAsGrT9NJHHiQFEEPmMbCR6U9zQlMvCYyViG0ZxTA SENoSCh1NTUCyUJevQFcIJ+lCW8CWHgzlkN3653mcKa3alzUr5d+VGNam WcAVyu5qUbWlNZhVB+SE1OKjF+B6lSLs1zcOvLpwObv4EIeV5NRrOLP8T 6hy9IJeksgt4IbGM4tb25jApbyzXnM6+5YAMWBDNB12N4lP8jY20SyQQr 4pu4/s6ndiRsLlaqvzCk0tmMY339m54prMvTGZVj+O9+9+4yBswEJoQbk o8mnh3uc/B1vcCzQUgkni3pAMohwfNbl/xiqOLQMmQI5piSQgr025ImaW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="309969285" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="309969285" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 07:38:19 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="668373765" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="668373765" Received: from anantsin-mobl2.amr.corp.intel.com (HELO [10.209.97.57]) ([10.209.97.57]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 07:38:18 -0700 Message-ID: <1c9a1b86-efef-fa56-4451-ac3348b678bf@intel.com> Date: Fri, 4 Nov 2022 07:38:17 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [RFC v2 4/5] x86/crash: make the page that stores the LUKS volume key inaccessible Content-Language: en-US To: Coiby Xu , kexec@lists.infradead.org Cc: Milan Broz , Thomas Staudt , Kairui Song , dm-devel@redhat.com, Jan Pazdziora , Pingfan Liu , Baoquan He , Dave Young , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" References: <20221104113000.487098-1-coxu@redhat.com> <20221104113000.487098-5-coxu@redhat.com> From: Dave Hansen In-Reply-To: <20221104113000.487098-5-coxu@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/4/22 04:29, Coiby Xu wrote: > + if (kexec_crash_image->luks_volume_key_addr) { > + start = kexec_crash_image->luks_volume_key_addr; > + end = start + kexec_crash_image->luks_volume_key_sz - 1; > + page = pfn_to_page(start >> PAGE_SHIFT); > + nr_pages = (end >> PAGE_SHIFT) - (start >> PAGE_SHIFT) + 1; > + set_memory_np((unsigned long)page_address(page), nr_pages); > + } Why does this go pfn -> page -> vaddr? What good does having the page do? Can you just do phys_to_virt() on the start address? Maybe: start_paddr = kexec_crash_image->luks_volume_key_addr; end_paddr = start_paddr + kexec_crash_image->luks_volume_key_sz - 1; nr_pages = (PAGE_ALIGN(end_paddr) - PAGE_ALIGN_DOWN(start_paddr))/ PAGE_SIZE; set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages); Also, if you resend this, please just cc the x86 folks on the series. The other patches and cover letter have desperately needed context around this.