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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AA01C4332F for ; Mon, 7 Nov 2022 08:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667810416; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8b1Im7u5xfZnECzn/dqviExAYhlR88i0s8miSnj9CGU=; b=FoD19hBuV2DG2LERRqPt1shlzSdzP3jucF7ENeC6CN4je1XlXGgC0GNpQ3bNv6ugbvY4NN VfeX8XxLkCZJ8ZY6YmnT0Ty/eZ/ASJiX/q6/Pbq33s199jI6VHfOVpO9nmFj3oDOo5zPxx bAboZPkpcVfrm8UucZ6MQH1ZhPrVltw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-Uhtlp5UVPWOvyh5EUZx-cQ-1; Mon, 07 Nov 2022 03:40:13 -0500 X-MC-Unique: Uhtlp5UVPWOvyh5EUZx-cQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EAE088434A; Mon, 7 Nov 2022 08:40:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C6A92166B31; Mon, 7 Nov 2022 08:40:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DD08319465B3; Mon, 7 Nov 2022 08:40:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B3A501946586 for ; Fri, 4 Nov 2022 14:39:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A5AC22166B26; Fri, 4 Nov 2022 14:39:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F1912166B48 for ; Fri, 4 Nov 2022 14:39:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81A1A86F132 for ; Fri, 4 Nov 2022 14:39:29 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-172-xPw6lnOeOcGrrkg9OFyv1Q-1; Fri, 04 Nov 2022 10:39:25 -0400 X-MC-Unique: xPw6lnOeOcGrrkg9OFyv1Q-1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="289697017" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="289697017" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.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 To: Coiby Xu , kexec@lists.infradead.org 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> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mailman-Approved-At: Mon, 07 Nov 2022 08:40:06 +0000 Subject: Re: [dm-devel] [RFC v2 4/5] x86/crash: make the page that stores the LUKS volume key inaccessible X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , "H. Peter Anvin" , Baoquan He , Dave Hansen , dm-devel@redhat.com, Pingfan Liu , linux-kernel@vger.kernel.org, Kairui Song , Ingo Molnar , Borislav Petkov , Jan Pazdziora , Thomas Staudt , Thomas Gleixner , Dave Young , Milan Broz Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3FBAC4332F for ; Fri, 4 Nov 2022 14:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mzA3Op99KpjdRbMIEAXXUqAtawrwLnrSA4+6Qlx/D+A=; b=YYI/U2+kFtjVkD ynhQUnZ3gW7o/qyV/soafGWJ+/213ozdK2rU1G0R0fFDaXUGcjR1Gpcoqdfssw/tYkCnFflyJhs8c 5Ok3PX4i5AgXxvmFj8+HxjZncFzPnWVSHmxHnY8tZwNfkGLsF96OGiJ7ykAfJ34B/WFlaqliOs9BO NtgdbzLdqwCSLfG+51LcNwDjlD38LGk96WOKV/cy0xLkGxnEQN00K8J1+KwemNCqawVYWPTIxkOLd nGVWfL8e8JiIe64CvyzX8SACf0Xqs7EHMOY3vqEzuy749zvj25LkAgAv+7FD+UY5Kned/dfzDObi0 MGilNf2WflHf59diapgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxq1-0042gx-Nd; Fri, 04 Nov 2022 14:38:29 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxpz-0042fG-FI for kexec@lists.infradead.org; Fri, 04 Nov 2022 14:38:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667572707; x=1699108707; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+BDW2rlh59H9OsdW2Tw7Cz4tXSOMyT1tD39twyGaGg0=; b=Rr8RW+y/5VLi6ZLVuTzXADJ9kUe4OP4Y1ByNcDjsd1U4UvsEXZAX+qiJ GQIPWaEyUUaO6JqteXpgWaIN+VIqpZgDD6z563gGUTGrpaLLuMpVVzkUi mlhyJ2APEUZg1BGJKzxd5SlAAXPjIx+Tha53To8hfrZdDm4Vy31guifzZ ZwD3qvsobXfyg2815QkyApFpXySmi3SxXNG8vp/76Et1wKN+Qj164wcGT YvNLqt98yDF39JWIZEnrMrHxufkl14OT4wCjT8HA+NAjRIBmJdEviJwhI O1Jb0j8yue/lS+ggh7SwTtzvr7FHSOfokWwCdZE7YQIbNEdNx91WsZvve w==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="308692016" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="308692016" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_073827_554590_A03978A2 X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.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. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec 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 39974C4321E for ; Fri, 4 Nov 2022 14:40:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232210AbiKDOkc (ORCPT ); Fri, 4 Nov 2022 10:40:32 -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 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.